Skip to content

Add failing test demonstrating missing $dynamicRef support (Draft 2020-12) #323

@Anshikakalpana

Description

@Anshikakalpana

Summary

$dynamicRef is currently not supported in vscode-json-languageservice. This issue tracks incremental progress toward supporting it, starting with a failing test that documents the expected behavior.

This leads to valid Draft 2020-12 schemas being rejected during validation.


Current Behavior

Schemas using $dynamicRef produce the warning:

"The schema uses meta-schema features ($dynamicRef) that are not yet supported by the validator."

Validation does not proceed correctly.


Expected Behavior

For same-schema $dynamicRef (i.e., referencing a $dynamicAnchor within the same schema and without dynamic scope extension), validation should proceed without reporting an unsupported feature.


Minimal Repro

Schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$dynamicAnchor": "node",
  "type": "object",
  "properties": {
    "child": {
      "$dynamicRef": "#node"
    }
  }
}

Data:

{
  "child": {}
}

Root Cause

In jsonSchemaService.ts, $dynamicRef is detected and added to usesUnsupportedFeatures with no attempt to resolve it:

if (next.$dynamicRef) {
    usesUnsupportedFeatures.add('$dynamicRef');
}

Additional Context

I added a failing test demonstrating this behavior — 58 existing tests pass, 1 new test fails due to $dynamicRef being treated as unsupported.


Impact

This affects real-world usage of Draft 2020-12 schemas. Tools using modern JSON Schema features (e.g., MCP integrations) fail validation entirely due to $dynamicRef being unsupported.


Related Issues


Next Steps

I have a failing test ready and have been exploring approaches for resolution. Happy to open a PR and discuss the right direction with maintainers — wanted to check in here first before proceeding.

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