graphql/utilities/schema-coordinates
Functions
resolveSchemaCoordinate()
A schema coordinate is resolved in the context of a GraphQL schema to uniquely identify a schema element. It returns undefined if the schema coordinate does not resolve to a schema element, meta-field, or introspection schema element. It will throw if the containing schema element (if applicable) does not exist.
https://spec.graphql.org/draft/#sec-Schema-Coordinates.Semantics
Signature:
resolveSchemaCoordinate(schema: GraphQLSchema, schemaCoordinate: string | Source): ResolvedSchemaElement | undefined
Arguments
| Name | Type | Description |
|---|---|---|
| schema | GraphQLSchema | The GraphQL schema to use. |
| schemaCoordinate | string | Source | The schema coordinate to resolve. |
Returns
| Type | Description |
|---|---|
ResolvedSchemaElement | undefined | The schema element identified by the coordinate, or undefined if none exists. |
Example
import { resolveSchemaCoordinate } from 'graphql/utilities';
const result = resolveSchemaCoordinate(schema, schemaCoordinate);
// result contains the resolveSchemaCoordinate return valueresolveASTSchemaCoordinate()
Resolves schema coordinate from a parsed SchemaCoordinate node.
Signature:
resolveASTSchemaCoordinate(schema: GraphQLSchema, schemaCoordinate: SchemaCoordinateNode): ResolvedSchemaElement | undefined
Arguments
| Name | Type | Description |
|---|---|---|
| schema | GraphQLSchema | The GraphQL schema to use. |
| schemaCoordinate | SchemaCoordinateNode | The schema coordinate to resolve. |
Returns
| Type | Description |
|---|---|
ResolvedSchemaElement | undefined | The schema element identified by the parsed coordinate, or undefined if none exists. |
Example
import { resolveASTSchemaCoordinate } from 'graphql/utilities';
const result = resolveASTSchemaCoordinate(schema, schemaCoordinate);
// result contains the resolveASTSchemaCoordinate return valueTypes
ResolvedSchemaElement
Type alias. A schema element resolved from a schema coordinate.
type ResolvedSchemaElement = { kind: ‘NamedType’; type: GraphQLNamedType } | { kind: ‘Field’; type: GraphQLObjectType | GraphQLInterfaceType; field: GraphQLField<unknown, unknown> } | { kind: ‘InputField’; type: GraphQLInputObjectType; inputField: GraphQLInputField } | { kind: ‘EnumValue’; type: GraphQLEnumType; enumValue: GraphQLEnumValue } | { kind: ‘FieldArgument’; type: GraphQLObjectType | GraphQLInterfaceType; field: GraphQLField<unknown, unknown>; fieldArgument: GraphQLArgument } | { kind: ‘Directive’; directive: GraphQLDirective } | { kind: ‘DirectiveArgument’; directive: GraphQLDirective; directiveArgument: GraphQLArgument };