File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
test/Microsoft.OpenApi.Readers.Tests/V31Tests Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
4
using System . Collections . Generic ;
@@ -356,7 +356,8 @@ public void SerializeV2SchemaWithNullableExtensionAsV31Works()
356
356
// Arrange
357
357
var expected = @"type:
358
358
- string
359
- - null" ;
359
+ - null
360
+ x-nullable: true" ;
360
361
361
362
var path = Path . Combine ( SampleFolderPath , "schemaWithNullableExtension.yaml" ) ;
362
363
@@ -369,5 +370,20 @@ public void SerializeV2SchemaWithNullableExtensionAsV31Works()
369
370
370
371
schemaString . MakeLineBreaksEnvironmentNeutral ( ) . Should ( ) . Be ( expected . MakeLineBreaksEnvironmentNeutral ( ) ) ;
371
372
}
373
+
374
+ [ Theory ]
375
+ [ InlineData ( "schemaWithNullable.yaml" ) ]
376
+ [ InlineData ( "schemaWithNullableExtension.yaml" ) ]
377
+ public void LoadSchemaWithNullableExtensionAsV31Works ( string filePath )
378
+ {
379
+ // Arrange
380
+ var path = Path . Combine ( SampleFolderPath , filePath ) ;
381
+
382
+ // Act
383
+ var schema = OpenApiModelFactory . Load < OpenApiSchema > ( path , OpenApiSpecVersion . OpenApi3_1 , out _ ) ;
384
+
385
+ // Assert
386
+ schema . Type . Should ( ) . BeEquivalentTo ( new string [ ] { "string" , "null" } ) ;
387
+ }
372
388
}
373
389
}
You can’t perform that action at this time.
0 commit comments