module Dry::GraphQL::Struct
Extends Dry::Struct functionality
Public Instance Methods
graphql_type(options = {})
click to toggle source
# File lib/dry/graphql.rb, line 19 def graphql_type(options = {}) 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: options } @graphql_type ||= SchemaBuilder.new(**opts).graphql_type end