-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Taking from the example in this repository, we can see that this spec's response status code is incorrectly 200. Perhaps these constructors could accept a status code?
petstore-expanded.yaml
post:
summary: Creates a new pet
description: Creates a new pet in the store. Duplicates are allowed
operationId: addPet
requestBody:
description: Pet to add to the store
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewPet'
responses:
'201':
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'petstore.gen.go
// AddPetJSONDefaultResponse is a constructor method for a AddPet response.
// A *Response is returned with the configured status code and content type from the spec.
func AddPetJSONDefaultResponse(body Error) *Response {
return &Response{
body: body,
Code: 200,
contentType: "application/json",
}
}karitham
Metadata
Metadata
Assignees
Labels
No labels