Description
I'm doing a final review of $dynamicAnchor
/$dynamicRef
before release and I think there are a couple places that need some attention.
https://github.com/json-schema-org/json-schema-spec/blob/master/jsonschema-core.xml#L658-L670
Or should this be the schema object at which processing
begins, even if it is not a root? This has some implications
for the case where "$dynamicAnchor" is only allowed in the
root schema but processing begins in a subschema.
This cref doesn't make sense any more. $dynamicAnchor
is not "only allowed in the root schema" as it was with $recursiveRef
. I think that makes this cref moot and can just be removed, but I'd like a second opinion.
https://github.com/json-schema-org/json-schema-spec/blob/master/jsonschema-core.xml#L3597
"$dynamicAnchor": node
=> $dynamicAnchor": "node"
https://github.com/json-schema-org/json-schema-spec/blob/master/jsonschema-core.xml#L1487-L1501
If the initially resolved starting point URI includes a fragment that
was created by the "$dynamicAnchor" keyword, the initial URI MUST be
replaced by the URI (including the fragment) for the outermost schema
resource in the dynamic scope that defines
an identically named fragment with "$dynamicAnchor".
First of all, I apologize profusely for not noticing and bringing this up until only a few days before planed release.
Requiring the "initially resolved starting point" to include a $dynamicAnchor
doesn't make sense for non-recursive use-cases. I'll follow up with an example later. There's a cref describing why this requirement was included, but it doesn't make sense to me.
Requiring both the initial and final URI fragment to be defined
by "$dynamicAnchor" ensures that the more common "$anchor"
never unexpectedly changes the dynamic resolution process
due to a naming conflict across resources. Users of
"$dynamicAnchor" are expected to be aware of the possibility
of such name collisions, while users of "$anchor" are not.
I don't see how an $anchor
can affect dynamic scope resolution. It certainly can't the way I've implemented this feature, so I'm not sure what I'm missing. If someone can explain the potential problem here, maybe we can compare the pros and cons of dropping this requirement so non-recursive use-cases make sense.
I also wouldn't mind an explanation of why the two step resolution process exists. This all seems more complicated than it needs to be. I don't see why it's not simply: $ref
resolves against lexical scope and $dynamicRef
resolves against dynamic scope where the dynamic scope is marked by the outermost $dynamicAnchor
that matches the $dynamicRef
. I thought that's what we had decided on, and again I apologize for not noticing until now that this had gotten written up differently than I thought it had.