openapi-parser
openapi-parser copied to clipboard
fix: don't parse non-exported fields in structs
This fixes a bug where having private fields would add them to the struct as "composed" fields.
This fixes the issue by not adding private fields.
Example
// @openapi:schema
type animal struct {
species string
}
// Dog struct
// @openapi:schema
type Dog struct {
Pet
animal
otherpackage.Data
Name string `json:"name"`
weight int
friends []animal
}
:arrow_down:
Dog:
allOf:
- $ref: '#/components/schemas/Pet'
- $ref: '#/components/schemas/animal'
- $ref: '#/components/schemas/WeirdCustomName'
- type: object
properties:
name:
type: string
animal:
type: object
Hello, I'm not sure to understand, the example you give is before or after? Can you give the before/after to compare? By the way you need to rebase your branch, I just merged your other PR :) Thanks!