I'm using Optional<T> and a Custom Converter to implement PATCH
with Text.Json on a resource according to Distinguish between NULL and not present using JSON Merge Patch with NetCore WebApi and System.Text.Json
Let's take this example for the DTO:
public class PatchGroupDTO
{
public Optional<string?> Name { get; init; }
public Optional<string?> NickName{ get; init; }
}
Swagger then shows for the 'Example Value'
{
"name": {
"value": "string"
},
"nickName": {
"value": "string"
}
}
and the 'Schema':
PatchGroupDTO{
name StringOptional{...}
nickName StringOptional{...}
}
How can I achieve that Swagger shows the correct input format of the JSON?
{
"name": "string",
"nickName": "string"
}
PatchGroupDTO{
name string nullable:true
nickName string nullable:true
}
Is it possible to generally flatten all Optional<T> types?