[REQ] [csharp-netcore] Custom JsonSerializer needed
Created by: PeterTriebe
Is your feature request related to a problem? Please describe.
Lib: csharp-netcore
I want to do a "Patch" request to update some entries. For this reason its needed that "null" values are not serialized. If a property is not serialized it will be ignored from the service.
Describe the solution you'd like
To solve this i want to add a custom Json serializer. Inside this I'm able to say that null values will be ignored.
example how it worket after i changed the generated code:
private RestRequest newRequest(
HttpMethod method,
String path,
RequestOptions options,
IReadableConfiguration configuration)
{
....
RestRequest request = new RestRequest(Method(method))
{
Resource = path,
JsonSerializer = new CustomJsonCodec(new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
},configuration)
};
But we want to make it more generic :-) The creation of this request is wrapped by the generated client. And there is actual no way to pass a custom Json serializer. I think its a good idea to pass a custon serializer together wirh the configuration. With this the client can configure what he want.
Describe alternatives you've considered
Its also possible to add some configurations like NullValueHandling = NullValueHandling.Ignore
directly to the config. But i think thats not so suitable.