docs/lib/graphql
Matt Pollard 891e81b824
[DO NOT MERGE] GitHub Enterprise Server 3.8 release candidate (#34113)
Co-authored-by: Rachael Sewell <rachmari@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Sarah Edwards <skedwards88@github.com>
Co-authored-by: David Jarzebowski <davidjarzebowski@github.com>
Co-authored-by: Steve Guntrip <stevecat@github.com>
Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com>
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
Co-authored-by: Siara <108543037+SiaraMist@users.noreply.github.com>
Co-authored-by: docubot <67483024+docubot@users.noreply.github.com>
2023-02-07 17:49:44 +00:00
..
static [DO NOT MERGE] GitHub Enterprise Server 3.8 release candidate (#34113) 2023-02-07 17:49:44 +00:00
README.md
index.js
non-schema-scalars.json
types.json
validator.js

README.md

GraphQL

About this directory

  • lib/graphql/*.json are human-editable.
  • lib/graphql/static/*.json are generated by scripts.

Editable files

  • lib/graphql/validator.json
    • JSON schema used in tests/graphql.js.
  • lib/graphql/non-schema-scalars.json
    • An array of scalar types that live in graphql-ruby only. These are not part of the core GraphQL spec.
  • lib/graphql/redirects.json
    • A list of original developer.github.com/v4 paths and their corresponding new docs.github.com/graphql paths. Used in redirect middleware and tests.
  • lib/graphql/types.json
    • High-level GraphQL types and kinds.

Static files

Generated by script/graphql/update-files.js:

  • lib/graphql/static/schema-VERSION.json (separate files per version)
  • lib/graphql/static/previews.json
  • lib/graphql/static/upcoming-changes.json
  • lib/graphql/static/changelog.json

Rendering docs

When the server starts, middleware/graphql.js 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.schemaForCurrentVersion
  • context.graphql.previewsForCurrentVersion
  • context.graphql.upcomingChangesForCurrentVersion
  • context.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.