Module: Philiprehberger::JsonSchema
- Defined in:
- lib/philiprehberger/json_schema.rb,
lib/philiprehberger/json_schema/version.rb,
lib/philiprehberger/json_schema/validator.rb
Defined Under Namespace
Classes: CompiledSchema, Error, Validator
Constant Summary collapse
- VERSION =
'0.3.0'
Class Method Summary collapse
-
.compile(schema) ⇒ CompiledSchema
Compile a schema for repeated validation.
-
.valid?(data, schema) ⇒ Boolean
Check if data is valid against a JSON Schema.
-
.validate(data, schema) ⇒ Array<String>
Validate data against a JSON Schema and return error messages.
Class Method Details
.compile(schema) ⇒ CompiledSchema
Compile a schema for repeated validation
32 33 34 |
# File 'lib/philiprehberger/json_schema.rb', line 32 def self.compile(schema) CompiledSchema.new(schema) end |
.valid?(data, schema) ⇒ Boolean
Check if data is valid against a JSON Schema
24 25 26 |
# File 'lib/philiprehberger/json_schema.rb', line 24 def self.valid?(data, schema) validate(data, schema).empty? end |