Blog: Open API

NSwag Tutorial: Implement a custom operation processor to define ReDoc code samples

November 1, 2017, (updated on November 2, 2017), Software Development

With NSwag you can implement custom operation processors and apply them to ASP.NET Core MVC or Web API controller operations. These processors then get picked up by NSwag and are applied to the given operation in the Swagger specification. This article shows how to implement a custom operation processor using the example of adding code samples to the ReDoc UI. The ReDoc UI processes the x-code-samples property on operations. Here is a sample Swagger specification: { ... "paths": { "/person": { "post": { "summary": "Adds a new person.", "operationId": "addPerson", "x-code-samples": { "lang": "CSharp", "source": "console.log('Hello World');" } ... } […] Read more...

Tags: , , , ,


  Page 1 of 1