question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

C# ExcludedTypeNames is generating the wrong output (nswag file + clients)

See original GitHub issue

NSwagStudio 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:

image

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: image

Actual: image

If there’s any further information I can provide let me know and I’ll provide it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
RicoSutercommented, Oct 24, 2017

My bad, stringarrayconverter is the wrong converter:

https://github.com/RSuter/NSwag/blob/master/src/NSwagStudio/Converters/StringArrayConverter.cs

Will fix tomorrow

0reactions
RicoSutercommented, Oct 26, 2017

v11.11.1

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found