File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
src/Microsoft.OpenApi/Validations/Rules
test/Microsoft.OpenApi.Tests/Validations Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff 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" ) ;
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments