Has anyone had much experience converting Swagger API definitions to C#.NET client code?
Mostly, Swagger Editor works ok, but the issue we have is that the generated code for some calls has a bunch of required-but-nullable arguments. Eg (truncated argument list for illustration only):
GetCustomers(bool? includeDeceased, string postalCode, string id, string dateAdded)
We would like the generated parameter list to be defined with default values to avoid having to explicitly provide null arguments. So something like this:
GetCustomers(bool? includeDeceased = null, string postalCode = null, int? id = null, string dateAdded = null)
This allows us to make the following call:
GetCustomers(postalCode: "12345")
Rather than:
GetCustomers(includeDeceased: null, postalCode="12345", id: null, dateAdded: null)
We've tried adding "default": null
to the Swagger call definitions where appropriate but this doesn't result in the desired code (in fact, no change, so probably not supported).
Short of manually modifying the resulting client code – which we want to avoid so we can quickly and easily update our code to the latest API definitions – we're a bit stuck.