forked from NYANDEV/forgejo
Add spectral linter for Swagger (#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.
This commit is contained in:
parent
8a7d1a3516
commit
c8e0fd0bcc
7 changed files with 2904 additions and 101 deletions
12
.spectral.yaml
Normal file
12
.spectral.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
extends: [[spectral:oas, all]]
|
||||
|
||||
rules:
|
||||
info-contact: off
|
||||
oas2-api-host: off
|
||||
oas2-parameter-description: off
|
||||
oas2-schema: off
|
||||
oas2-valid-schema-example: off
|
||||
openapi-tags: off
|
||||
operation-description: off
|
||||
operation-singular-tag: off
|
||||
operation-tag-defined: off
|
1
Makefile
1
Makefile
|
@ -312,6 +312,7 @@ lint: lint-frontend lint-backend
|
|||
lint-frontend: node_modules
|
||||
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js
|
||||
npx stylelint --color --max-warnings=0 web_src/less
|
||||
npx spectral lint -q -F hint $(SWAGGER_SPEC)
|
||||
|
||||
.PHONY: lint-backend
|
||||
lint-backend: golangci-lint vet editorconfig-checker
|
||||
|
|
2888
package-lock.json
generated
2888
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -45,6 +45,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@happy-dom/jest-environment": "4.0.1",
|
||||
"@stoplight/spectral-cli": "6.4.1",
|
||||
"eslint": "8.15.0",
|
||||
"eslint-plugin-html": "6.2.0",
|
||||
"eslint-plugin-import": "2.26.0",
|
||||
|
|
|
@ -100,7 +100,7 @@ func GetHook(ctx *context.APIContext) {
|
|||
|
||||
// CreateHook create a hook for an organization
|
||||
func CreateHook(ctx *context.APIContext) {
|
||||
// swagger:operation POST /orgs/{org}/hooks/ organization orgCreateHook
|
||||
// swagger:operation POST /orgs/{org}/hooks organization orgCreateHook
|
||||
// ---
|
||||
// summary: Create a hook
|
||||
// consumes:
|
||||
|
|
|
@ -107,9 +107,6 @@ type swaggerParameterBodies struct {
|
|||
// in:body
|
||||
EditUserOption api.EditUserOption
|
||||
|
||||
// in:body
|
||||
MigrateRepoForm forms.MigrateRepoForm
|
||||
|
||||
// in:body
|
||||
EditAttachmentOptions api.EditAttachmentOptions
|
||||
|
||||
|
|
|
@ -1131,9 +1131,7 @@
|
|||
"$ref": "#/responses/HookList"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org}/hooks/": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
|
@ -16078,12 +16076,6 @@
|
|||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"GitServiceType": {
|
||||
"description": "GitServiceType represents a git service",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"GitTreeResponse": {
|
||||
"description": "GitTreeResponse returns a git tree",
|
||||
"type": "object",
|
||||
|
@ -16473,94 +16465,6 @@
|
|||
"x-go-name": "MergePullRequestForm",
|
||||
"x-go-package": "code.gitea.io/gitea/services/forms"
|
||||
},
|
||||
"MigrateRepoForm": {
|
||||
"description": "MigrateRepoForm form for migrating repository\nthis is used to interact with web ui",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"clone_addr",
|
||||
"uid",
|
||||
"repo_name"
|
||||
],
|
||||
"properties": {
|
||||
"auth_password": {
|
||||
"type": "string",
|
||||
"x-go-name": "AuthPassword"
|
||||
},
|
||||
"auth_token": {
|
||||
"type": "string",
|
||||
"x-go-name": "AuthToken"
|
||||
},
|
||||
"auth_username": {
|
||||
"type": "string",
|
||||
"x-go-name": "AuthUsername"
|
||||
},
|
||||
"clone_addr": {
|
||||
"type": "string",
|
||||
"x-go-name": "CloneAddr"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"x-go-name": "Description"
|
||||
},
|
||||
"issues": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Issues"
|
||||
},
|
||||
"labels": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Labels"
|
||||
},
|
||||
"lfs": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "LFS"
|
||||
},
|
||||
"lfs_endpoint": {
|
||||
"type": "string",
|
||||
"x-go-name": "LFSEndpoint"
|
||||
},
|
||||
"milestones": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Milestones"
|
||||
},
|
||||
"mirror": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Mirror"
|
||||
},
|
||||
"mirror_interval": {
|
||||
"type": "string",
|
||||
"x-go-name": "MirrorInterval"
|
||||
},
|
||||
"private": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Private"
|
||||
},
|
||||
"pull_requests": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "PullRequests"
|
||||
},
|
||||
"releases": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Releases"
|
||||
},
|
||||
"repo_name": {
|
||||
"type": "string",
|
||||
"x-go-name": "RepoName"
|
||||
},
|
||||
"service": {
|
||||
"$ref": "#/definitions/GitServiceType"
|
||||
},
|
||||
"uid": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "UID"
|
||||
},
|
||||
"wiki": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Wiki"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/services/forms"
|
||||
},
|
||||
"MigrateRepoOptions": {
|
||||
"description": "MigrateRepoOptions options for migrating repository's\nthis is used to interact with api v1",
|
||||
"type": "object",
|
||||
|
|
Loading…
Reference in a new issue