Skip to content

$dynamicRef behavior when there is no URI with the same fragment in the dynamic scope #1151

Closed
@yakimun

Description

@yakimun

https://json-schema.org/draft/2020-12/json-schema-core.html#dynamic-ref

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".

Otherwise, its behavior is identical to "$ref", and no runtime resolution is needed.

{
  "$dynamicRef": "#foo",
  "$defs": {
    "a": {
      "$dynamicAnchor": "foo"
    }
  }
}

In this example, the initially resolved starting point URI of $dynamicRef includes a fragment that was created by the $dynamicAnchor, but when we try to find "the outermost schema resource in the dynamic scope that defines an identically named fragment with $dynamicAnchor", we are not able to find anything.

What should an implementation do in this situation? Should behavior be identical to $ref, or maybe it's undefined behavior, and implementation could raise an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions