@@ -424,7 +424,7 @@ public async Task SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync(bool prod
424424 }
425425
426426 [ Fact ]
427- public void SerializeSchemaPrimitiveTypeShouldRemoveFormatInRootIfPresentInChildrenSchema ( )
427+ public void SerializeAsV2ShouldSetFormatPropertyInParentSchemaIfPresentInChildrenSchema ( )
428428 {
429429 // Arrange
430430 var schema = new OpenApiSchema ( )
@@ -448,13 +448,7 @@ public void SerializeSchemaPrimitiveTypeShouldRemoveFormatInRootIfPresentInChild
448448 schema . SerializeAsV2 ( openApiJsonWriter ) ;
449449 openApiJsonWriter . Flush ( ) ;
450450
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 ( ) ;
458452
459453 var expectedV2Schema = @"{
460454 ""format"": ""decimal"",
@@ -466,25 +460,8 @@ public void SerializeSchemaPrimitiveTypeShouldRemoveFormatInRootIfPresentInChild
466460 ]
467461}" . MakeLineBreaksEnvironmentNeutral ( ) ;
468462
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-
485463 // 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 ) ;
488465 }
489466 }
490467}
0 commit comments