kin-openapi
kin-openapi copied to clipboard
openapi3gen: inline golang struct creates incorrect schema
In the case where you have defined two structs as follows:
type NestedStruct struct {
Field1 string `json:"field1,omitempty"`
}
type TopLevelStruct struct {
*NestedStruct `json:",omitempty"`
Field2 string `json:"field2,omitempty"`
}
The current behaviour is to create a separate nested object schema for NestedStruct
so you end up with:
schema:
properties:
NestedStruct:
type: object:
properties:
Field1:
type: string
Field2:
type: string
but what you actually want is:
schema:
properties:
Field1:
type: string
Field2:
type: string
@fenollp thoughts on this? Am I missing something?