Module: ElasticGraph::JSONSchema::MetaSchemaLoader
- Defined in:
- lib/elastic_graph/json_schema/meta_schema_validator.rb
Class Method Summary collapse
Class Method Details
.load_strict_validator(overrides = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elastic_graph/json_schema/meta_schema_validator.rb', line 39 def self.load_strict_validator(overrides = {}) # Downloaded from: https://json-schema.org/draft-07/schema schema = ::JSON.parse(::File.read(::File.("../json_schema_draft_7_schema.json", __FILE__))) schema = Support::HashUtil.deep_merge(schema, overrides) unless overrides.empty? # The meta schema allows additionalProperties in nearly every place. While a JSON schema definition # with additional properties is considered valid, we do not intend to use any additional properties, # and any usage of an additional property is almost certainly a typo. So here we set # `with_unknown_properties_disallowed`. root_schema = ValidatorFactory.new(schema: schema, sanitize_pii: false) # The meta schema has no PII .with_unknown_properties_disallowed .root_schema Validator.new(schema: root_schema, sanitize_pii: false) end |