Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Reference Bug #1740

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/NJsonSchema.Tests/References/LocalReferencesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,20 @@ public async Task When_document_has_indirect_external_ref_to_a_definition_than_i
Assert.Equal("SubAnimal", schema.Definitions.Single().Key);
}

[Fact]
public async Task When_document_has_indirect_external_ref_to_a_schema_with_sibling_then_it_is_loaded()
{
//// Arrange
var path = GetTestDirectory() + "/References/LocalReferencesTests/schema_with_indirect_subreference_sibling.json";

//// Act
var schema = await JsonSchema.FromFileAsync(path);
var json = schema.ToJson();

//// Assert
// TODO
}

[Fact]
public async Task When_reference_is_registered_in_custom_resolver_it_should_not_try_to_access_file()
{
Expand Down
15 changes: 15 additions & 0 deletions src/NJsonSchema.Tests/References/LocalReferencesTests/animal.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,20 @@
"SubAnimal": {
"type": "object"
}
},
"components": {
"schemas": {
"SubAnimal2": {
"type": "object",
"properties": {
"sub": {
"$ref": "#/components/schemas/SubAnimal3"
}
}
},
"SubAnimal3": {
"type": "object"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "object",
"properties": {
"foo": {
"$ref": "./animal.json#/components/schemas/SubAnimal2"
}
}
}
Loading