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

$dynamicRef / $dynamicAnchor resolution #10

Open
chanced opened this issue Sep 22, 2022 · 0 comments
Open

$dynamicRef / $dynamicAnchor resolution #10

chanced opened this issue Sep 22, 2022 · 0 comments

Comments

@chanced
Copy link
Owner

chanced commented Sep 22, 2022

Currently $dynamicRef does not override with the dynamic resolution. There are three issues at play:

  1. When loading a document, all nodes are parsed once and referenced when later encountered in $ref, $dynamicRef, $recursiveRef. This is fine for $ref except when the referenced schema has a $dynamicRef or $recursiveRef. In which case, those references need to be replaced with the schema containing the $dynamicAnchor. Currently, if the schema containing $dynamicRef were updated to the reflect the new $dynamicAnchor then it would happen across the application.

  2. $dynamicRefs are designed to be evaluated at runtime against data to ensure validity. This means that $dynamicAnchors can reside in conditional branches, such as if/then/else. Without data to compare against, there is no way of knowing which anchor to select.

  3. $dynamicRefs are transitive. This means that in a situation where:

    FileA has a $ref to FileB and the $dynamicAnchor T
    FileB has a $ref to FileC
    FileC has a $dynamicRef #T

In order to solve dynamic overlay, after the document is loaded and resolved, every schema is going to need to be cloned and reassigned. Use a map of AbsoluteLocation of the SchemaRef to ensure that a reference hasn't been visited in the cloning process.

I have no idea how to solve conditional/dynamic resolution.

The solution to the third depends on how the second is solved.

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

1 participant