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

Add tests for $dynamicRef keyword that contains JSON Pointer #600

Open
flaksp opened this issue Nov 6, 2022 · 4 comments
Open

Add tests for $dynamicRef keyword that contains JSON Pointer #600

flaksp opened this issue Nov 6, 2022 · 4 comments
Labels
enhancement An enhancement to the tooling or structure of the suite (as opposed to a new test). missing test A request to add a test to the suite that is currently not covered elsewhere.

Comments

@flaksp
Copy link
Contributor

flaksp commented Nov 6, 2022

Currently, all tests cover only the case where $dynamicRef contains a plain name fragment, e.g.:

{
  "$dynamicRef": "#items"
}

I believe we need more test cases because the question "what will happen if $dynamicRef will contain something but plain name fragment" seems to be popular from people like me who try to investigate how dynamic scope works. And it's confusing that there are no official examples nor in the spec and in the tests.

@jdesrosiers
Copy link
Member

There are tests for initial resolution.

https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/dynamicRef.json#L259
https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/dynamicRef.json#L311

There should probably be a test for using a JSON Pointer in a dynamic reference. Using a JSON Pointer doesn't make sense for a dynamic reference, but it's not illegal. It would just behave like a normal reference. (FYI, weird edge cases like that are going away in the next release.)

@flaksp
Copy link
Contributor Author

flaksp commented Nov 7, 2022

Oh, sorry, I missed them. I will rename the issue to mention only the JSON Pointer case.

@flaksp flaksp changed the title Add tests for $dynamicRef keyword containing something but plain name fragment Add tests for $dynamicRef keyword that contains JSON Pointer Nov 7, 2022
@Julian
Copy link
Member

Julian commented Nov 8, 2022

Any chance you're interested in a PR @flaksp?

@Julian Julian added missing test A request to add a test to the suite that is currently not covered elsewhere. enhancement An enhancement to the tooling or structure of the suite (as opposed to a new test). labels Nov 8, 2022
@flaksp
Copy link
Contributor Author

flaksp commented Nov 8, 2022

Yeah. I'm learning how all these complicated things work and test cases will be very helpful for me 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to the tooling or structure of the suite (as opposed to a new test). missing test A request to add a test to the suite that is currently not covered elsewhere.
Projects
None yet
Development

No branches or pull requests

3 participants