Module: JsonSchema
- Defined in:
- lib/json_schema.rb,
lib/json_schema/parser.rb,
lib/json_schema/schema.rb,
lib/json_schema/validator.rb,
lib/json_schema/schema_error.rb,
lib/json_schema/document_store.rb,
lib/json_schema/reference_expander.rb
Defined Under Namespace
Classes: DocumentStore, Parser, ReferenceExpander, Schema, SchemaError, Validator
Class Method Summary
collapse
Class Method Details
.parse(data) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/json_schema.rb', line 9
def self.parse(data)
parser = Parser.new
if schema = parser.parse(data)
valid, errors = schema.expand_references
if valid
[schema, nil]
else
[nil, errors]
end
else
[nil, parser.errors]
end
end
|
.parse!(data) ⇒ Object
23
24
25
26
27
|
# File 'lib/json_schema.rb', line 23
def self.parse!(data)
schema = Parser.new.parse!(data)
schema.expand_references!
schema
end
|