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
Cause
For a type with fields and additionalProperties, a custom MarshalJSON() function is generated to handle additionalProperties marshalling. However, for a strict server interface a response type is generated that aliases/subtypes the referenced response type (e.g. type CreateUserResponse becomes CreateUserJSON200Response CreateUserResponse).
But, this strict server interface-specific type does not implement json.Marshaler (to delegate it to the aliased/subtype), thus the custom MarshalJSON() function is never called.
Workaround
There's an ugly workaround, you can create a MarshalJSON() function for the strict server interface type and delegate it to the underlying type, e.g.:
When generating a Strict Server interface with a type that has fields, as well as
additionalProperties
, theadditionalProperties
don't get marshalled.Failing test
#1579
Cause
For a type with fields and
additionalProperties
, a customMarshalJSON()
function is generated to handleadditionalProperties
marshalling. However, for a strict server interface a response type is generated that aliases/subtypes the referenced response type (e.g. typeCreateUserResponse
becomesCreateUserJSON200Response CreateUserResponse
).But, this strict server interface-specific type does not implement
json.Marshaler
(to delegate it to the aliased/subtype), thus the customMarshalJSON()
function is never called.Versions
Example
Workaround
There's an ugly workaround, you can create a
MarshalJSON()
function for the strict server interface type and delegate it to the underlying type, e.g.:The text was updated successfully, but these errors were encountered: