I have request that returning in response type Event defined like:
event:
oneOf:
- $ref: '#/components/schemas/eventTypeOnetimeEditableField'
- $ref: '#/components/schemas/eventTypeRepeatableEditableField'
Generated types are:
type Event struct {
union json.RawMessage
}
func (t Event) MarshalJSON() ([]byte, error) {
b, err := t.union.MarshalJSON()
return b, err
}
type PostDescribeEventById200JSONResponse Event
The problem is PostDescribeEventById200JSONResponse on json marshalling returning empty json "{}". This happens because PostDescribeEventById200JSONResponse is not using MarshalJSON() of underlying struct Event.
Using type alias instead of underlying type solving my problem:
type PostDescribeEventById200JSONResponse = Event
I have request that returning in response type Event defined like:
Generated types are:
The problem is PostDescribeEventById200JSONResponse on json marshalling returning empty json "{}". This happens because PostDescribeEventById200JSONResponse is not using MarshalJSON() of underlying struct Event.
Using type alias instead of underlying type solving my problem: