We have an endpoint that returns a list of events. Each event can have a different type, but all events inherit the generic Event type. In order to correctly deserialize the events in our consumers we use serialize with these settings:
new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }
This includes the member "$type": "Solution.Project.Events.SpecificEvent, Solution.Project"
in our actual payloads, so consumers can distinguish between the different events.
We're trying to implement a custom response example in our azure function, using the OpenApiResponseWithBody
decorator and a call that inherits OpenApiExample<List<T>>
as described here https://github.com/Azure/azure-functions-openapi-extension/blob/main/docs/openapi-core.md#openapirequestbodyattribute, but in the Swagger UI the events are serialized without the TypeNameHandling settings.
Is there a way to add these settings?