eclipse-vertx / eclipse-vertx/vertx-json-schema

$dynamicRef does not implement 2020-12 dynamic scope semantics (7 core TCK tests skipped)

Open
#158 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
86
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Version

5.2.0-SNAPSHOT (master), affects 5.x releases as well

### Context

Seven **core** (non-optional) `draft2020-12/dynamicRef` tests from the official test suite have been listed in `unsupported-tck-tests.properties` since 2022. Unlike the rest of that file (format-as-annotation, ECMA regex, idn-hostname — genuinely optional features), these mask real `$dynamicRef` conformance bugs in `SchemaValidatorImpl`:

1. **Dynamic scope is never left.** `$dynamicAnchor`s pushed into `dynamicContext` are only popped at the end of a full `validate` pass — the `$ref`/draft-4/7 early-return paths skip the pop, so anchors from sibling scopes stay resolvable ("after leaving a dynamic scope, it should not be used by a $dynamicRef").
2. **No fallback to `$ref` semantics.** A `$dynamicRef` whose target anchor is a plain `$anchor`, or with no matching `$dynamicAnchor` yet encountered, is silently ignored instead of behaving like a normal `$ref` ("A $dynamicRef to an $anchor in the same schema resource should behave like a normal $ref to an $anchor").
3. **Resolution is encounter-based, not resource-based.** The spec resolves to the first schema *resource* in the dynamic scope defining a matching `$dynamicAnchor`, whether or not evaluation visited the anchored subschema; the implementation only considers anchors whose subschema was visited ("The recursive part is not valid against the root", "first_scope is not in dynamic scope").

### Steps to reproduce

Remove the `draft2020-12/dynamicRef` entries from `src/test/resources/unsupported-tck-tests.properties` and run `TCKTest`: 7 failures.

### Do you have a reproducer?

Yes — the official test suite itself; PR incoming that fixes the implementation and un-skips the tests.

Contributor guide

Open the contributing guide

Research direction

Start with SchemaValidatorImpl and the seven draft2020-12/dynamicRef cases listed in src/test/resources/unsupported-tck-tests.properties. Remove those entries locally and run TCKTest to observe the failures, then trace dynamicContext handling, $dynamicRef fallback, and resource-based resolution. Done means the seven core tests pass without masking the failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.