Class: Bolt::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeValidator

Returns a new instance of Validator.



12
13
14
15
16
17
# File 'lib/bolt/validator.rb', line 12

def initialize
  @errors       = []
  @deprecations = []
  @warnings     = []
  @path         = []
end

Instance Attribute Details

#deprecationsObject (readonly)

Returns the value of attribute deprecations.



10
11
12
# File 'lib/bolt/validator.rb', line 10

def deprecations
  @deprecations
end

#warningsObject (readonly)

Returns the value of attribute warnings.



10
11
12
# File 'lib/bolt/validator.rb', line 10

def warnings
  @warnings
end

Instance Method Details

#validate(data, schema, location = nil) ⇒ Object

This is the entry method for validating data against the schema.



21
22
23
24
25
26
27
28
# File 'lib/bolt/validator.rb', line 21

def validate(data, schema, location = nil)
  @schema   = schema
  @location = location

  validate_value(data, schema)

  raise_error
end