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

Cannot resolve 2nd level of local $ref. #419

Closed
lennver opened this issue Mar 28, 2023 · 1 comment · Fixed by #423
Closed

Cannot resolve 2nd level of local $ref. #419

lennver opened this issue Mar 28, 2023 · 1 comment · Fixed by #423
Labels
bug Something isn't working pkg:schema

Comments

@lennver
Copy link

lennver commented Mar 28, 2023

Environment

  • Nuget Package: JsonSchema.Net
  • Nuget Version: 4.0.0
  • OS: Windows 10
  • .Net Target: 7

Describe the bug
When adding a $ref inside a file that itself is a referenced file the grandhild schema fails to be resolved.

To Reproduce
See the attached files, or:
Create a schema with a @ref to another schema, that has a @ref to the yet another schema. Then evaluate it against a json file that follows the schema.

Expected behavior
It throws a JsonSchemaException "Cannot resolve base schema from https://json-everything.net/level2.json" where level2.json is the grandchild.

at Json.Schema.RefKeyword.Evaluate(EvaluationContext context) at Json.Schema.EvaluationContext.Evaluate() at Json.Schema.PropertiesKeyword.Evaluate(EvaluationContext context) at Json.Schema.EvaluationContext.Evaluate() at Json.Schema.RefKeyword.Evaluate(EvaluationContext context) at Json.Schema.EvaluationContext.Evaluate() at Json.Schema.PropertiesKeyword.Evaluate(EvaluationContext context) at Json.Schema.EvaluationContext.Evaluate() at Json.Schema.JsonSchema.Evaluate(JsonNode root, EvaluationOptions options) at Json.Schema.JsonSchemaExtensions.Evaluate(JsonSchema jsonSchema, JsonElement jsonElement, EvaluationOptions options) at Json.Schema.JsonSchemaExtensions.Evaluate(JsonSchema jsonSchema, JsonDocument jsonDocument, EvaluationOptions options) at UserQuery.Main(), line 14

Additional context

issueExample.zip

@lennver lennver added the bug Something isn't working label Mar 28, 2023
@gregsdennis
Copy link
Owner

I think you have actually just provided reproduction for #415.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:schema
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants