Module: ElasticGraph::JSONIngestion::SchemaDefinition::SchemaElements::ScalarTypeExtension

Includes:
HasJSONSchema
Defined in:
elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/schema_elements/scalar_type_extension.rb

Overview

Extends scalar types with JSON schema validation and serialization behavior.

Instance Method Summary collapse

Methods included from HasJSONSchema

#json_schema, #json_schema_options

Instance Method Details

#finalize_json_schema_configuration!void

This method returns an undefined value.

Validates that json_schema has been configured on this scalar type, and applies post-yield runtime metadata derived from the final JSON schema configuration. GraphQL-only scalar types are skipped because they are not part of ingestion.

Raises:

  • (Errors::SchemaError)

    if json_schema has not been configured on an ingested scalar type



25
26
27
28
29
30
31
32
33
34
35
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/schema_elements/scalar_type_extension.rb', line 25

def finalize_json_schema_configuration!
  return if graphql_only?

  if json_schema_options.empty?
    raise Errors::SchemaError, "Scalar types require `json_schema` to be configured, but `#{name}` lacks `json_schema`."
  end

  if !grouping_missing_value_placeholder_overridden && (placeholder = inferred_grouping_missing_value_placeholder)
    self. = .with(grouping_missing_value_placeholder: placeholder)
  end
end