I get this object specification in (OpenApi 3.0.1) from a vendor:
"ExampleTO" : {
"codeValidFrom" : {
"type" : "string",
"format" : "date"
}
}
NSwag generates this property in a C# client (correctly, I think):
[Newtonsoft.Json.JsonProperty("codeValidFrom",
Required = Newtonsoft.Json.Required.DisallowNull,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonConverter(typeof(DateFormatConverter))]
public System.DateTimeOffset CodeValidFrom { get; set; }
Problem: there are null values in "codeValidFrom". I think the specification should look like:
"ExampleTO" : {
"codeValidFrom" : {
"type" : "string",
"format" : "date",
"nullable: "true"
}
}
The vendor does not want to make this addition, claiming that the schema is generated and cannot be easily changed.
Is there a way to still make this work with an NSwag client? Ideally, I would make all string properties nullable.