C#C
C#2y ago
ægteemil

✅ Describing `object` response in swagger

Hey. I have an endpoint that returns an object that looks something like this.
public record Webhook(
    string Id,
    PayloadType Type,
    object Payload
);

where Payload can change depending on the enum value. In typescript or other languages, I'd represent this object as a union type, but since we don't have that in C#, I'd just like to describe the possibilities of this in my swagger documentation
Was this page helpful?