Right now in my OpenAPI yaml, we have a component with a field that is marked as follows:
type: object
additionalProperties: true
This results in a generated object like this: map[string]jx.Raw, where jx.Raw is a []byte under the hood.
That is pretty hard to use.
I'd have to manually json marshal every single property, rather than just setting them all and letting the whole thing be json marshalled.
I've tried 3 other OpenAPI code generators, and they all give me a map[string]any, letting us use this field for any key-value pairs (this is our desired goal).
This change should be backwards compatible, as jx.Raw counts as an any.
The ogen server/client should take care of marshalling the any value into json. I also don't think that ogen should be exposing jx, as that is an implementation detail.
Description
Right now in my OpenAPI yaml, we have a component with a field that is marked as follows:
This results in a generated object like this:
map[string]jx.Raw
, wherejx.Raw
is a[]byte
under the hood. That is pretty hard to use. I'd have to manually json marshal every single property, rather than just setting them all and letting the whole thing be json marshalled.I've tried 3 other OpenAPI code generators, and they all give me a
map[string]any
, letting us use this field for any key-value pairs (this is our desired goal).This change should be backwards compatible, as jx.Raw counts as an
any
.The ogen server/client should take care of marshalling the
any
value into json. I also don't think that ogen should be exposing jx, as that is an implementation detail.