Module: ElasticGraph::Apollo::SchemaDefinition::EntityTypeExtension

Defined in:
lib/elastic_graph/apollo/schema_definition/entity_type_extension.rb

Overview

The Apollo ‘_Entity` type is a union of all entity types in an ElasticGraph schema. These overrides prevent ElasticGraph from treating `_Entity` like a normal indexed union type, which would trigger unwanted derived schema generation and validation.

Instance Method Summary collapse

Instance Method Details

#directly_queryable?Boolean

‘_Entity` is never directly queryable from the root `Query` type. It’s queried via the apollo ‘_entities(representations: …)` field instead.

Returns:

  • (Boolean)


32
33
34
# File 'lib/elastic_graph/apollo/schema_definition/entity_type_extension.rb', line 32

def directly_queryable?
  false
end

#graphql_fields_by_nameObject

A merged set of ‘graphql_fields_by_name` cannot be safely computed. That method raises errors if a field with the same name has conflicting definitions on different subtypes, but we must allow that on `_Entity` subtypes.



20
21
22
# File 'lib/elastic_graph/apollo/schema_definition/entity_type_extension.rb', line 20

def graphql_fields_by_name
  {}
end

#root_document_type?Boolean

‘_Entity` is never a root document type, and should not be treated as one (even though its subtypes are all root document types, which would usually cause it to be treated as a root document type!).

Returns:

  • (Boolean)


26
27
28
# File 'lib/elastic_graph/apollo/schema_definition/entity_type_extension.rb', line 26

def root_document_type?
  false
end