You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenAPI Guide states that additionalProperties: true is the default when a schema consists of just type: object, but the generated code ends up with a struct{} type unless additionalProperties: true is specified.
What version of ogen are you using?
v1.0.1-0.20240411144324-e1628ac9f35f
Can this issue be reproduced with the latest version?
Current validator/decoder behavior matches expected by JSON Schema.
ogen generates AdditionalProps only if additionalProperties is defined explicitly.
Majority of schemas does not define additionalProperties and probably majority of users do not need them, so current behavior seems more reasonable for me.
#1246 fixes this issue in slighty different way: AdditionalProps would be added implicitly only if properties and patternProperties are not defined, but I still not convinced that any change is required.
Let's generate AdditionalProps for type: object schema, the struct{} is pretty useless.
If #1246 achieves this, it is LGTM.
Also let's keep our default unchanged (do not generate AdditionalProps by default in other cases). If this will be a problem for someone, we can introduce a configuration option.
OpenAPI Guide states that
additionalProperties: true
is the default when a schema consists of justtype: object
, but the generated code ends up with astruct{}
type unlessadditionalProperties: true
is specified.What version of ogen are you using?
v1.0.1-0.20240411144324-e1628ac9f35f
Can this issue be reproduced with the latest version?
Yes
What did you do?
Changed schema from:
to:
What did you expect to see?
Generated code should be the same.
What did you see instead?
Without
additionalProperties
:With
additionalProperties
:The text was updated successfully, but these errors were encountered: