dommer
dommer

Reputation: 19820

How can I generate a custom response example value in NSwag (ASP.NET Core)?

I'm trying to generate a custom response example value using NSwag. When using Swashbuckle there are attributes for it, but I'm not sure how to do it in NSwag.

I found this thread, but I'm not familiar enough with Swagger to translate the code.

Does anyone have any complete examples of how to achieve this functionality?

Upvotes: 3

Views: 4536

Answers (1)

Rico Suter
Rico Suter

Reputation: 11858

If you know the expected JSON field and structure of the sample, you can implement this yourself by modifying the code in this blog: https://blog.rsuter.com/nswag-tutorial-implement-a-custom-operation-processor-to-define-redoc-code-samples/

Upvotes: 1

Related Questions