Skip to content

Commit bbdaa02

Browse files
Address feedback
Address Copilot feedback.
1 parent 7b7cea4 commit bbdaa02

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/Microsoft.OpenApi/Validations/Rules/OpenApiResponsesRules.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static partial class OpenApiResponsesRules
2828
new(nameof(ResponsesMustContainAtLeastOneResponse),
2929
(context, responses) =>
3030
{
31-
if (responses.Keys.Count == 0)
31+
if (responses.Count == 0)
3232
{
3333
context.CreateError(nameof(ResponsesMustContainAtLeastOneResponse),
3434
"Responses must contain at least one response");

test/Microsoft.OpenApi.Tests/Validations/OpenApiRecommendedRulesTests.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public static void GetOperationWithoutRequestBodyIsValid()
9292
ruleSet.Add(typeof(OpenApiPaths), OpenApiRecommendedRules.GetOperationShouldNotHaveRequestBody);
9393

9494
// Act
95-
9695
var errors = document.Validate(ruleSet);
9796
var result = !errors.Any();
9897

@@ -193,15 +192,14 @@ public static void GetOperationWithRequestBodyIsInvalid()
193192
ruleSet.Add(typeof(OpenApiPaths), OpenApiRecommendedRules.GetOperationShouldNotHaveRequestBody);
194193

195194
// Act
196-
197-
var errors = document.Validate(ruleSet);
198-
var result = !errors.Any();
195+
var warnings = document.Validate(ruleSet);
196+
var result = !warnings.Any();
199197

200198
// Assert
201199
Assert.False(result);
202-
Assert.NotNull(errors);
203-
var error = Assert.Single(errors);
204-
Assert.Equal("GET operations should not have a request body.", error.Message);
205-
Assert.Equal("#/paths/people/get/requestbody", error.Pointer);
200+
Assert.NotNull(warnings);
201+
var warning = Assert.Single(warnings);
202+
Assert.Equal("GET operations should not have a request body.", warning.Message);
203+
Assert.Equal("#/paths/people/get/requestbody", warning.Pointer);
206204
}
207205
}

0 commit comments

Comments
 (0)