Currently $dynamicRef does not override with the dynamic resolution. There are three issues at play:
-
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.
-
$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.
-
$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.
Currently
$dynamicRefdoes not override with the dynamic resolution. There are three issues at play:When loading a document, all nodes are parsed once and referenced when later encountered in
$ref,$dynamicRef,$recursiveRef. This is fine for$refexcept when the referenced schema has a$dynamicRefor$recursiveRef. In which case, those references need to be replaced with the schema containing the$dynamicAnchor. Currently, if the schema containing$dynamicRefwere updated to the reflect the new$dynamicAnchorthen it would happen across the application.$dynamicRefs are designed to be evaluated at runtime against data to ensure validity. This means that$dynamicAnchors can reside in conditional branches, such asif/then/else. Without data to compare against, there is no way of knowing which anchor to select.$dynamicRefs are transitive. This means that in a situation where:FileAhas a$reftoFileBand the$dynamicAnchorTFileBhas a$reftoFileCFileChas a$dynamicRef#TIn 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
AbsoluteLocationof theSchemaRefto 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.