module GraphQL::ObjectType
Overview
module to be included or extended by Classes and Modules
to make them act as GraphQL Objects. Provides the
field
Macro for defining GraphQL Type Fields.
class MyType
getter :name
def initialize(@name : String, @email : String); end
includes GraphQL::ObjectType
field :name # with no further arguments
# the field will resolve to
# the getter method of the
# same name
field :email { @email } # a block can be provided
# to access instance vars
# a block will be called with an arguments hash
# and the context of the graphql request
field :signature do |args, context|
"#{@name} - #{args[
Direct including types
- GraphQL::Language::AbstractNode
- GraphQL::Schema::Introspection::IntrospectionObject
- GraphQL::Schema::Schema
Defined in:
graphql-crystal/types/object_type.crInstance Method Summary
-
#graphql_type
get the GraphQL name of this object.
-
#resolve_field(name, arguments, context)
This method gets called when a field is resolved on this object.
Macro Summary
-
graphql_type(name)
setter can be used to set GraphQL name of the Object.
-
graphql_type(&block)
setter that takes a block.
Instance Method Detail
def resolve_field(name, arguments, context)
#
This method gets called when a field is resolved on this object. The method gets automatically created for every ObjectType
Macro Detail
macro graphql_type(name)
#
setter can be used to set GraphQL name of the Object. Defaults to the class name. Is used in introspection queries
macro graphql_type(&block)
#
setter that takes a block. can be used to set GraphQL name of the Object. Defaults to the class name. Is used in introspection queries.