Skip to content

Commit

Permalink
[OAS][DOCS] Add temporary overlays for Kibana API documents (elastic#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Aug 1, 2024
1 parent 7dca2aa commit 176a221
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -1740,8 +1740,9 @@ packages/react @elastic/appex-sharedux
/plugins/data_views/docs/openapi @elastic/platform-docs
oas_docs/.spectral.yaml @elastic/platform-docs
oas_docs/kibana.info.serverless.yaml @elastic/platform-docs
oas_docs/kibana.serverless.yaml @elastic/platform-docs
oas_docs/kibana.info.yaml @elastic/platform-docs
oas_docs/makefile @elastic/platform-docs
oas_docs/overlays @elastic/platform-docs

# Plugin manifests
/src/plugins/**/kibana.jsonc @elastic/kibana-core
Expand Down
7 changes: 3 additions & 4 deletions oas_docs/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
.PHONY: api-docs
api-docs: ## Generate kibana.serverless.yaml and kibana.yaml
@npx @redocly/cli join "kibana.info.serverless.yaml" "../x-pack/plugins/observability_solution/apm/docs/openapi/apm.yaml" "../x-pack/plugins/actions/docs/openapi/bundled_serverless.yaml" "../src/plugins/data_views/docs/openapi/bundled.yaml" "../x-pack/plugins/ml/common/openapi/ml_apis_serverless.yaml" "../packages/core/saved-objects/docs/openapi/bundled_serverless.yaml" "../x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml" -o "output/kibana.serverless.yaml" "bundle.serverless.json" --prefix-components-with-info-prop title
@npx @redocly/cli join "kibana.info.yaml" "../x-pack/plugins/alerting/docs/openapi/bundled.yaml" "../x-pack/plugins/observability_solution/apm/docs/openapi/apm.yaml" "../x-pack/plugins/cases/docs/openapi/bundled.yaml" "../x-pack/plugins/actions/docs/openapi/bundled.yaml" "../src/plugins/data_views/docs/openapi/bundled.yaml" "../x-pack/plugins/ml/common/openapi/ml_apis.yaml" "../packages/core/saved-objects/docs/openapi/bundled.yaml" "../x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml" "bundle.json" -o "output/kibana.yaml" --prefix-components-with-info-prop title
@npx @redocly/cli join "kibana.info.yaml" "../x-pack/plugins/alerting/docs/openapi/bundled.yaml" "../x-pack/plugins/observability_solution/apm/docs/openapi/apm.yaml" "../x-pack/plugins/cases/docs/openapi/bundled.yaml" "../x-pack/plugins/actions/docs/openapi/bundled.yaml" "../src/plugins/data_views/docs/openapi/bundled.yaml" "../x-pack/plugins/ml/common/openapi/ml_apis.yaml" "../packages/core/saved-objects/docs/openapi/bundled.yaml" "bundle.json" -o "output/kibana.yaml" --prefix-components-with-info-prop title

.PHONY: api-docs-stateful
api-docs-stateful: ## Generate only kibana.yaml
@npx @redocly/cli join "kibana.info.yaml" "../x-pack/plugins/alerting/docs/openapi/bundled.yaml" "../x-pack/plugins/observability_solution/apm/docs/openapi/apm.yaml" "../x-pack/plugins/cases/docs/openapi/bundled.yaml" "../x-pack/plugins/actions/docs/openapi/bundled.yaml" "../src/plugins/data_views/docs/openapi/bundled.yaml" "../x-pack/plugins/ml/common/openapi/ml_apis.yaml" "../packages/core/saved-objects/docs/openapi/bundled.yaml" "../x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml" "bundle.json" -o "output/kibana.yaml" --prefix-components-with-info-prop title
@npx @redocly/cli join "kibana.info.yaml" "../x-pack/plugins/alerting/docs/openapi/bundled.yaml" "../x-pack/plugins/observability_solution/apm/docs/openapi/apm.yaml" "../x-pack/plugins/cases/docs/openapi/bundled.yaml" "../x-pack/plugins/actions/docs/openapi/bundled.yaml" "../src/plugins/data_views/docs/openapi/bundled.yaml" "../x-pack/plugins/ml/common/openapi/ml_apis.yaml" "../packages/core/saved-objects/docs/openapi/bundled.yaml" "bundle.json" -o "output/kibana.yaml" --prefix-components-with-info-prop title
# Temporarily omit "../x-pack/plugins/fleet/common/openapi/bundled.yaml" due to internals tag and tag sorting

.PHONY: api-docs-serverless
Expand All @@ -29,8 +29,7 @@ api-docs-serverless: ## Generate only kibana.serverless.yaml

.PHONY: api-docs-lint
api-docs-lint: ## Run spectral API docs linter
@npx @stoplight/spectral-cli lint "output/kibana.serverless.yaml" --ruleset ".spectral.yaml"
@npx @stoplight/spectral-cli lint "output/kibana.yaml" --ruleset ".spectral.yaml"
@npx @stoplight/spectral-cli lint "output/*.yaml" --ruleset ".spectral.yaml"

.PHONY: api-docs-lint-stateful
api-docs-lint-stateful: ## Run spectral API docs linter on kibana.yaml
Expand Down
12 changes: 11 additions & 1 deletion oas_docs/overlays/kibana.overlays.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ info:
title: Overlays for the Kibana API document
version: 0.0.1
actions:
# Clean up server definitions
- target: '$.servers.*'
description: Remove all servers so we can add our own.
remove: true
Expand All @@ -14,6 +15,11 @@ actions:
variables:
kibana_url:
default: localhost:5601
# Remove operation-level security definitions
- target: "$.paths['/api/status']['get'].security"
description: Remove system security definitions
remove: true
# Add a document-level security definition
- target: '$.components.securitySchemes'
description: Add an API key security scheme
update:
Expand All @@ -27,4 +33,8 @@ actions:
update:
security:
- apiKeyAuth: []

# Mark all operations as beta
- target: '$.paths[*][*]'
description: Add x-beta
update:
x-beta: true
7 changes: 7 additions & 0 deletions oas_docs/overlays/kibana.overlays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ info:
title: Overlays for the Kibana API document
version: 0.0.1
actions:
# Clean up server definitions
- target: '$.servers.*'
description: Remove all servers so we can add our own.
remove: true
Expand All @@ -14,6 +15,11 @@ actions:
variables:
kibana_url:
default: localhost:5601
# Remove operation-level security definitions
- target: "$.paths['/api/status']['get'].security"
description: Remove system security definitions
remove: true
# Add document-level security definitions
- target: '$.components.securitySchemes'
description: Add an API key security scheme
update:
Expand All @@ -34,6 +40,7 @@ actions:
security:
- apiKeyAuth: []
- basicAuth: []
# Add an introduction to spaces
- target: '$'
description: Add an extra page about spaces
update:
Expand Down

0 comments on commit 176a221

Please sign in to comment.