Ask a Question

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

cproctor
New Member

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:

cproctor_2-1636994731554.png

 

This is my example class:

cproctor_0-1636994581152.png

 

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!

0 REPLIES 0
cancel
Showing results for 
Search instead for 
Did you mean: