Description
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. -
$dynamicRef
s are designed to be evaluated at runtime against data to ensure validity. This means that$dynamicAnchor
s can reside in conditional branches, such asif
/then
/else
. Without data to compare against, there is no way of knowing which anchor to select. -
$dynamicRef
s are transitive. This means that in a situation where:
FileA
has a$ref
toFileB
and the$dynamicAnchor
T
FileB
has a$ref
toFileC
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.