File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
src/Microsoft.OpenApi/Reader Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ internal static partial class OpenApiV2Deserializer
2222 /// <summary>
2323 /// Have a default empty tag we can use to filter out empty tags.
2424 /// </summary>
25- private static OpenApiTagReference emptyTagReference = new ( "empty" ) ;
2625 private static readonly FixedFieldMap < OpenApiOperation > _operationFixedFields =
2726 new ( )
2827 {
@@ -33,12 +32,12 @@ internal static partial class OpenApiV2Deserializer
3332 {
3433 var val = valueNode . GetScalarValue ( ) ;
3534 if ( string . IsNullOrEmpty ( val ) )
36- return emptyTagReference ; // Avoid exception on empty tag, we'll remove these from the list further on
35+ return null ; // Avoid exception on empty tag, we'll remove these from the list further on
3736 return LoadTagByReference ( val , doc ) ;
3837 } ,
3938 doc )
4039 // Filter out empty tags instead of excepting on them
41- . Where ( n => ! object . ReferenceEquals ( emptyTagReference , n ) ) . ToList ( ) is { Count : > 0 } tags )
40+ . OfType < OpenApiTagReference > ( ) . ToList ( ) is { Count : > 0 } tags )
4241 {
4342 o . Tags = new HashSet < OpenApiTagReference > ( tags , OpenApiTagComparer . Instance ) ;
4443 }
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ internal static partial class OpenApiV3Deserializer
2020 /// <summary>
2121 /// Have a default empty tag we can use to filter out empty tags.
2222 /// </summary>
23- private static OpenApiTagReference emptyTagReference = new ( "empty" ) ;
2423 private static readonly FixedFieldMap < OpenApiOperation > _operationFixedFields =
2524 new ( )
2625 {
@@ -31,12 +30,12 @@ internal static partial class OpenApiV3Deserializer
3130 {
3231 var val = valueNode . GetScalarValue ( ) ;
3332 if ( string . IsNullOrEmpty ( val ) )
34- return emptyTagReference ; // Avoid exception on empty tag, we'll remove these from the list further on
33+ return null ; // Avoid exception on empty tag, we'll remove these from the list further on
3534 return LoadTagByReference ( val , doc ) ;
3635 } ,
3736 doc )
3837 // Filter out empty tags instead of excepting on them
39- . Where ( n => ! object . ReferenceEquals ( emptyTagReference , n ) ) . ToList ( ) is { Count : > 0 } tags )
38+ . OfType < OpenApiTagReference > ( ) . ToList ( ) is { Count : > 0 } tags )
4039 {
4140 o . Tags = new HashSet < OpenApiTagReference > ( tags , OpenApiTagComparer . Instance ) ;
4241 }
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ internal static partial class OpenApiV31Deserializer
1717 /// <summary>
1818 /// Have a default empty tag we can use to filter out empty tags.
1919 /// </summary>
20- private static OpenApiTagReference emptyTagReference = new ( "empty" ) ;
2120 private static readonly FixedFieldMap < OpenApiOperation > _operationFixedFields =
2221 new ( )
2322 {
@@ -28,12 +27,12 @@ internal static partial class OpenApiV31Deserializer
2827 {
2928 var val = valueNode . GetScalarValue ( ) ;
3029 if ( string . IsNullOrEmpty ( val ) )
31- return emptyTagReference ; // Avoid exception on empty tag, we'll remove these from the list further on
30+ return null ; // Avoid exception on empty tag, we'll remove these from the list further on
3231 return LoadTagByReference ( val , doc ) ;
3332 } ,
3433 doc )
3534 // Filter out empty tags instead of excepting on them
36- . Where ( n => ! object . ReferenceEquals ( emptyTagReference , n ) ) . ToList ( ) is { Count : > 0 } tags )
35+ . OfType < OpenApiTagReference > ( ) . ToList ( ) is { Count : > 0 } tags )
3736 {
3837 o . Tags = new HashSet < OpenApiTagReference > ( tags , OpenApiTagComparer . Instance ) ;
3938 }
You can’t perform that action at this time.
0 commit comments