File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
src/Microsoft.OpenApi/Validations/Rules Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 2
2
// Licensed under the MIT license.
3
3
4
4
using System ;
5
+ using System . Linq ;
5
6
using Microsoft . OpenApi . Interfaces ;
6
7
using Microsoft . OpenApi . Properties ;
7
8
@@ -21,13 +22,10 @@ public static class OpenApiExtensibleRules
21
22
( context , item ) =>
22
23
{
23
24
context . Enter ( "extensions" ) ;
24
- foreach ( var extensible in item . Extensions )
25
+ foreach ( var extensible in item . Extensions . Keys . Where ( static x => ! x . StartsWith ( "x-" , StringComparison . OrdinalIgnoreCase ) ) )
25
26
{
26
- if ( ! extensible . Key . StartsWith ( "x-" ) )
27
- {
28
- context . CreateError ( nameof ( ExtensionNameMustStartWithXDash ) ,
29
- String . Format ( SRResource . Validation_ExtensionNameMustBeginWithXDash , extensible . Key , context . PathString ) ) ;
30
- }
27
+ context . CreateError ( nameof ( ExtensionNameMustStartWithXDash ) ,
28
+ string . Format ( SRResource . Validation_ExtensionNameMustBeginWithXDash , extensible , context . PathString ) ) ;
31
29
}
32
30
context . Exit ( ) ;
33
31
} ) ;
You can’t perform that action at this time.
0 commit comments