I'm using Swashbuckle in an ASP .NET MVC application which is configured with additional operation filters like so:
GlobalConfiguration.Configuration
.EnableSwagger(c => {
c.OperationFilter<FooOpeartionFilter>();
c.OperationFilter<BarOpeartionFilter>();
//other confs
...
In my .NET client application, I would like to automatically create API client code based on a .NET MvcApplication.dll
which includes the Controller definitions.
For this I use NSWAG. I run firstly webapi2openapi to generate the openapi.json document
nswag webapi2openapi /assembly:MvcApplication.dll /output:MvcApplication.OpenApi.json
and then for creation of the client c# code:
nswag run configuration.nswag
with the configuration.nswag
pointing to the MvcApplication.OpenApi.json
"documentGenerator": {
"fromDocument": {
"url": "PATH\MvcApplication.OpenApi.json"
}
},
but the created openAPI document MvcApplication.OpenApi.json
is lacking of changes to the API which the additional OperationFilters
are providing. As I understand, this is expected as the Operation filters are added on asp .net application startup and we create the .json from a static .dll.
Is there a way to include the operation filters to the created MvcApplication.OpenApi.json
based on a MvcApplication.dll
? Is this possible? I have search for answer in the nswag help
and navigated to Command: webapi2openapi
, but non of the listed parameters seems to add those operation filters. Or maybe should I change my ASP .NET code and use NSWAG instead of swashbuckle?