❔ Constant string value for discriminator using Swashbuckle
I've spent hours Googling around and testing. I have a simple table-per-hierarchy pattern going on. The discriminator is a string. I want my Swagger endpoint to show the actual string constant instead of
string
as the value for each model/DTO.
My hope beyond this is that when I generate my Typescript types for the client side, they will also not have a generic string for their types.3 Replies
Any ideas? I feel like I've tried everything there is but there has to be a way.
Afaik, this is by design. You can add extra information in the documentation of the endpoint. The signature of the endpoint should display types and not literals
https://swagger.io/docs/specification/adding-examples/
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.