coder/scripts/apidocgen/markdown-template
Marcin Tojek cfd02d959c
docs: api root, buildinfo, csp (#5493)
* docs: Applications

* WIP

* WIP

* WIP

* Fix: consume

* Fix: @Description

* Fix

* docs: apiroot, buildinfo, csp

* Fix: buildinfo

* docs: updatecheck

* docs: apiroot

* Fix: s/none//g

* Fix: godoc nice

* Fix: description

* Fix: It

* Fix: code sample trim empty line

* More fixes

* Fix: br

* Merge

* Fix: no-security on updatecheck

* Fix: code tags

* Fix: enumerated values in code tags

* Rephrased

* Address PR comments

* Fix: URL, id

* Fix: array items

* Fix: any property

* Fix: array item singular
2022-12-22 15:53:14 +01:00
..
README.md feat: Build framework for generating API docs (#5383) 2022-12-19 18:43:46 +01:00
authentication.def feat: Build framework for generating API docs (#5383) 2022-12-19 18:43:46 +01:00
code_shell.dot docs: applications and authorization (#5477) 2022-12-21 15:37:30 +01:00
debug.def feat: Build framework for generating API docs (#5383) 2022-12-19 18:43:46 +01:00
main.dot docs: api root, buildinfo, csp (#5493) 2022-12-22 15:53:14 +01:00
operation.dot docs: applications and authorization (#5477) 2022-12-21 15:37:30 +01:00
parameters.def docs: api root, buildinfo, csp (#5493) 2022-12-22 15:53:14 +01:00
responses.def docs: api root, buildinfo, csp (#5493) 2022-12-22 15:53:14 +01:00
security.def feat: Build framework for generating API docs (#5383) 2022-12-19 18:43:46 +01:00

README.md

Swagger / OpenAPI 2 and OpenAPI 3 template parameters

Note that properties of OpenAPI objects will be in OpenAPI 3.0 form, as Swagger / OpenAPI 2.0 definitions are converted automatically.

Code templates

  • method - the HTTP method of the operation (in lower-case)
  • methodUpper - the HTTP method of the operation (in upper-case)
  • url - the full URL of the operation (including protocol and host)
  • consumes[] - an array of MIME-types the operation consumes
  • produces[] - an array of MIME-types the operation produces
  • operation - the current operation object
  • operationId - the current operation id
  • opName - the operationId if set, otherwise the method + path
  • tags[] - the full list of tags applying to the operation
  • security - the security definitions applying to the operation
  • resource - the current tag/path object
  • parameters[] - an array of parameters for the operation (see below)
  • queryString - an example queryString, urlEncoded
  • requiredQueryString - an example queryString for required:true parameters
  • queryParameters[] - a subset of parameters that are in:query
  • requiredParameters[] - a subset of queryParameters that are required:true
  • headerParameters[] - a subset of parameters that are in:header
  • allHeaders[] - a concatenation of headerParameters and pseudo-parameters Accept and Content-Type, and optionally Authorization (the latter has an isAuth boolean property set true so it can be omitted in templates if desired

Parameter template

  • parameters[] - an array of parameters, including the following pseudo-properties
    • shortDesc - a truncated version of the parameter description
    • safeType - a computed version of the parameter type, including Body and schema names
    • originalType - the original type of the parameter
    • exampleValues - an object containing examples for use in code-templates
      • json - example values in JSON compatible syntax
      • object - example values in raw object form (unquoted strings etc)
    • depth - a zero-based indicator of the depth of expanded request body parameters
  • enums[] - an array of (parameter)name/value pairs

Responses template

  • responses[] - an array of responses, including status and meaning properties

Authentication template

  • authenticationStr - a simple string of methods (and scopes where appropriate)
  • securityDefinitions[] - an array of applicable securityDefinitions

Schema Property template

  • schemaProperties[] - an array of
    • name
    • type
    • required
    • description
  • enums[] - an array of (schema property)name/value pairs

Common to all templates

  • openapi - the top-level OpenAPI / Swagger document
  • header - the front-matter of the Slate/Shins markdown document
  • host - the (computed) host of the API
  • protocol - the default/first protocol of the API
  • baseUrl - the (computed) baseUrl of the API (including protocol and host)
  • widdershins - the contents of widdershins package.json