Skip to content

Commit c8e0fd0

Browse files
authored
Add spectral linter for Swagger (go-gitea#20321)
[spectral](https://github.com/stoplightio/spectral) lints openapi/swagger files for mistakes of which it has identified a few and which I've fixed. I had to put it into `lint-frontend` because it depends on node_modules so can not run on Drone during the backend target. I plan to refactor these targets later to `lint-js` and `lint-go` so that they are categorized based on the tool dependencies.
1 parent 8a7d1a3 commit c8e0fd0

File tree

7 files changed

+10347
-7544
lines changed

7 files changed

+10347
-7544
lines changed

.spectral.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extends: [[spectral:oas, all]]
2+
3+
rules:
4+
info-contact: off
5+
oas2-api-host: off
6+
oas2-parameter-description: off
7+
oas2-schema: off
8+
oas2-valid-schema-example: off
9+
openapi-tags: off
10+
operation-description: off
11+
operation-singular-tag: off
12+
operation-tag-defined: off

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ lint: lint-frontend lint-backend
312312
lint-frontend: node_modules
313313
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js
314314
npx stylelint --color --max-warnings=0 web_src/less
315+
npx spectral lint -q -F hint $(SWAGGER_SPEC)
315316

316317
.PHONY: lint-backend
317318
lint-backend: golangci-lint vet editorconfig-checker

0 commit comments

Comments
 (0)