docs/lib/rest
mc 7a9debdca4
[December 15, 2022] - Secret Scanning Experience for Free Public Repos (Public Beta) (#32702)
Co-authored-by: Sophie <29382425+sophietheking@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Aakash Shah <aashah@github.com>
Co-authored-by: amstead <am-stead@github.com>
Co-authored-by: Mariam <15mariams@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
Co-authored-by: Anne-Marie <102995847+am-stead@users.noreply.github.com>
2022-12-15 16:28:55 +00:00
..
static remove openapi dereferenced static files (#33297) 2022-12-13 12:38:30 -08:00
README.md remove openapi dereferenced static files (#33297) 2022-12-13 12:38:30 -08:00
index.js [December 15, 2022] - Secret Scanning Experience for Free Public Repos (Public Beta) (#32702) 2022-12-15 16:28:55 +00: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/decorated - files generated from the dereferenced OpenAPI schema with the Markdown descriptions rendered in HTML
  • lib/rest/static/dereferenced - NOTE These are only generated if you pass the --keep-dereferenced-files option and are not checked into the repository. This option is for debug only.

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.