https://github.com/github/docs-internal/pull/22217 https://github.com/github/docs-internal/pull/22130 https://github.com/github/docs-internal/pull/22195 https://github.com/github/docs-internal/pull/22327 https://github.com/github/docs-internal/pull/22204 https://github.com/github/docs-internal/pull/21676 https://github.com/github/docs-internal/pull/22341 https://github.com/github/docs-internal/pull/22329 https://github.com/github/docs-internal/pull/21970 https://github.com/github/docs-internal/pull/22334 https://github.com/github/docs-internal/pull/22365 https://github.com/github/docs-internal/pull/21904
REST
About this directory
lib/rest/index.jsis human-editable.lib/rest/static/*.jsonare generated by scripts.
Editable files
lib/rest/index.jsconsumes the static decorated schema files and exportscategories,operations, andoperationsEnabledForGitHubAppsused by the REST middleware contextualizer.
Static files
Generated by script/rest/update-files.js:
lib/rest/static/dereferenced- dereferenced OpenAPI schema file for each version of GitHublib/rest/static/decorated- files generated from the dereferenced OpenAPI schema with the Markdown descriptions rendered in HTML
Rendering docs
When the server starts, middleware/contextualizers/rest.js accesses the data exported from the static decorated JSON files, fetches the data for the current version and requested path, and adds it to the context object. The added property is:
req.context.currentRestOperations- all operations with a category matching the current path
Markdown files in content/rest/reference use Liquid to loop over these context properties. The Liquid calls HTML files in the includes directory to do most of the rendering. Writers can add content to the Markdown files alongside the Liquid.