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

refs from referenced files are not resolved #92

Closed
richardlarocque opened this issue Jan 29, 2019 · 1 comment
Closed

refs from referenced files are not resolved #92

richardlarocque opened this issue Jan 29, 2019 · 1 comment

Comments

@richardlarocque
Copy link
Contributor

In complex schemas were the root contains a "$ref" to a file which contains a "$ref" to yet another file, it looks like the second level of references are not resolved.

In case that seems too hand-wavy, I'll attach a PR that includes test cases that demonstrate the behavior I believe to be incorrect.

I suspect that this bug might explain a few other open tickets, but I'm reluctant to propose resolve-as-dupe-ing without more investigation.

richardlarocque added a commit to richardlarocque/json_matchers that referenced this issue Jan 29, 2019
This is a fix for thoughtbot#92.

Calls `expand_references!` on loaded schemas before adding them to the
`DocumentStore`.  This is intended to fix a bug where complex schemas
that include more than one level of cross-file use of `$ref`s are not
being validated correctly.

This commit includes new test cases that reproduce this issue and show
the effectiveness of the proposed fix.

The inspiration for this fix comes from a command included in the
`json_schema` gem.  In that gem, the stand-alone validator command
expands references within schemas before adding them to the store.
It seems reasonable to do the same here.

See https://github.com/brandur/json_schema/blob/20ccb82d7e18140d88ded508edd6c003865c98a0/lib/commands/validate_schema.rb#L92.
richardlarocque added a commit to richardlarocque/json_matchers that referenced this issue Jan 30, 2019
This is a fix for thoughtbot#92.

Calls `expand_references!` on loaded schemas before adding them to the
`DocumentStore`.  This is intended to fix a bug where complex schemas
that include more than one level of cross-file use of `$ref`s are not
being validated correctly.

This commit includes new test cases that reproduce this issue and show
the effectiveness of the proposed fix.

The inspiration for this fix comes from a command included in the
`json_schema` gem.  In that gem, the stand-alone validator command
expands references within schemas before adding them to the store.
It seems reasonable to do the same here.

See https://github.com/brandur/json_schema/blob/20ccb82d7e18140d88ded508edd6c003865c98a0/lib/commands/validate_schema.rb#L92.
richardlarocque added a commit to richardlarocque/json_matchers that referenced this issue Jan 30, 2019
This is a fix for thoughtbot#92.

Calls `expand_references!` on loaded schemas before adding them to the
`DocumentStore`.  This is intended to fix a bug where complex schemas
that include more than one level of cross-file use of `$ref`s are not
being validated correctly.

This commit includes new test cases that reproduce this issue and show
the effectiveness of the proposed fix.

The inspiration for this fix comes from a command included in the
`json_schema` gem.  In that gem, the stand-alone validator command
expands references within schemas before adding them to the store.
It seems reasonable to do the same here.

See https://github.com/brandur/json_schema/blob/20ccb82d7e18140d88ded508edd6c003865c98a0/lib/commands/validate_schema.rb#L92.
seanpdoyle pushed a commit that referenced this issue Feb 15, 2019
This is a fix for #92.

Calls `expand_references!` on loaded schemas before adding them to the
`DocumentStore`.  This is intended to fix a bug where complex schemas
that include more than one level of cross-file use of `$ref`s are not
being validated correctly.

This commit includes new test cases that reproduce this issue and show
the effectiveness of the proposed fix.

The inspiration for this fix comes from a command included in the
`json_schema` gem.  In that gem, the stand-alone validator command
expands references within schemas before adding them to the store.
It seems reasonable to do the same here.

See https://github.com/brandur/json_schema/blob/20ccb82d7e18140d88ded508edd6c003865c98a0/lib/commands/validate_schema.rb#L92.
@seanpdoyle
Copy link
Collaborator

I think this was resolved by #93.

I'm going to close this for now. If it's still an issue, could you say so and I'll reopen it.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants