Class: JsonMatchers::Validator
- Inherits:
-
Object
- Object
- JsonMatchers::Validator
- Defined in:
- lib/json_matchers/validator.rb
Instance Method Summary collapse
-
#initialize(document_store:, schema_path:) ⇒ Validator
constructor
A new instance of Validator.
- #validate(payload) ⇒ Object
Constructor Details
#initialize(document_store:, schema_path:) ⇒ Validator
Returns a new instance of Validator.
5 6 7 8 |
# File 'lib/json_matchers/validator.rb', line 5 def initialize(document_store:, schema_path:) @document_store = document_store @schema_path = schema_path end |
Instance Method Details
#validate(payload) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/json_matchers/validator.rb', line 10 def validate(payload) json_schema.validate!(payload.as_json, fail_fast: true) [] rescue JsonSchema::Error => error [error.] end |