I'm in the middle of migrating our server from SOAP to REST. I'm using swashbuckle to generate the api documentation and autorest to create the clients.
I have alot of methods with signatures that allow:
1) Nullable values
2) Strings that may allow null values
For instance a method like this:
public void SetGlobalDataForSite(string wsKey, int? siteId, string title,
string keywords, string homepagetitle, bool isValidValue)
Doesn't need to have a value for siteId, keywords or homepagetitle.
As far as i know to allow these values to be null i should convert the method to something like this:
public void SetGlobalDataForSite(string wsKey, string title, bool isValidValue,
int? siteId = null, string keywords = null, string homepagetitle = null)
Now this causes alot of problems:
1) Since i'm changing the signature it's very error prone
2) It's alot of work, i have about 300 methods to change
3) I also need to change the client code which can induce even more bugs
Is there a way to mark these properties as nullable without changing the signarue? Maybe i'm missing something. Creating a request class for most methods could work, but then again i'm generation alot of useless code.
Any ideas would be appreciated :)
You will have to put in one time effort to convert -- usually safe options can be either accept parameter in the form of object (it can be JObject or class or even Tuple in latest version of C#)