Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #306 from neotoolkit/fix/bad-response
Browse files Browse the repository at this point in the history
fix(api): skip status less 200 or greatest or equal 300
  • Loading branch information
sashamelentyev authored Feb 7, 2022
2 parents abcd262 + 0bfc174 commit e48af22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/api/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ func (b *Builder) Set(path, method string, o *openapi.Operation) (Operation, err
return Operation{}, err
}

if statusCode < http.StatusOK || statusCode >= http.StatusMultipleChoices {
continue
}

content, ok := resp.Content["application/json"]
if !ok {
operation.Responses = append(operation.Responses, Response{
Expand Down
2 changes: 2 additions & 0 deletions test/testdata/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ paths:
id: e1afccea-5168-4735-84d4-cb96f6fb5d25
firstName: Elon
lastName: Musk
'500':
description: ''
get:
responses:
'200':
Expand Down

0 comments on commit e48af22

Please sign in to comment.