Skip to content

Commit ac6aee9

Browse files
Fix reports property in proxy API response schema (#2193)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 61346d9 commit ac6aee9

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

‎DevProxy.Tests/ApiEndpointSchemasTests.cs‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,31 @@ public void Get_JwtTokenRequestBody_ListsAllJwtOptionsProperties()
7979
Assert.Equal(CamelCasePropertyNames<JwtOptions>(), properties);
8080
}
8181

82-
[Fact]
83-
public void Get_ProxyStatusResponse_ListsAllProxyInfoProperties()
82+
[Theory]
83+
[InlineData("GET")]
84+
[InlineData("POST")]
85+
public void Get_ProxyStatusResponse_ListsAllProxyInfoProperties(string method)
8486
{
85-
var schema = ApiEndpointSchemas.Get("GET", "/proxy")!;
87+
var schema = ApiEndpointSchemas.Get(method, "/proxy")!;
8688
var properties = schema.Responses["200"]!["content"]![ApiEndpointSchemas.JsonContentType]!["schema"]!["properties"]!
8789
.AsObject().Select(p => p.Key).Order(StringComparer.Ordinal);
8890

8991
Assert.Equal(CamelCasePropertyNames<ProxyInfo>(), properties);
9092
}
9193

94+
[Theory]
95+
[InlineData("GET")]
96+
[InlineData("POST")]
97+
public void Get_ProxyStatusResponse_ReportsIsOptionalStringArray(string method)
98+
{
99+
var schema = ApiEndpointSchemas.Get(method, "/proxy")!.Responses["200"]!["content"]![ApiEndpointSchemas.JsonContentType]!["schema"]!;
100+
var reports = schema["properties"]!["reports"]!;
101+
102+
Assert.Equal("array", reports["type"]!.GetValue<string>());
103+
Assert.Equal("string", reports["items"]!["type"]!.GetValue<string>());
104+
Assert.DoesNotContain(schema["required"]?.AsArray() ?? [], p => p!.GetValue<string>() == "reports");
105+
}
106+
92107
[Fact]
93108
public void Get_LogsJsonResponse_ListsAllLogEntryProperties()
94109
{

‎DevProxy/Commands/ApiEndpointSchemas.cs‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,7 @@ internal sealed class EndpointSchema
145145
["type"] = new JsonArray("string", "null"),
146146
["description"] = "Path of the configuration file Dev Proxy loaded. Read-only."
147147
},
148-
["reports"] = new JsonObject
149-
{
150-
["type"] = "array",
151-
["items"] = new JsonObject { ["type"] = "string" },
152-
["description"] = "Absolute paths of the report files written after recording stopped. Only returned in response to stopping recording. Read-only."
153-
}
148+
["reports"] = StringArrayProperty("Absolute paths of report files written after recording stopped. Only returned in response to stopping recording. Read-only.")
154149
}
155150
};
156151

0 commit comments

Comments
 (0)