@@ -17,6 +17,8 @@ namespace Microsoft.OpenApi.Reader.V3
1717 /// </summary>
1818 internal static partial class OpenApiV3Deserializer
1919 {
20+ private const string EncounteredNullableTrueMetadataKey = "encounteredNullable" ;
21+
2022 private static readonly FixedFieldMap < OpenApiSchema > _openApiSchemaFixedFields = new ( )
2123 {
2224 {
@@ -235,7 +237,7 @@ internal static partial class OpenApiV3Deserializer
235237 // If, at a later point during deserialization, Type was set, we apply nullable to it.
236238 // Otherwise, we throw it away.
237239 o . Metadata ??= new Dictionary < string , object > ( ) ;
238- o . Metadata [ "encounteredNullable" ] = true ;
240+ o . Metadata [ EncounteredNullableTrueMetadataKey ] = true ;
239241 }
240242 }
241243 }
@@ -396,9 +398,9 @@ public static IOpenApiSchema LoadSchema(JsonNode node, OpenApiDocument hostDocum
396398
397399 ParseMap ( jsonObject , schema , _openApiSchemaFixedFields , _openApiSchemaPatternFields , hostDocument , context ) ;
398400
399- if ( schema . Metadata ? . TryGetValue ( "encounteredNullable" , out var value ) == true )
401+ if ( schema . Metadata ? . TryGetValue ( EncounteredNullableTrueMetadataKey , out var value ) == true )
400402 {
401- schema . Metadata . Remove ( "encounteredNullable" ) ;
403+ schema . Metadata . Remove ( EncounteredNullableTrueMetadataKey ) ;
402404 if ( schema . Type is not null && schema . Type != 0 && value is bool isNullable && isNullable )
403405 {
404406 schema . Type |= JsonSchemaType . Null ;
0 commit comments