kibana/packages/kbn-spec-to-console
Jean-Louis Leysens 535b933b66
[Console] Clean up after initial 7.7.0 spec definitions update (#61227)
* Move JSON files in console_extensions to mirror console struct.

Also update the spec-to-console package README.md with the new
instructions.

* Re-add flat settings completion in indices.put_template

* Re-add template completion suggestions for indices.get_template

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-26 10:13:09 +01:00
..
bin [Console] Update spec definitions for 7.7.0 (#61080) 2020-03-24 16:14:06 -07:00
lib [Console] Update spec definitions for 7.7.0 (#61080) 2020-03-24 16:14:06 -07:00
test/fixtures
index.js autofix all violations 2019-12-13 23:17:13 -07:00
package.json Upgrade Prettier 1.19 (#50487) 2019-11-13 17:00:02 +01:00
README.md [Console] Clean up after initial 7.7.0 spec definitions update (#61227) 2020-03-26 10:13:09 +01:00
yarn.lock Add lockfile symlinks (#55440) 2020-01-27 11:38:20 -05: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"

# 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"

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