Skip to content

Commit

Permalink
OpenAPI formatting linter (#3140)
Browse files Browse the repository at this point in the history
## Description

Adds the `spectral` linter. `prettier` should be used as formatter.

The formatter is applied in
#3144.

~~`@redocly/openapi-cli` is chosen because it provides both a linter and
a built-in formatter while other linters suggest using `prettier`, which
provides less robust option compared to the `openapi-cli`.~~ Since the
tool is depricated, switched to `spectral` + `prettier`.

## Related Issues

Fixes #2971
  • Loading branch information
squadgazzz authored Dec 2, 2024
1 parent f53b2d2 commit 2fec574
Show file tree
Hide file tree
Showing 5 changed files with 793 additions and 600 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,13 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- run: npm install @apidevtools/swagger-cli
- run: npm install @apidevtools/swagger-cli @stoplight/spectral-cli
- run: node_modules/.bin/swagger-cli validate crates/orderbook/openapi.yml
- run: node_modules/.bin/swagger-cli validate crates/driver/openapi.yml
- run: node_modules/.bin/swagger-cli validate crates/solvers/openapi.yml
- run: node_modules/.bin/spectral lint crates/orderbook/openapi.yml
- run: node_modules/.bin/spectral lint crates/driver/openapi.yml
- run: node_modules/.bin/spectral lint crates/solvers/openapi.yml

run-flaky-test:
# to debug a flaky test set `if` to true and configure the flaky test in the `run` step
Expand Down
1 change: 1 addition & 0 deletions .spectral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: "spectral:oas"
Loading

0 comments on commit 2fec574

Please sign in to comment.