Skip to content

$dynamicRef / $dynamicAnchor resolution #10

Open
@chanced

Description

@chanced

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions