有没有办法更改NSwagStudio中的设置,以便当JSON序列化设置输出为Newtonsoft.Json.Required.AllowNull而不是Newtonsoft.Json.Required.Always时
我目前已经手动更改了该属性,以允许使用空值。
[Newtonsoft.Json.JsonProperty("returnCode", Required = Newtonsoft.Json.Required.Always)]
public int ReturnCode { get; set; }我需要的是:
[Newtonsoft.Json.JsonProperty("returnCode", Required = Newtonsoft.Json.Required.AllowNull)]
public int ReturnCode { get; set; }发布于 2020-01-07 23:46:32
如果在API-spec中它不能为空,那么它在生成的代码中就不能为空。
接口规范示例:
ReturnCode:
type: integer
nullable: truehttps://stackoverflow.com/questions/55970499
复制相似问题