docs/lib/rest
github-openapi-bot f404f77036
Update OpenAPI Descriptions (#19952)
* Update OpenAPI Descriptions

* Add decorated OpenAPI schema files

Co-authored-by: github-openapi-bot <github-openapi-bot@users.noreply.github.com>
2021-06-16 11:04:46 +00:00
..
static Update OpenAPI Descriptions (#19952) 2021-06-16 11:04:46 +00:00
README.md OpenAPI tooling updates (#16320) 2020-11-24 12:20:10 -08:00
index.js OpenAPI tooling updates (#16320) 2020-11-24 12:20:10 -08:00

README.md

REST

About this directory

  • lib/rest/index.js is human-editable.
  • lib/rest/static/*.json are generated by scripts.

Editable files

  • lib/rest/index.js consumes the static decorated schema files and exports categories, operations, and operationsEnabledForGitHubApps used 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 GitHub
  • lib/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.