Module: GraphQL::Introspection
- Defined in:
- lib/graphql/introspection.rb,
lib/graphql/introspection/type_type.rb,
lib/graphql/introspection/field_type.rb,
lib/graphql/introspection/base_object.rb,
lib/graphql/introspection/schema_type.rb,
lib/graphql/introspection/entry_points.rb,
lib/graphql/introspection/schema_field.rb,
lib/graphql/introspection/directive_type.rb,
lib/graphql/introspection/dynamic_fields.rb,
lib/graphql/introspection/type_kind_enum.rb,
lib/graphql/introspection/typename_field.rb,
lib/graphql/introspection/enum_value_type.rb,
lib/graphql/introspection/input_value_type.rb,
lib/graphql/introspection/type_by_name_field.rb,
lib/graphql/introspection/directive_location_enum.rb
Defined Under Namespace
Classes: BaseObject, DirectiveLocationEnum, DirectiveType, DynamicFields, EntryPoints, EnumValueType, FieldType, InputValueType, SchemaType, TypeKindEnum, TypeType
Constant Summary collapse
- SchemaField =
GraphQL::Field.define do name("__schema") description("This GraphQL schema") type(GraphQL::Schema::LateBoundType.new("__Schema").to_non_null_type) resolve ->(o, a, ctx) { # Apply wrapping manually since this field isn't wrapped by instrumentation schema = ctx.query.schema schema_type = schema.introspection_system.schema_type schema_type.[:type_class].new(schema, ctx.query.context) } end
- TypenameField =
GraphQL::Field.define do name "__typename" description "The name of this type" type -> { !GraphQL::STRING_TYPE } introspection true resolve ->(obj, a, ctx) { ctx.irep_node.owner_type } end
- TypeByNameField =
GraphQL::Field.define do name("__type") description("A type in the GraphQL system") introspection true type(GraphQL::Schema::LateBoundType.new("__Type")) argument :name, !types.String resolve ->(o, args, ctx) { type = ctx.warden.get_type(args["name"]) if type # Apply wrapping manually since this field isn't wrapped by instrumentation type_type = ctx.schema.introspection_system.type_type type_type.[:type_class].new(type, ctx) else nil end } end
- INTROSPECTION_QUERY =
The introspection query to end all introspection queries, copied from https://github.com/graphql/graphql-js/blob/master/src/utilities/introspectionQuery.js
" query IntrospectionQuery { __schema { queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } directives { name description locations args { ...InputValue } } } } fragment FullType on __Type { kind name description fields(includeDeprecated: true) { name description args { ...InputValue } type { ...TypeRef } isDeprecated deprecationReason } inputFields { ...InputValue } interfaces { ...TypeRef } enumValues(includeDeprecated: true) { name description isDeprecated deprecationReason } possibleTypes { ...TypeRef } } fragment InputValue on __InputValue { name description type { ...TypeRef } defaultValue } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } } "