@@ -424,7 +424,7 @@ public async Task SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync(bool prod
424
424
}
425
425
426
426
[ Fact ]
427
- public void SerializeSchemaPrimitiveTypeShouldRemoveFormatInRootIfPresentInChildrenSchema ( )
427
+ public void SerializeAsV2ShouldSetFormatPropertyInParentSchemaIfPresentInChildrenSchema ( )
428
428
{
429
429
// Arrange
430
430
var schema = new OpenApiSchema ( )
@@ -448,13 +448,7 @@ public void SerializeSchemaPrimitiveTypeShouldRemoveFormatInRootIfPresentInChild
448
448
schema . SerializeAsV2 ( openApiJsonWriter ) ;
449
449
openApiJsonWriter . Flush ( ) ;
450
450
451
- var v2Schema = outputStringWriter . GetStringBuilder ( ) . ToString ( ) . MakeLineBreaksEnvironmentNeutral ( ) ; //.Replace(Environment.NewLine, "").Replace(" ", "").Replace("\n","");
452
-
453
- // Serialize as V3
454
- //schema.SerializeAsV3(openApiJsonWriter);
455
- //openApiJsonWriter.Flush();
456
-
457
- //var v3Schema = outputStringWriter.GetStringBuilder().ToString();//.Replace(Environment.NewLine, "").Replace(" ", "").Replace("\n", "");
451
+ var v2Schema = outputStringWriter . GetStringBuilder ( ) . ToString ( ) . MakeLineBreaksEnvironmentNeutral ( ) ;
458
452
459
453
var expectedV2Schema = @"{
460
454
""format"": ""decimal"",
@@ -466,25 +460,8 @@ public void SerializeSchemaPrimitiveTypeShouldRemoveFormatInRootIfPresentInChild
466
460
]
467
461
}" . MakeLineBreaksEnvironmentNeutral ( ) ;
468
462
469
-
470
- var expectedV3Schema = @"{
471
- ""allOf"": [
472
- {
473
- ""format"": ""decimal"",
474
- ""type"": ""number""
475
- }]}
476
- {""oneOf"": [
477
- {
478
- ""type"": ""number"",
479
- ""format"": ""decimal""
480
- },
481
- {""type"" : ""string""}
482
-
483
- ]}}" ; //.Replace(Environment.NewLine, "").Replace(" ", "").Replace("\n", "");
484
-
485
463
// Assert
486
- Assert . Equal ( expectedV2Schema , v2Schema ) ; // Assert that v2 schema has the root schema Format defined
487
- //Assert.Equal(expectedV3Schema, v3Schema);
464
+ Assert . Equal ( expectedV2Schema , v2Schema ) ;
488
465
}
489
466
}
490
467
}
0 commit comments