kibana/packages/kbn-spec-to-console
Brandon Kobel 4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00
..
bin Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
lib Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
test/fixtures
index.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
jest.config.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
package.json Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
README.md The directory in the command was missing the /generated directory and would cause all definitions to be regenerated in the wrong place. (#72766) 2020-07-26 10:04:09 -04:00

A mini utility to convert Elasticsearch's REST spec to Console's (Kibana) autocomplete format.

It is used to semi-manually update Console's autocompletion rules.

Retrieving the spec

If you don't have a copy of the Elasticsearch repo on your machine, follow these steps to clone only the rest API specs

mkdir es-spec && cd es-spec
git init
git remote add origin https://github.com/elastic/elasticsearch
git config core.sparsecheckout true
echo "rest-api-spec/src/main/resources/rest-api-spec/api/*\nx-pack/plugin/src/test/resources/rest-api-spec/api/*" > .git/info/sparse-checkout
git pull --depth=1 origin master

Usage

You need to run the command twice: once for the OSS specs and once for the X-Pack specs
At the root of the Kibana repository, run the following commands:

# OSS
yarn spec_to_console -g "<ELASTICSEARCH-REPO-FOLDER>/rest-api-spec/src/main/resources/rest-api-spec/api/*" -d "src/plugins/console/server/lib/spec_definitions/json/generated"

# X-pack
yarn spec_to_console -g "<ELASTICSEARCH-REPO-FOLDER>/x-pack/plugin/src/test/resources/rest-api-spec/api/*" -d "x-pack/plugins/console_extensions/server/lib/spec_definitions/json/generated"

Information used in Console that is not available in the REST spec

  • Request bodies
  • Data fetched at runtime: indices, fields, snapshots, etc
  • Ad hoc additions