Top Level Namespace
Defined Under Namespace
Modules: Graphql, RelaySchemaHelpers Classes: GraphQlController, RootLevel
Constant Summary collapse
- RelaySchema =
GraphQL::Schema.new(query: QueryType, mutation: MutationType)
- QueryType =
…and a query root
GraphQL::ObjectType.define do name "Query" description "The query root of this schema" field :node, field: NodeIdentification.field field :root, RootLevelType do resolve -> (obj, args, ctx) { RootLevel::STATIC } end # End Of Queries end
- NodeIdentification =
GraphQL::Relay::GlobalNodeIdentification.define do # Given a UUID & the query context, # return the corresponding application object object_from_id -> (id, ctx) do type_name, id = NodeIdentification.from_global_id(id) # "Post" -> Post.find(id) Object.const_get(type_name).find(id) end # Given an application object, # return a GraphQL ObjectType to expose that object type_from_object -> (object) do (object.class.name + 'Type').constantize end end
- MutationType =
GraphQL::ObjectType.define do name 'MutationType' end
- RootLevelType =
GraphQL::ObjectType.define do name 'RootLevel' description 'Unassociated root object queries' interfaces [NodeIdentification.interface] global_id_field :id end