Module: ElasticGraph::JSONSchema

Defined in:
lib/elastic_graph/json_schema/meta_schema_validator.rb,
lib/elastic_graph/json_schema/validator.rb,
lib/elastic_graph/json_schema/validator_factory.rb

Overview

Provides [JSON Schema](json-schema.org/) validation for ElasticGraph.

Defined Under Namespace

Modules: MetaSchemaLoader Classes: Validator, ValidatorFactory

Class Method Summary collapse

Class Method Details

.elastic_graph_internal_meta_schema_validatorValidator

Provides a validator to validate a JSON schema definition according to the JSON schema meta schema. The validator is configured to validate strictly, so that non-standard JSON schema properties are disallowed, except for internal ElasticGraph metadata properties.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/elastic_graph/json_schema/meta_schema_validator.rb', line 32

def self.elastic_graph_internal_meta_schema_validator
  @elastic_graph_internal_meta_schema_validator ||= MetaSchemaLoader.load_strict_validator({
    "properties" => {
      "ElasticGraph" => {
        "type" => "object",
        "required" => ["type", "nameInIndex"],
        "properties" => {
          "type" => {"type" => "string"},
          "nameInIndex" => {"type" => "string"}
        }
      }
    }
  })
end

.strict_meta_schema_validatorValidator

Provides a validator to validate a JSON schema definitions according to the JSON schema meta schema. The validator is configured to validate strictly, so that non-standard JSON schema properties are disallowed.



22
23
24
# File 'lib/elastic_graph/json_schema/meta_schema_validator.rb', line 22

def self.strict_meta_schema_validator
  @strict_meta_schema_validator ||= MetaSchemaLoader.load_strict_validator
end