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()
|
||||
{
|
||||
Summary = dict.Value.Summary,
|
||||
Default = dict.Value.DefaultValue,
|
||||
Default = string.IsNullOrEmpty(dict.Value.DefaultValue) ? null : dict.Value.DefaultValue,
|
||||
Type = dict.Value.Type
|
||||
}).ToList()
|
||||
});
|
||||
|
|
|
@ -8,7 +8,8 @@ public record ResponseCommandParam
|
|||
public string Summary { get; set; }
|
||||
|
||||
[JsonPropertyName("default")]
|
||||
public string Default { get; set; }
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? Default { get; set; }
|
||||
|
||||
[JsonPropertyName("type")]
|
||||
public string Type { get; set; }
|
||||
|
|
Loading…
Reference in a new issue