docs-v2/api-docs
Jason Stirnaman b100bbf256
Fix/api securityschemes (#3488)
* fix: oss and cloud auth. Add bearer scheme for OSS.

* chore: Add an openapi CLI decorator that replaces INFLUXDB_DOCS_URL 'shortcodes' with the correct URL in specs.

* fix: API authentication descriptions and schemes in /api/v2 and V1Compat. Remove QueryString and Basic auth schemes from /api/v2 and add them to V1Compat, along with Token auth. Hook up the replace-docs-url-shortcode which is primarily for V1Compat for now due to the way that contract is managed. Add tag groups to V1Compat.

* fix: add v1compat Info description. Comment out Bearer auth in OSS until it's available in Cloud.

* fix: add replace-shortcodes decorator. Fix v1-compat tag-groups. Fix spec titles.

* fix: restore BasicAuth scheme definition for the users operations that reference them. Still need examples for these.

* fix: remove 1.x BasicAuth references where they don't belong.

* chore: sync from openapi master.

* fix: use replace-shortcodes to replace full Docs URLs in the contracts with absolute local paths to avoid roundtrips. Improve v1compat titles.

* Update api-docs/cloud/swaggerV1Compat.yml

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update api-docs/cloud/swaggerV1Compat.yml

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update api-docs/cloud/swaggerV1Compat.yml

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update api-docs/cloud/swaggerV1Compat.yml

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update api-docs/cloud/swaggerV1Compat.yml

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>
2021-12-21 14:34:49 -06:00
..
cloud Fix/api securityschemes (#3488) 2021-12-21 14:34:49 -06:00
openapi Fix/api securityschemes (#3488) 2021-12-21 14:34:49 -06:00
v2.0 Fix/api securityschemes (#3488) 2021-12-21 14:34:49 -06:00
v2.1 Fix/api securityschemes (#3488) 2021-12-21 14:34:49 -06:00
.redocly.yaml Fix/api securityschemes (#3488) 2021-12-21 14:34:49 -06:00
README.md API Ref docs processing (#3337) 2021-11-03 14:18:02 -05:00
generate-api-docs.sh Fix/api securityschemes (#3488) 2021-12-21 14:34:49 -06:00
getswagger.sh Fix/api securityschemes (#3488) 2021-12-21 14:34:49 -06:00
package.json API Ref docs processing (#3337) 2021-11-03 14:18:02 -05:00
template.hbs Install dependencies as project dependencies from NPM repo (#2476) 2021-05-24 12:11:01 -05:00
yarn.lock API Ref docs processing (#3337) 2021-11-03 14:18:02 -05:00

README.md

Generate InfluxDB API docs

InfluxDB uses Redoc, redoc-cli, and Redocly's OpenApi CLI to generate API documentation from the InfluxDB openapi contracts.

To minimize repo size, the generated API documentation HTML is gitignored, therefore not committed directly to the docs repo. The InfluxDB docs deployment process uses swagger files in the api-docs directory to generate version-specific API documentation.

Versioned swagger files

The structure versions swagger files using the following pattern:

api-docs/
  ├── v2.0/
  │     └── ref.yml
  ├── v2.1/
  │     └── ref.yml
  ├── v2.2/
  │     └── ref.yml
  └── etc...

Configure OpenAPI CLI linting and bundling

.redoc.yaml sets linting and bundling options for openapi CLI. ./openapi/plugins contains custom OpenAPI CLI plugins composed of rules (for linting) and decorators (for bundle customization).

Custom content

./openapi/content contains custom OAS (OpenAPI Spec) content in YAML files. The content structure and Markdown must be valid OAS.

./openapi/plugins use ./openapi/plugins/decorators to apply the content to the contracts. .yml files in ./openapi/content/ set content for sections (nodes) in the contract. To update the content for those nodes, you only need to update the YAML files.

To add new YAML files for other nodes in the openapi contracts, configure the new content YAML file in ./openapi/content/content.js. Then, write a decorator module for the node and configure the decorator in the plugin, e.g. ./openapi/plugins/docs-plugin.js. See the complete list of OAS v3.0 nodes.

openapi CLI requires that modules use CommonJS require syntax for imports.

Generate API docs locally

Because the API documentation HTML is gitignored, you must manually generate it to view the API docs locally.

Verify that you have a working npx (it's included with Node.js). In your terminal, run:

npx --version

If npx returns errors, download and run a recent version of the Node.js installer for your OS.

In your terminal, from the root of the docs repo, run:

cd api-docs

# Generate the API docs
sh generate-api-docs.sh