GraphQL
About this directory
src/graphql/libandsrc/graphql/scriptsare human-editable.src/graphql/data/**are generated by scripts.
Editable files
src/graphql/lib/validator.json- JSON schema used in
tests/graphql.ts.
- JSON schema used in
src/graphql/lib/non-schema-scalars.json- An array of scalar types that live in
graphql-rubyonly. These are not part of the core GraphQL spec.
- An array of scalar types that live in
src/graphql/lib/types.json- High-level GraphQL types and kinds.
Data files
Generated by src/graphql/scripts/sync.ts:
src/graphql/data/schema-VERSION.json(separate files per version)src/graphql/data/previews.jsonsrc/graphql/data/upcoming-changes.jsonsrc/graphql/data/changelog.json
Rendering docs
When the server starts, middleware/graphql.ts accesses the static JSON files, fetches the data for the current version, and adds it to the context object. The added properties are:
context.graphql.schemaForCurrentVersioncontext.graphql.previewsForCurrentVersioncontext.graphql.upcomingChangesForCurrentVersioncontext.graphql.changelog
Markdown files in content/graphql use Liquid to loop over these context properties. The Liquid calls HTML files in the includes directory to do most of the rendering.
Note that Markdown files exist in content/graphql for every URL available in our GraphQL
documentation. Writers can add content to the Markdown files alongside the Liquid.