Search code examples
swagger-2.0nswag

Can NSwag invoke a custom Swagger generator?


Is there a way to specify a custom ISwaggerGenerator or invoke some method or program to produce the output swagger spec in the swaggerGenerator section of nswag.json?

The standard fromSwagger generator seems to work with only an output path, so as a last resort, I may use an exec task to create the file named there. But it would seem less hacky to specify my generator directly in nswag.json.

"swaggerGenerator": {
    "fromSwagger": {
        "output": "swagger.json"
    }
}

Solution

  • At the moment, the input can be a file/url or one of NSwag’s Swagger generators (use NSwagStudio to see the available inputs).