is there a way to do something like the following line in implementing a XData service?
I would like to default the parameter object "config" to an nil pointer.
Thank You for Your answer. I understand that it would be difficult to define a default object. Without knowing what lies behind all this: Would it be possible to have an attribute something like this [XDefaultNil]. Even if it is not possible to define a whole object as a default - maybe it would be possible to define a default "nil"-object?
It would be nice to be able to omit the whole object when there is nothing of it to be set.
Background of my request is that I'm looking for a possibility to add an optional parameter (in fact, many optional parameters) to some requests, maybe for configuring the output. Imagine a method that looks for some Data - and format these as a csv-file. There are default parameters and You do not have to configure the whole request. But if You like you can add some parameters to configure the csv-format like delimiter char... Of course it would be possible to do this in a lot of optional parameters, but it would be more elegant to do this in an object with all the possible parameters.
So for default requests it would be a very simple format like
thank You for Your suggestion. This would indeed be an elegant way to solve my "problem". I can document this even in swagger - and then everything is ok.
What I've done in these situations, similar to Wagner's suggestion, is to have a parameter called "Parameters" that is a JSON string - the caller can pass in whatever key-value pairs they like this way, or anything else, really, and the list of keys that are accepted/expected can be documented. There have also been instances where I've just created multiple endpoints with different parameters where some additional clarity or control might be helpful.
Thank You for this interesting idea. This way it would even be possible to make the string parameter with XDefault and omit it then totally. I will check this - how easy it is to encode the json to a string and decode it again.
BackupTableToFile - POST-DATA: { “TableName": "customers", “Param”: { "Filename": "customers.backup" } } // DOES NOT WORK! - note the upper and lower case letters