Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openapi3gen: inline golang struct creates incorrect schema #924

Open
EnriqueL8 opened this issue Mar 15, 2024 · 0 comments
Open

openapi3gen: inline golang struct creates incorrect schema #924

EnriqueL8 opened this issue Mar 15, 2024 · 0 comments

Comments

@EnriqueL8
Copy link
Contributor

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?

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

No branches or pull requests

1 participant