Module: ElasticGraph::Apollo::SchemaDefinition::FactoryExtension
- Defined in:
- lib/elastic_graph/apollo/schema_definition/factory_extension.rb
Overview
Extension module applied to ‘ElasticGraph::SchemaDefinition::Factory` to add Apollo tagging support.
Instance Method Summary collapse
- #new_argument(field, name, value_type) ⇒ Object
- #new_enum_type(name) ⇒ Object
- #new_enum_value(name, original_name) ⇒ Object
- #new_graphql_sdl_enumerator(all_types_except_root_query_type) ⇒ Object
- #new_input_type(name) ⇒ Object
- #new_interface_type(name) ⇒ Object
-
#new_object_type(name) ⇒ Object
Here we override ‘object_type` in order to automatically add the apollo `@key` directive to indexed types.
- #new_scalar_type(name) ⇒ Object
- #new_union_type(name) ⇒ Object
Instance Method Details
#new_argument(field, name, value_type) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 39 def new_argument(field, name, value_type) super(field, name, value_type) do |type| type.extend ArgumentExtension yield type if block_given? end end |
#new_enum_type(name) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 46 def new_enum_type(name) super(name) do |type| type.extend EnumTypeExtension yield type end end |
#new_enum_value(name, original_name) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 53 def new_enum_value(name, original_name) super(name, original_name) do |type| type.extend EnumValueExtension yield type if block_given? end end |
#new_graphql_sdl_enumerator(all_types_except_root_query_type) ⇒ Object
33 34 35 36 37 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 33 def new_graphql_sdl_enumerator(all_types_except_root_query_type) super.tap do |enum| enum.extend GraphQLSDLEnumeratorExtension end end |
#new_input_type(name) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 60 def new_input_type(name) super(name) do |type| type.extend InputTypeExtension yield type end end |
#new_interface_type(name) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 67 def new_interface_type(name) super(name) do |type| type.extend InterfaceTypeExtension yield type end end |
#new_object_type(name) ⇒ Object
Here we override ‘object_type` in order to automatically add the apollo `@key` directive to indexed types.
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 75 def new_object_type(name) super(name) do |raw_type| raw_type.extend ObjectTypeExtension type = raw_type # : ElasticGraph::SchemaDefinition::SchemaElements::ObjectType & ObjectTypeExtension yield type if block_given? if type.indexed? && type.graphql_fields_by_name.key?("id") type.apollo_key fields: "id" end end end |
#new_scalar_type(name) ⇒ Object
88 89 90 91 92 93 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 88 def new_scalar_type(name) super(name) do |type| type.extend ScalarTypeExtension yield type end end |
#new_union_type(name) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/elastic_graph/apollo/schema_definition/factory_extension.rb', line 95 def new_union_type(name) super(name) do |type| type.extend UnionTypeExtension yield type end end |