Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI SLO specification changes #161922

Merged
merged 11 commits into from
Jul 15, 2023
20 changes: 20 additions & 0 deletions x-pack/plugins/observability/docs/openapi/slo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.DEFAULT_GOAL := help

.PHONY: validate
validate: ## validate tree
@npx swagger-cli validate entrypoint.yaml

.PHONY: bundle
bundle: validate ## generate bundled.yaml and bundled.json
@npx @redocly/cli bundle entrypoint.yaml --output bundled.yaml --ext yaml
@npx @redocly/cli bundle entrypoint.yaml --output bundled.json --ext json
@$(MAKE) lint

.PHONY: lint
lint: ## lint bundled.json
@npx @redocly/cli lint bundled.json

.PHONY: help
help: ## you're looking at it
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m\t%s\n", $$1, $$2 }' $(MAKEFILE_LIST) | column -s$$'\t' -t

wandergeek marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 6 additions & 7 deletions x-pack/plugins/observability/docs/openapi/slo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@ A guide about the OpenApi specification can be found at [https://swagger.io/docs

## Tools

It is possible to validate the docs before bundling them with the following
It is possible to manually validate the docs before bundling them with the following
command in the `x-pack/plugins/observability/docs/openapi/slo` folder:

```bash
npx swagger-cli validate entrypoint.yaml
make validate
```

Then you can generate the `bundled` files by running the following commands:
Then you can generate the `bundled` files by running the following command- this target will automatically validate inputs and lint the result:

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

After generating the json bundle ensure that it is also valid by running the following command:
To lint the generated bundle manually, run:

```bash
npx @redocly/cli lint bundled.json
make lint
```
Loading