I have…
- [x] Checked the logs and have provided uploaded a log file and provided a link because I found something suspicious there.
I’m submitting a…
- [ ] Regression (a behavior that stopped working in a new release)
- [x] Bug report
- [ ] Performance issue
- [ ] Documentation issue or request
Current behavior
I tried generating the c# client from the swagger client cloud version and I found a strange behavoir. After the last generation, that has been perfomed some months ago, the properties of my schema were flagged as “Required = Newtonsoft.Json.Required.Defaul”, now instead with “Required = Newtonsoft.Json.Required.DisallowNull”. With this modification when I try to deserialize some content that do not have some property valorized I get a DeserilizationException. Since I do not changed the schemas, this must be some bug in the swagger.json definition.
Here a comparison between the two version of the generated code of a variable of one of my classes:
#OLD
[Newtonsoft.Json.JsonProperty(“FooterContentsMobile”, Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public ChannelconfigFooterContentsMobileProperty FooterContentsMobile { get; set; }
#NEW
[Newtonsoft.Json.JsonProperty(“CustomerModelMandatoryFields”, Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public ChannelconfigCustomerModelMandatoryFieldsProperty CustomerModelMandatoryFields { get; set; }
Expected behavior
If in the schema configuration the field is not mandatory, the generated client with swagger must handle the null value
Environment
- [ ] Self hosted with docker
- [ ] Self hosted with IIS
- [ ] Self hosted with other version
- [X] Cloud version
Browser:
- [X] Chrome (desktop)
- [ ] Chrome (Android)
- [ ] Chrome (iOS)
- [ ] Firefox
- [ ] Safari (desktop)
- [ ] Safari (iOS)
- [ ] IE
- [ ] Edge