❔ NSwag Client generation
I'm trying to generate an API client for my .NET 6 REST API that used to be a Soap service. I want to replace the generated soap client with a new REST client.
When I generate an API Client in NSwag Studio, I get only a single file with a bunch of methods that aren't named after my API calls. What is this for?
When I generate using the swagger editor online, I do receive an API file as well as multiple model classes that are named after my objects and methods.
I'm confused as to why I get these different results and which one is needed for what task.
8 Replies
swagger editor? nswag studio? Make a c# project that automates that.
then you can choose a concrete version
GitHub
49/SwaggerTypeScriptClientGeneration.cs at main · AntonC9018/49
Contribute to AntonC9018/49 development by creating an account on GitHub.
GitHub
49/_build.csproj at main · AntonC9018/49
Contribute to AntonC9018/49 development by creating an account on GitHub.
The version is chosen in the .csproj file? And this works for generating C# code too?
nswag has a wiki on their GitHub
Ok using the code sample from their wiki I was able to generate something that looks a little more promising than what nswag studio gave me. I think my main issue is not properly understanding what exactly I'm trying to generate exactly, or rather what a rest version of the soap generated code I already should look like. I will try integrating what I got from this c# project and see how it goes. Thank you for your help!
you can configure the generator somewhat, like I did in the sample above, with the name handler that preserves pascal case for names
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.