Class: JsonSchema::SchemaError

Inherits:
Object
  • Object
show all
Defined in:
lib/json_schema/schema_error.rb

Direct Known Subclasses

ValidationError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema, message, type) ⇒ SchemaError

Returns a new instance of SchemaError.



9
10
11
12
13
# File 'lib/json_schema/schema_error.rb', line 9

def initialize(schema, message, type)
  @schema = schema
  @message = message
  @type = type
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/json_schema/schema_error.rb', line 3

def message
  @message
end

#schemaObject

Returns the value of attribute schema.



3
4
5
# File 'lib/json_schema/schema_error.rb', line 3

def schema
  @schema
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/json_schema/schema_error.rb', line 3

def type
  @type
end

Class Method Details

.aggregate(errors) ⇒ Object



5
6
7
# File 'lib/json_schema/schema_error.rb', line 5

def self.aggregate(errors)
  errors.map(&:to_s)
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/json_schema/schema_error.rb', line 15

def to_s
  "#{schema.pointer}: #{message}"
end