diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 649a14846..aa40035a0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -91,6 +91,11 @@ jobs: name: nilness run: go run golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness@latest ./... + - if: runner.os == 'Linux' + name: Check for superfluous trailing whitespace + run: | + ! grep -IErn '\s$' --exclude-dir={.git,target,pgdata} + - if: runner.os == 'Linux' name: Missing specification object link to definition run: | diff --git a/openapi3/testdata/link-example.yaml b/openapi3/testdata/link-example.yaml index 5837d705e..735e7dbb7 100644 --- a/openapi3/testdata/link-example.yaml +++ b/openapi3/testdata/link-example.yaml @@ -1,23 +1,23 @@ openapi: 3.0.0 -info: +info: title: Link Example version: 1.0.0 -paths: - /2.0/users/{username}: - get: +paths: + /2.0/users/{username}: + get: operationId: getUserByName - parameters: + parameters: - name: username in: path required: true schema: type: string - responses: + responses: '200': description: The User content: application/json: - schema: + schema: $ref: '#/components/schemas/user' links: userRepositories: @@ -34,7 +34,7 @@ paths: responses: '200': description: repositories owned by the supplied user - content: + content: application/json: schema: type: array @@ -43,10 +43,10 @@ paths: links: userRepository: $ref: '#/components/links/UserRepository' - /2.0/repositories/{username}/{slug}: - get: + /2.0/repositories/{username}/{slug}: + get: operationId: getRepository - parameters: + parameters: - name: username in: path required: true @@ -57,20 +57,20 @@ paths: required: true schema: type: string - responses: + responses: '200': description: The repository content: - application/json: - schema: + application/json: + schema: $ref: '#/components/schemas/repository' links: repositoryPullRequests: $ref: '#/components/links/RepositoryPullRequests' - /2.0/repositories/{username}/{slug}/pullrequests: - get: + /2.0/repositories/{username}/{slug}/pullrequests: + get: operationId: getPullRequestsByRepository - parameters: + parameters: - name: username in: path required: true @@ -85,23 +85,23 @@ paths: in: query schema: type: string - enum: + enum: - open - merged - declined - responses: + responses: '200': description: an array of pull request objects content: - application/json: - schema: + application/json: + schema: type: array - items: + items: $ref: '#/components/schemas/pullrequest' - /2.0/repositories/{username}/{slug}/pullrequests/{pid}: - get: + /2.0/repositories/{username}/{slug}/pullrequests/{pid}: + get: operationId: getPullRequestsById - parameters: + parameters: - name: username in: path required: true @@ -117,20 +117,20 @@ paths: required: true schema: type: string - responses: + responses: '200': description: a pull request object content: - application/json: - schema: + application/json: + schema: $ref: '#/components/schemas/pullrequest' links: pullRequestMerge: $ref: '#/components/links/PullRequestMerge' - /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: - post: + /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: + post: operationId: mergePullRequest - parameters: + parameters: - name: username in: path required: true @@ -146,7 +146,7 @@ paths: required: true schema: type: string - responses: + responses: '204': description: the PR was successfully merged components: @@ -165,7 +165,7 @@ components: RepositoryPullRequests: # returns '#/components/schemas/pullrequest' operationId: getPullRequestsByRepository - parameters: + parameters: username: $response.body#/owner/username slug: $response.body#/slug PullRequestMerge: @@ -175,29 +175,29 @@ components: username: $response.body#/author/username slug: $response.body#/repository/slug pid: $response.body#/id - schemas: - user: + schemas: + user: type: object - properties: - username: + properties: + username: type: string - uuid: + uuid: type: string - repository: + repository: type: object - properties: - slug: + properties: + slug: type: string - owner: + owner: $ref: '#/components/schemas/user' - pullrequest: + pullrequest: type: object - properties: - id: + properties: + id: type: integer - title: + title: type: string - repository: + repository: $ref: '#/components/schemas/repository' - author: + author: $ref: '#/components/schemas/user' diff --git a/openapi3/testdata/lxkns.yaml b/openapi3/testdata/lxkns.yaml index e8400592c..6e1bee5d6 100644 --- a/openapi3/testdata/lxkns.yaml +++ b/openapi3/testdata/lxkns.yaml @@ -1,6 +1,6 @@ # https://raw.githubusercontent.com/thediveo/lxkns/71e8fb5e40c612ecc89d972d211221137e92d5f0/api/openapi-spec/lxkns.yaml openapi: 3.0.2 -security: +security: - {} info: title: lxkns diff --git a/openapi3filter/testdata/petstore.yaml b/openapi3filter/testdata/petstore.yaml index 4a554488e..026c37e27 100644 --- a/openapi3filter/testdata/petstore.yaml +++ b/openapi3filter/testdata/petstore.yaml @@ -38,7 +38,7 @@ paths: minimum: 1 requestBody: required: true - content: + content: 'application/json': schema: $ref: '#/components/schemas/Pet'