API development guides

Find an Undefined Type in GraphQL Schema SDL

·

Use the workshop schema to distinguish a schema definition error from a message copied out of a separate CI run.

GraphQL Validator

Check the schema and break one type reference

Select Load example, then Validate GraphQL schema. The result shows four definitions and Query as the query root. The workshop field returns Workshop.

Change the return type of workshop(id: ID!) from Workshop to Workshp. Validate again. The error points to the misspelled reference and may suggest Workshop. Restore the original type before continuing.

GraphQL schema root operation typesGraphQL validation and schema definitions

Check a duplicate field at its source

Duplicate the title: String! line inside type Workshop. The next validation reports the repeated field. Delete the extra line and validate the corrected schema.

Use the line and column to locate the error. Download graphql-schema-validation.json to record the findings with their source positions.

GraphQL validation and schema definitions

Review hints from a finished CI run

Open Optional saved diagnostics and paste the two example lines. Validate again. The suggestion and retry-limit cue are labelled Saved diagnostics and refer to lines in that text.

The schema verdict still describes the SDL. The separate findings help you identify messages to investigate from the earlier run.

Saved diagnostic lines
Unknown type Workshp. Did you mean Workshop?
Retry limit reached after 3 attempts.

GraphQL validation and schema definitions

Common questions

Why is a query root required?

A complete GraphQL schema must define an object type as its query root. The schema definition can identify that type explicitly.

Can I paste a GraphQL query into the SDL editor?

Use schema definitions and extensions here. The GraphQL Query Builder validates its generated operation against a sample or supplied schema.

Sources

Put it into practice.

Related guides