-
Notifications
You must be signed in to change notification settings - Fork 11
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
AdditionalProperties true by default #139
Comments
I personally don't like the idea of having to set I would be fine not following it and explain that in the documentation. I think the current implementation is as follow: Object with no propertiesHere it assumes type: object map[string]interface{} Object with additionalProperties set to true|{}This is just like not setting it type: object
additionalProperties: true|{} map[string]interface{} Object with additionalProperties set to falseThis is a weird case, but it should be supported. type: object
additionalProperties: false struct{} Object with propertiesIt assumes type: object
properties:
field1:
type: string struct {
Field1 string
} Object with properties and additionalProperties set to true|{}type: object
properties:
field1:
type: string
additionalProperties: true|{} struct {
Field1 string
AdditionalProperties map[string]interface{}
} |
I very much agree with you, this is a weird default and would be very annoying to model and use in Go. I would rather document this as an exception. |
I guess we could also consider a flag But it is definitely not something I would use. When I am designing an API I never assume additional properties, I design the fields I want and only rarely allow additional properties when the application needs it. |
Great, I was also thinking on the "--strict" flag, but that could be something for the future. |
Hi @LucasRoesler!
While I was working on the issue #136 I found that starting from OpenAPI 3.0.2 they clarified that additionalProperties is true by default.
The current implementation does not follow this. So wanted to start a discussion on this, should this be fixed?
The text was updated successfully, but these errors were encountered: