Skip to content

Comments

fix: don't parse non-exported fields in structs#43

Open
Sadzeih wants to merge 1 commit intoalexjomin:masterfrom
Sadzeih:fix-private-fields
Open

fix: don't parse non-exported fields in structs#43
Sadzeih wants to merge 1 commit intoalexjomin:masterfrom
Sadzeih:fix-private-fields

Conversation

@Sadzeih
Copy link

@Sadzeih Sadzeih commented Oct 23, 2020

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
}

⬇️

    Dog:
      allOf:
      - $ref: '#/components/schemas/Pet'
      - $ref: '#/components/schemas/animal'
      - $ref: '#/components/schemas/WeirdCustomName'
      - type: object
        properties:
          name:
            type: string
    animal:
      type: object

@denouche
Copy link
Collaborator

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants