oapi-codegen
oapi-codegen copied to clipboard
enum in components/responses generate incomplete code
Edit: it seems #1239 is the same issue. #972 and #1192 are possibly same issue.
Generated code for enum in the components/responses refers undefined type.
Here is the minimal spec to reproduce the problem.
paths:
/books:
get:
responses:
'200':
$ref: '#/components/responses/BookList'
components:
responses:
BookList:
description: list of books
content:
application/json:
schema:
properties:
genre:
type: string
enum:
- fiction
- scifi
Generated code uses BookListGenre type but it doesn't exist.
// BookList defines model for BookList.
type BookList struct {
Genre *BookListGenre `json:"genre,omitempty"`
}
I assume this hasn't been solved?