Module: ElasticGraph

Defined in:
lib/elastic_graph/schema_definition/mixins/has_directives.rb,
lib/elastic_graph/schema_definition/api.rb,
lib/elastic_graph/schema_definition/state.rb,
lib/elastic_graph/schema_definition/factory.rb,
lib/elastic_graph/schema_definition/results.rb,
lib/elastic_graph/schema_definition/rake_tasks.rb,
lib/elastic_graph/schema_definition/test_support.rb,
lib/elastic_graph/schema_definition/indexing/field.rb,
lib/elastic_graph/schema_definition/indexing/index.rb,
lib/elastic_graph/schema_definition/scripting/script.rb,
lib/elastic_graph/schema_definition/json_schema_pruner.rb,
lib/elastic_graph/schema_definition/mixins/has_indices.rb,
lib/elastic_graph/schema_definition/mixins/has_subtypes.rb,
lib/elastic_graph/schema_definition/mixins/has_type_info.rb,
lib/elastic_graph/schema_definition/schema_elements/field.rb,
lib/elastic_graph/schema_definition/indexing/event_envelope.rb,
lib/elastic_graph/schema_definition/schema_artifact_manager.rb,
lib/elastic_graph/schema_definition/indexing/field_reference.rb,
lib/elastic_graph/schema_definition/indexing/field_type/enum.rb,
lib/elastic_graph/schema_definition/indexing/rollover_config.rb,
lib/elastic_graph/schema_definition/mixins/has_documentation.rb,
lib/elastic_graph/schema_definition/schema_elements/argument.rb,
lib/elastic_graph/schema_definition/indexing/field_type/union.rb,
lib/elastic_graph/schema_definition/schema_elements/directive.rb,
lib/elastic_graph/schema_definition/schema_elements/enum_type.rb,
lib/elastic_graph/schema_definition/indexing/field_type/object.rb,
lib/elastic_graph/schema_definition/indexing/field_type/scalar.rb,
lib/elastic_graph/schema_definition/mixins/can_be_graphql_only.rb,
lib/elastic_graph/schema_definition/schema_elements/enum_value.rb,
lib/elastic_graph/schema_definition/schema_elements/field_path.rb,
lib/elastic_graph/schema_definition/schema_elements/input_type.rb,
lib/elastic_graph/schema_definition/schema_elements/type_namer.rb,
lib/elastic_graph/schema_definition/schema_elements/union_type.rb,
lib/elastic_graph/schema_definition/schema_elements/input_field.rb,
lib/elastic_graph/schema_definition/schema_elements/object_type.rb,
lib/elastic_graph/schema_definition/schema_elements/scalar_type.rb,
lib/elastic_graph/schema_definition/indexing/list_counts_mapping.rb,
lib/elastic_graph/schema_definition/mixins/implements_interfaces.rb,
lib/elastic_graph/schema_definition/mixins/verifies_graphql_name.rb,
lib/elastic_graph/schema_definition/schema_elements/field_source.rb,
lib/elastic_graph/schema_definition/schema_elements/relationship.rb,
lib/elastic_graph/schema_definition/indexing/derived_indexed_type.rb,
lib/elastic_graph/schema_definition/mixins/supports_default_value.rb,
lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb,
lib/elastic_graph/schema_definition/indexing/update_target_factory.rb,
lib/elastic_graph/schema_definition/schema_elements/built_in_types.rb,
lib/elastic_graph/schema_definition/schema_elements/interface_type.rb,
lib/elastic_graph/schema_definition/schema_elements/type_reference.rb,
lib/elastic_graph/schema_definition/indexing/update_target_resolver.rb,
lib/elastic_graph/schema_definition/schema_elements/enum_value_namer.rb,
lib/elastic_graph/schema_definition/scripting/file_system_repository.rb,
lib/elastic_graph/schema_definition/schema_elements/list_counts_state.rb,
lib/elastic_graph/schema_definition/indexing/json_schema_with_metadata.rb,
lib/elastic_graph/schema_definition/schema_elements/deprecated_element.rb,
lib/elastic_graph/schema_definition/indexing/json_schema_field_metadata.rb,
lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb,
lib/elastic_graph/schema_definition/mixins/has_readable_to_s_and_inspect.rb,
lib/elastic_graph/schema_definition/schema_elements/sub_aggregation_path.rb,
lib/elastic_graph/schema_definition/schema_elements/sort_order_enum_value.rb,
lib/elastic_graph/schema_definition/schema_elements/graphql_sdl_enumerator.rb,
lib/elastic_graph/schema_definition/indexing/derived_fields/append_only_set.rb,
lib/elastic_graph/schema_definition/indexing/derived_fields/immutable_value.rb,
lib/elastic_graph/schema_definition/schema_elements/enums_for_indexed_types.rb,
lib/elastic_graph/schema_definition/indexing/derived_fields/min_or_max_value.rb,
lib/elastic_graph/schema_definition/mixins/supports_filtering_and_aggregation.rb,
lib/elastic_graph/schema_definition/mixins/has_derived_graphql_type_customizations.rb,
lib/elastic_graph/schema_definition/indexing/derived_fields/field_initializer_support.rb

Overview

Copyright 2024 Block, Inc.

Use of this source code is governed by an MIT-style license that can be found in the LICENSE file or at opensource.org/licenses/MIT.

frozen_string_literal: true

Defined Under Namespace

Modules: SchemaDefinition

Class Method Summary collapse

Class Method Details

.define_schemaObject

The main entry point for schema definition from ElasticGraph applications.

Call this API from a Ruby file configured as the ‘path_to_schema` (or from a Ruby file `load`ed from the `path_to_schema` file).

Examples:

ElasticGraph.define_schema do |schema|
  # The `schema` object provides the schema definition API. Use it in this block.
end


25
26
27
28
29
30
31
32
# File 'lib/elastic_graph/schema_definition/api.rb', line 25

def self.define_schema
  if (api_instance = ::Thread.current[:ElasticGraph_SchemaDefinition_API_instance])
    yield api_instance
  else
    raise Errors::SchemaError, "No active `SchemaDefinition::API` instance is available. " \
      "Let ElasticGraph load the schema definition files."
  end
end