Forum Discussion

cproctor's avatar
New Member
3 years ago

Is it possible to use variables to build a SwaggerResponse type?

Good morning. I am fairly new to Swagger and I'm hoping someone can answer my question. In my C# controller I have a PUT function that will return a status payload JSON if the status is 400, 404 or 500. I'm using the IExamplesProvider to build my example responseDto from a JSON file. It works fine, but I would really like each payload to show the actual status and status description, which would somehow require that I pass parameters. Is this possible, or would I need to create a responseDto and examples class for each status?


Here's what I currently have coded. In my controller:


This is my example class:


Hopefully, these images are easy enough to read, once posted. 🙂 Any suggestions would be greatly appreciated. Let me know if you need further clarification. Thanks in advance!

No RepliesBe the first to reply