Module: Dry::GraphQL::Struct
- Defined in:
- lib/dry/graphql.rb
Overview
Extends Dry::Struct functionality
Instance Method Summary collapse
Instance Method Details
#graphql_type(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dry/graphql.rb', line 19 def graphql_type( = {}) return @graphql_type if @graphql_type graphql_name = Dry::GraphQL.generate_graphql_name(self) graphql_schema = SchemaBuilder.build_graphql_schema_class(name) graphql_schema.graphql_name(graphql_name) schema_hash = schema.each_with_object({}) do |type, memo| memo[type.name] = type.type end opts = { name: graphql_name, type: schema_hash, schema: graphql_schema, options: } @graphql_type ||= SchemaBuilder.new(**opts).graphql_type end |