Skip to content

Commit c515a76

Browse files
committed
chore: adds update to parent property
Signed-off-by: Vincent Biret <[email protected]>
1 parent 97b2b45 commit c515a76

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/Microsoft.OpenApi.Readers.Tests/V31Tests/RelativeReferenceTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,16 @@ public async Task ShouldResolveReferencesInSchemasFromSystemTextJson()
436436
Assert.Equal(JsonSchemaType.Array | JsonSchemaType.Null, updatedTagsProperty.Type);
437437
Assert.Equal(JsonSchemaType.Object, updatedTagsProperty.Items.Type);
438438

439+
440+
// doing the same for the parent property
441+
442+
var parentProperty = Assert.IsType<OpenApiSchema>(schema.Properties["parent"]);
443+
var parentSubProperty = Assert.IsType<OpenApiSchemaReference>(parentProperty.Properties["parent"]);
444+
Assert.Equal("#/properties/parent", parentSubProperty.Reference.ReferenceV3);
445+
parentProperty.Properties["parent"] = new OpenApiSchemaReference($"#/components/schemas/Foo{parentSubProperty.Reference.ReferenceV3.Replace("#", string.Empty)}", document);
446+
var updatedParentSubProperty = Assert.IsType<OpenApiSchemaReference>(parentProperty.Properties["parent"]);
447+
Assert.Equal(JsonSchemaType.Object | JsonSchemaType.Null, updatedParentSubProperty.Type);
448+
439449
var pathItem = new OpenApiPathItem
440450
{
441451
Operations = new Dictionary<HttpMethod, OpenApiOperation>

0 commit comments

Comments
 (0)