Inspired by Ed Welsh’s C# client generator, I’ve developed my own generator with a rather different design philosophy. Mine is also under the MIT license.
- Designed for easy setup and rapid iteration. Just add the NuGet package to your project and edit the config file it creates. If you ever need to change which clients are generated, just edit the config file and rebuild.
- Gives you complete control over NSwag generator settings.
- Allows you to generate clients for Epicor services that were hidden before 10.2.300. (See Nicholas Whitall’s answer here.)
- Generates clients for any Swagger API. (In theory, anyway. I’ve only used it with Epicor and Magento.)
- Uses a newer version of NSwag that generates less buggy code.
- Enhances NSwag’s handling of base URLs. (NSwag issues #1837 and #1850.)
- Generates clients directly into the target project. This allows you to combine your own classes with generated partial classes.
- Generates into /obj by default, so generated code will not be in source control.
The default settings do not produce drop-in replacements for clients generated by Ed’s version. This is partly due to NSwag’s own defaults changing to address NSwag issue #1097. With the defaults I’ve set, the lifecycle of the HttpClient
used to construct a REST client is not the REST client’s concern.