Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

schema

schema prints a GraphQL schema decorated with the @mock directive. It does not use an LLM provider.

mockql schema [OPTIONS]

From Introspection

Use --graphql-url to load the schema from a GraphQL endpoint:

mockql schema \
  --graphql-url https://swapi-graphql.netlify.app/graphql

Add headers to the introspection request with --header:

mockql schema \
  --graphql-url https://api.example.com/graphql \
  --header "authorization:Bearer $TOKEN"

From Local SDL

Use --schema to load an SDL file:

mockql schema --schema ./schema.graphql

Minified Output

Use --minify to print Schema SDL in a token-friendly representation:

mockql schema \
  --schema ./schema.graphql \
  --minify

Options

OptionDescription
--minifyMinify Schema SDL into a token-friendly representation.
--schema <SCHEMA>Path to GraphQL schema file.
--graphql-url <GRAPHQL_URL>GraphQL server URL used for schema introspection.
--header <HEADERS>Headers to include in the introspection query. Specify as name:value; repeat the flag for multiple headers.
--timeout <TIMEOUT>Timeout for introspection query, e.g. 30s or 2m. Default: 1m.