From ec79b8ebdc4c6b8be8c0dce53a7e7c22e814cef8 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 12 Jun 2025 09:49:10 -0700 Subject: [PATCH 1/2] Add elasticsearch-serverless-openapi-docs.json (#4503) (cherry picked from commit e02c7772c899c3e01bca8a8fa2dbccecc0be818f) --- .gitignore | 4 +++- Makefile | 1 + README.md | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 68826241d8..1861b77072 100644 --- a/.gitignore +++ b/.gitignore @@ -69,4 +69,6 @@ compiler/test/**/output/ output/openapi/elasticsearch-serverless-openapi.tmp*.json output/openapi/elasticsearch-serverless-openapi.examples.json output/openapi/elasticsearch-openapi.tmp*.json -output/openapi/elasticsearch-openapi.examples.json \ No newline at end of file +output/openapi/elasticsearch-openapi.examples.json +output/openapi/elasticsearch-serverless-openapi-docs.json +output/openapi/elasticsearch-openapi-docs.json \ No newline at end of file diff --git a/Makefile b/Makefile index a081ef77dc..886d0925a5 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,7 @@ transform-to-openapi: ## Generate the OpenAPI definition from the compiled schem transform-to-openapi-for-docs: ## Generate the OpenAPI definition tailored for API docs generation @npm run transform-to-openapi -- --schema output/schema/schema.json --flavor stack --lift-enum-descriptions --merge-multipath-endpoints --multipath-redirects --output output/openapi/elasticsearch-openapi-docs.json + @npm run transform-to-openapi -- --schema output/schema/schema.json --flavor serverless --lift-enum-descriptions --merge-multipath-endpoints --multipath-redirects --output output/openapi/elasticsearch-serverless-openapi-docs.json filter-for-serverless: ## Generate the serverless version from the compiled schema @npm run --prefix compiler filter-by-availability -- --serverless --visibility=public --input ../output/schema/schema.json --output ../output/output/openapi/elasticsearch-serverless-openapi.json diff --git a/README.md b/README.md index b440301369..8525767d85 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,13 @@ Follow the steps to generate the JSON representation, then: ``` # Generate the OpenAPI representation $ make transform-to-openapi +``` + +To generate the JSON representation that is used for documentation purposes, the commands are different: + +``` +# Generate the OpenAPI files +$ make transform-to-openapi-for-docs # Apply fixes $ make overlay-docs From 5f7c6c00ff98251c2d4ef2dd61c898743b070dae Mon Sep 17 00:00:00 2001 From: lcawl Date: Thu, 12 Jun 2025 10:04:29 -0700 Subject: [PATCH 2/2] Remove unnecessary serverless commands --- Makefile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Makefile b/Makefile index 886d0925a5..ba01681ee8 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,6 @@ transform-to-openapi: ## Generate the OpenAPI definition from the compiled schem transform-to-openapi-for-docs: ## Generate the OpenAPI definition tailored for API docs generation @npm run transform-to-openapi -- --schema output/schema/schema.json --flavor stack --lift-enum-descriptions --merge-multipath-endpoints --multipath-redirects --output output/openapi/elasticsearch-openapi-docs.json - @npm run transform-to-openapi -- --schema output/schema/schema.json --flavor serverless --lift-enum-descriptions --merge-multipath-endpoints --multipath-redirects --output output/openapi/elasticsearch-serverless-openapi-docs.json filter-for-serverless: ## Generate the serverless version from the compiled schema @npm run --prefix compiler filter-by-availability -- --serverless --visibility=public --input ../output/schema/schema.json --output ../output/output/openapi/elasticsearch-serverless-openapi.json @@ -63,13 +62,9 @@ dump-routes: ## Create a new schema with all generics expanded @npm run dump-routes --prefix compiler overlay-docs: ## Apply overlays to OpenAPI documents - @npx bump overlay "output/openapi/elasticsearch-serverless-openapi.json" "docs/overlays/elasticsearch-serverless-openapi-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi.tmp1.json" - @npx bump overlay "output/openapi/elasticsearch-serverless-openapi.tmp1.json" "docs/overlays/elasticsearch-shared-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi.tmp2.json" - @npx @redocly/cli bundle output/openapi/elasticsearch-serverless-openapi.tmp2.json --ext json -o output/openapi/elasticsearch-serverless-openapi.examples.json @npx bump overlay "output/openapi/elasticsearch-openapi.json" "docs/overlays/elasticsearch-openapi-overlays.yaml" > "output/openapi/elasticsearch-openapi.tmp1.json" @npx bump overlay "output/openapi/elasticsearch-openapi.tmp1.json" "docs/overlays/elasticsearch-shared-overlays.yaml" > "output/openapi/elasticsearch-openapi.tmp2.json" @npx @redocly/cli bundle output/openapi/elasticsearch-openapi.tmp2.json --ext json -o output/openapi/elasticsearch-openapi.examples.json - rm output/openapi/elasticsearch-serverless-openapi.tmp*.json rm output/openapi/elasticsearch-openapi.tmp*.json lint-docs: ## Lint the OpenAPI documents after overlays @@ -78,9 +73,6 @@ lint-docs: ## Lint the OpenAPI documents after overlays lint-docs-stateful: ## Lint only the elasticsearch-openapi.examples.json file @npx @redocly/cli lint "output/openapi/elasticsearch-openapi.examples.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500 -lint-docs-serverless: ## Lint only the serverless OpenAPI document after overlays - @npx @redocly/cli lint "output/openapi/elasticsearch-serverless-openapi.examples.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500 - contrib: | generate license-check spec-format-fix transform-to-openapi filter-for-serverless lint-docs ## Pre contribution target help: ## Display help