class GraphQL::Schema::Schema
- GraphQL::Schema::Schema
- Reference
- Object
Overview
Represents a GraphQL Schema against which queries can be executed.
Included Modules
Defined in:
graphql-crystal/schema/schema.crgraphql-crystal/schema/schema_execute.cr
Constant Summary
-
GRAPHQL_FIELDS =
[{:__typename, "", args, ""}, {:types, "", args, ""}, {:directives, "", args, ""}, {:subscriptionType, "", args, ""}, {:queryType, "", args, ""}, {:mutationType, "", args, ""}] of Tuple(Symbol, String, Hash(String, String) | ::Nil, String)
-
ScalarTypes =
{ {"String", "A String Value"}, {"Boolean", "A Boolean Value"}, {"Int", "An Integer Number"}, {"Float", "A Floating Point Number"}, {"ID", "An ID"} }
-
Descriptions for Scalar Types
Constructors
-
.new(document : Language::Document)
Takes a parsed GraphQL schema definition
Instance Method Summary
-
#add_input_type(name : String, type : InputType.class)
register a Struct to parse query variables name : the name of the GraphQL Input Type that gets parsed type : the Struct Type to parse the JSON into (has to have the class method from_json see https://crystal-lang.org/api/0.23.1/JSON.html#mapping%28properties%2Cstrict%3Dfalse%29-macro) for more infos
- #directive_definitions : Hash(String, GraphQL::Language::DirectiveDefinition)
- #directive_middlewares : Array(GraphQL::Directives::IncludeDirective | GraphQL::Directives::SkipDirective)
-
#execute(params = ExecuteParams, context = Context.new(self, max_depth))
execute a query against the schema
params
: the Hash with main datacontext
: optional a custom context to be injected in field callbacks. -
#execute(document : Language::Document, params, operation_name : String? = nil, context = Context.new(self, max_depth))
execute a query against the schema
document
: a parsed queryparams
: optional the query variables as Hash or JSON::Anyoperation_name
: optional the query or mutation name to be executedcontext
: optional a custom context to be injected in field callbacks. -
#execute(document : String, params = nil, operation_name : String? = nil, context = Context.new(self, max_depth))
execute a query against the schema
document
: a string representing the query to be executedparams
: optional the query variables as a Hashoperation_name
: optional the query or mutation name to be executedcontext
: optional a custom context to be injected in field callbacks. -
#execute(document : Language::Document, params : Hash(String, JSONType)?, operation_name : String?, context = Context.new(self, max_depth))
execute a query against the schema
document
: a parsed queryparams
: optional the query variables as a Hashoperation_name
: optional the query or mutation name to be executedcontext
: optional a custom context to be injected in field callbacks. - #max_depth(max_depth)
- #max_depth : Int32?
- #mutation_resolver : GraphQL::ObjectType?
- #mutation_resolver=(mutation_resolver)
- #query_resolver : GraphQL::ObjectType?
-
#query_resolver=(query : ObjectType)
Wrap the Root Query in the IntrospectionObject to intercept calls to __schema and __type field
- #query_resolver=(query_resolver)
- #resolve(&block)
-
#resolve_field(name : String, arguments, context : GraphQL::Schema::Context)
resolve a named field on this object with query arguments and context
-
#type_resolve(type : String | Language::AbstractNode)
get a type definition
- #types : Hash(String, GraphQL::Language::TypeDefinition)
- #wrap_cb(resolved : ObjectType)
Macro Summary
Instance methods inherited from module GraphQL::ObjectType
graphql_type
graphql_type,
resolve_field(name, arguments, context)
resolve_field
Instance methods inherited from class Object
debug
debug
Constructor Detail
Instance Method Detail
register a Struct to parse query variables name : the name of the GraphQL Input Type that gets parsed type : the Struct Type to parse the JSON into (has to have the class method from_json see https://crystal-lang.org/api/0.23.1/JSON.html#mapping%28properties%2Cstrict%3Dfalse%29-macro) for more infos
execute a query against the schema
params
: the Hash with main data
context
: optional a custom context to be injected in
field callbacks.
execute a query against the schema
document
: a parsed query
params
: optional the query variables as Hash or JSON::Any
operation_name
: optional the query or mutation name to be executed
context
: optional a custom context to be injected in
field callbacks.
execute a query against the schema
document
: a string representing the query to be executed
params
: optional the query variables as a Hash
operation_name
: optional the query or mutation name to be executed
context
: optional a custom context to be injected in
field callbacks.
execute a query against the schema
document
: a parsed query
params
: optional the query variables as a Hash
operation_name
: optional the query or mutation name to be executed
context
: optional a custom context to be injected in
field callbacks.
Wrap the Root Query in the IntrospectionObject to intercept calls to __schema and __type field
resolve a named field on this object with query arguments and context