Make sure that the /v1/command endpoint actually ignores the parameter default value during json serialization if its null, instead of making it an empty string
This commit is contained in:
parent
4d97201319
commit
09af445436
2 changed files with 3 additions and 2 deletions
|
@ -27,7 +27,7 @@ public class CommandController : ControllerBase
|
||||||
Params = cmd.Parameters.Select(dict => new ResponseCommandParam()
|
Params = cmd.Parameters.Select(dict => new ResponseCommandParam()
|
||||||
{
|
{
|
||||||
Summary = dict.Value.Summary,
|
Summary = dict.Value.Summary,
|
||||||
Default = dict.Value.DefaultValue,
|
Default = string.IsNullOrEmpty(dict.Value.DefaultValue) ? null : dict.Value.DefaultValue,
|
||||||
Type = dict.Value.Type
|
Type = dict.Value.Type
|
||||||
}).ToList()
|
}).ToList()
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,8 @@ public record ResponseCommandParam
|
||||||
public string Summary { get; set; }
|
public string Summary { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("default")]
|
[JsonPropertyName("default")]
|
||||||
public string Default { get; set; }
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
public string? Default { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("type")]
|
[JsonPropertyName("type")]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
Loading…
Reference in a new issue