Class: ElasticGraph::SchemaDefinition::SchemaElements::InputType
- Inherits:
-
TypeWithSubfields
- Object
- Struct
- TypeWithSubfields
- ElasticGraph::SchemaDefinition::SchemaElements::InputType
- Defined in:
- lib/elastic_graph/schema_definition/schema_elements/input_type.rb
Overview
Represents a GraphQL ‘input` (used primarily for filtering).
Constant Summary
Constants included from Mixins::HasTypeInfo
Mixins::HasTypeInfo::CUSTOMIZABLE_DATASTORE_PARAMS
Instance Attribute Summary
Attributes inherited from TypeWithSubfields
#field_factory, #graphql_fields_by_name, #indexing_fields_by_name_in_index, #relay_pagination_type, #reserved_field_names, #schema_def_state, #schema_kind, #type_ref, #wrapping_type
Attributes included from Mixins::HasDocumentation
Instance Method Summary collapse
- #derived_graphql_types ⇒ Object
-
#initialize(schema_def_state, name) ⇒ InputType
constructor
A new instance of InputType.
- #runtime_metadata(extra_update_targets) ⇒ Object
Methods inherited from TypeWithSubfields
#aggregated_values_type, #current_sources, #deleted_field, #field, #generate_sdl, #index_field_runtime_metadata_tuples, #indexed?, #name, #paginated_collection_field, #relates_to_many, #relates_to_one, #renamed_from, #to_indexing_field_type, #to_sdl
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, #derived_field_customizations_by_name_for_type, #derived_field_customizations_by_type_and_field_name, #derived_type_customizations_by_name, #derived_type_customizations_for_type
Methods included from Mixins::HasDirectives
#directive, #directives, #directives_sdl
Methods included from Mixins::HasDocumentation
#append_to_documentation, #derived_documentation, #documentation, #formatted_documentation
Methods included from Mixins::CanBeGraphQLOnly
Methods included from Mixins::VerifiesGraphQLName
Constructor Details
#initialize(schema_def_state, name) ⇒ InputType
Returns a new instance of InputType.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/elastic_graph/schema_definition/schema_elements/input_type.rb', line 22 def initialize(schema_def_state, name) schema_def_state.factory.new_type_with_subfields( :input, name, wrapping_type: self, field_factory: schema_def_state.factory.method(:new_input_field) ) do |type| # Here we clear `reserved_field_names` because those field names are reserved precisely for our usage # here on input filters. If we don't set this to an empty set we'll get exceptions in `new_filter` above # when we generate our standard filter operators. # # Note: we opt-out of the reserved field names here rather then opting in on the other `TypeWithSubfields` # subtypes because this is the only case where we don't want the reserved field name check applied (but we # have multiple subtypes where we do want it applied). type.reserved_field_names = Set.new super(type) graphql_only true yield self end end |
Instance Method Details
#derived_graphql_types ⇒ Object
54 55 56 |
# File 'lib/elastic_graph/schema_definition/schema_elements/input_type.rb', line 54 def derived_graphql_types [] end |
#runtime_metadata(extra_update_targets) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elastic_graph/schema_definition/schema_elements/input_type.rb', line 43 def (extra_update_targets) SchemaArtifacts::RuntimeMetadata::ObjectType.new( update_targets: extra_update_targets, index_definition_names: [], graphql_fields_by_name: graphql_fields_by_name.transform_values(&:runtime_metadata_graphql_field), elasticgraph_category: nil, source_type: nil, graphql_only_return_type: false ) end |