C# ExcludedTypeNames is generating the wrong output (nswag file + clients)
See original GitHub issueNSwagStudio Version: 11.9.1.0
NJsonSchema Version: 9.7.3.0 (Newtonsoft.Json v 9.0.0.0)
When using NSwagStudio if you exclude multiple types it generates the .nswag
file and the generated clients incorrectly. It generates the type names comma separated wrapped in a string (i.e. "ClassA, ClassB"
) rather than strings that are comma separated (i.e. "ClassA", "ClassB"
)
NSwagStudio configuration:

Note with the above: We also tried Sku,HtmlString
as well to no avail.
Expected Output:
"swaggerToCSharpClient": {
"additionalNamespaceUsages": [
"System",
"System.Collections.Generic",
"System.Linq",
"Shared"
],
"excludedTypeNames": [
"Sku",
"HtmlString"
]
}
Actual Output:
"swaggerToCSharpClient": {
"additionalNamespaceUsages": [
"System",
"System.Collections.Generic",
"System.Linq",
"Shared"
],
"excludedTypeNames": [
"Sku, HtmlString"
]
}
The upshot of it is that when you exclude multiple types and then generate the clients it includes the excluded types:
Expected:
Actual:
If there’s any further information I can provide let me know and I’ll provide it.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Nswag adds the path of the generated file at the end ...
I am running into a strange issue with my Nswag generated file. After running the scrip for generating the code it is doing...
Read more >Using OpenApiReference To Generate Open API Client ...
Background. I have been using Rico Suter's brilliant NSwag for some time now to generate client code for working with HTTP API endpoints....
Read more >Maintaining API Clients With NSwag Model Generation
We explored NSwag Studio and successfully generated C# models for our front-end web API. Here, all models from an OpenAPI spec were isolated...
Read more >Auto Generated .NET API Clients using NSwag and ...
This article shows how auto generated code for a C# HTTP API client could be created using Swagger and NSwag . The API...
Read more >How To Use Nswag With ASP.NET Core And Generate ...
After generating client code just click on the Generate Files button to generate a file which will be available on an output file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My bad, stringarrayconverter is the wrong converter:
https://github.com/RSuter/NSwag/blob/master/src/NSwagStudio/Converters/StringArrayConverter.cs
Will fix tomorrow
v11.11.1