Module: Dry::GraphQL
- Defined in:
- lib/dry/graphql.rb,
lib/dry/graphql/rom.rb,
lib/dry/graphql/types.rb,
lib/dry/graphql/version.rb,
lib/dry/graphql/base_object.rb,
lib/dry/graphql/type_mappings.rb,
lib/dry/graphql/schema_builder.rb
Overview
Module containing GraphQL enhancements
Defined Under Namespace
Modules: GeneratedTypes, ROM, Struct, Types Classes: BaseObject, SchemaBuilder, TypeMappings
Constant Summary collapse
- VERSION =
'2.2.2'
Class Method Summary collapse
- .from(type, name:, schema:, **opts) ⇒ Object
-
.generate_graphql_name(obj) ⇒ Object
Generates a graphql_name from a class name.
- .register_type_mapping(input_type, output_type) ⇒ Object
Class Method Details
.from(type, name:, schema:, **opts) ⇒ Object
35 36 37 |
# File 'lib/dry/graphql.rb', line 35 def from(type, name:, schema:, **opts) SchemaBuilder.new(name: name, type: type, schema: schema, options: opts).graphql_type end |
.generate_graphql_name(obj) ⇒ Object
Generates a graphql_name from a class name
11 12 13 14 15 |
# File 'lib/dry/graphql.rb', line 11 def self.generate_graphql_name(obj) return obj.graphql_name if obj.respond_to?(:graphql_name) obj.name.to_s.capitalize.gsub('DryGraphQLGeneratedTypeForUser', '').gsub('::', '__') end |
.register_type_mapping(input_type, output_type) ⇒ Object
39 40 41 |
# File 'lib/dry/graphql.rb', line 39 def register_type_mapping(input_type, output_type) TypeMappings.registry.merge!(input_type => output_type) end |