Skip to content

Commit

Permalink
Add lint target and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
wandergeek committed Jul 14, 2023
1 parent 24ea758 commit 861df99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
14 changes: 9 additions & 5 deletions x-pack/plugins/observability/docs/openapi/slo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

.PHONY: validate
validate: ## validate tree
@ npx swagger-cli validate entrypoint.yaml
@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
@ npx @redocly/cli lint 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
@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

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
```

0 comments on commit 861df99

Please sign in to comment.