kibana/x-pack/plugins/fleet/common/openapi
Kibana Machine 226be06574
[8.0] [Fleet] Avoid breaking setup when compatible package is not available in registry (#125525) (#125672)
* [Fleet] Avoid breaking setup when compatible package is not available in registry (#125525)

(cherry picked from commit 928638e395)

* [Fleet] Use registry version check on main (#125495)

* [Fleet] Get package info should not store the whole package (#123509)

Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
2022-02-16 05:41:23 -07:00
..
components [Fleet] Add missing endpoint to openApi docs (#121091) (#121434) 2021-12-16 11:13:57 -07:00
paths [8.0] [Fleet] Avoid breaking setup when compatible package is not available in registry (#125525) (#125672) 2022-02-16 05:41:23 -07:00
bundled.json [8.0] [Fleet] Avoid breaking setup when compatible package is not available in registry (#125525) (#125672) 2022-02-16 05:41:23 -07:00
bundled.yaml [8.0] [Fleet] Avoid breaking setup when compatible package is not available in registry (#125525) (#125672) 2022-02-16 05:41:23 -07:00
entrypoint.yaml [Fleet] Add missing endpoint to openApi docs (#121091) (#121434) 2021-12-16 11:13:57 -07:00
README.md [Fleet] Update the openApi readme section (#121331) (#121419) 2021-12-16 10:58:00 -05:00
validate_docs.test.ts [Fleet] Add validation test for openApi files (#121544) (#121769) 2021-12-21 08:59:34 -07:00

OpenAPI (Experimental)

The current self-contained spec file is as JSON or as YAML and can be used for online tools like those found at https://openapi.tools/. This spec is experimental and may be incomplete or change later.

For example, online viewers for the specification like these:

View spec using MrinDoc View spec using Swagger UI
Screen Shot 2021-03-09 at 10 14 52 AM Screen Shot 2021-03-09 at 10 14 04 AM

A guide about the openApi specification can be found at https://swagger.io/docs/specification/about/.

The openapi folder

  • entrypoint.yaml is the overview file which links to the various files on disk.
  • bundled.{yaml,json} is the resolved output of that entry & other files in a single file. Typically the best choice as input to tools.
  • Paths: this defines each endpoint. A path can have one operation per http method.
  • Components: Reusable components like schemas, responses parameters

Tools

It is possible to validate the docs before bundling them with the following command:

  npx swagger-cli validate x-pack/plugins/fleet/common/openapi/entrypoint.yaml

Then generate the bundled files with the following:

```
npx @redocly/openapi-cli bundle --ext yaml --output bundled.yaml entrypoint.yaml
npx @redocly/openapi-cli bundle --ext json --output bundled.json entrypoint.yaml
```