Class: ElasticGraph::SchemaDefinition::SchemaElements::NamespaceType
- Inherits:
-
ObjectType
- Object
- Struct
- TypeWithSubfields
- ObjectType
- ElasticGraph::SchemaDefinition::SchemaElements::NamespaceType
- Defined in:
- elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/namespace_type.rb
Overview
Defines a GraphQL object type that serves as a namespace for grouping root query fields.
Instead of adding an indexed type's root query fields directly to Query (e.g. Query.widgets),
a namespace type lets you group them under a nested path (e.g. Query.olap.widgets). This is
particularly useful when composing ElasticGraph into a federated supergraph, where grouping
related fields under a namespace can be useful for separating parts of the supergraph with differing conventions
or semantics.
A namespace type is a GraphQL object type with two differences from a regular object type:
- It cannot be indexed (calling
indexon it raises an error). - Any no-argument field (on any parent type, including
Query) whose return type is a namespace type will be automatically resolved, so you don't have to assign a resolver for intermediate namespace fields.
A namespace type is an ObjectType that exists purely to group fields on Query (or on
another namespace type) under a shared path. It cannot be indexed, and any no-argument field
(on any parent type) whose return type is a namespace type is automatically resolved.
Constant Summary
Constants included from Mixins::HasIndices
Mixins::HasIndices::NAMESPACE_RESOLVER
Constants included from Mixins::HasTypeInfo
Mixins::HasTypeInfo::CUSTOMIZABLE_DATASTORE_PARAMS
Instance Attribute Summary
Attributes included from Mixins::HasIndices
Attributes included from Mixins::HasDocumentation
Method Summary
Methods included from Mixins::ImplementsInterfaces
#implemented_interfaces, #implements, #to_sdl
Methods included from Mixins::HasIndices
#derive_indexed_type_fields, #derived_indexed_types, #directly_queryable?, #has_own_index_def?, #index_def, #override_runtime_metadata, #own_index_def, #plural_root_query_field_name, #resolve_fields_with, #root_document_type?, #root_query_fields, #root_query_fields_target_namespace, #singular_root_query_field_name
Methods inherited from TypeWithSubfields
#deleted_field, #field, #name, #paginated_collection_field, #relates_to_many, #relates_to_one, #renamed_from
Methods included from Mixins::HasTypeInfo
#json_schema, #json_schema_options, #mapping, #mapping_options
Methods included from Mixins::HasDerivedGraphQLTypeCustomizations
#customize_derived_type_fields, #customize_derived_types
Methods included from Mixins::HasDirectives
#directive, #directives, #directives_sdl
Methods included from Mixins::HasDocumentation
#append_to_documentation, #derived_documentation, #documentation, #formatted_documentation