Skip to content

Report contains sub-errors at the failing item's location - #154

Merged
pk-work merged 1 commit into
eclipse-vertx:masterfrom
SiteNetSoft:fix-contains-instance-location
Aug 9, 2026
Merged

Report contains sub-errors at the failing item's location#154
pk-work merged 1 commit into
eclipse-vertx:masterfrom
SiteNetSoft:fix-contains-instance-location

Conversation

@jnbdz

@jnbdz jnbdz commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #153

Motivation

The contains validation loop iterates with its own variable j but built the sub-error instance location from the enclosing scope's i — the index where prefixItems/items processing stopped, which is 0 when those keywords are absent. Every failing element was therefore reported at the same wrong location: validating [1, 2] against {"contains": {"type": "string"}, "minContains": 1} reported both per-item type errors at #/0.

Changes

Build the location from j. Added a regression test asserting each failing item is reported at its own location (#/0 and #/1).

Note: #152 touches the neighboring lines of the same loop (behavior-preserving hoist); whichever merges second will have a trivial conflict — happy to rebase either.

@pk-work

pk-work commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@jnbdz could you rebase the PR? Then I will merge it. Thank you very much

The contains loop iterates with j but built the sub-error instance
location from the enclosing i, which points at the index where
prefixItems/items processing stopped (0 when absent). Every failing
item was therefore reported at the same wrong location.

Fixes eclipse-vertx#153
@jnbdz
jnbdz force-pushed the fix-contains-instance-location branch from d647ea9 to 5f0f634 Compare August 9, 2026 17:14
@jnbdz

jnbdz commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@pk-work rebased onto master, conflicts with #150 resolved. Thanks!

@pk-work
pk-work merged commit 2fa4b3d into eclipse-vertx:master Aug 9, 2026
5 checks passed
@pk-work

pk-work commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Thank you very much

@jnbdz

jnbdz commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@pk-work should the branch be deleted?

@pk-work

pk-work commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@jnbdz ? I guess it's a branch on your fork. So you can decide.

@jnbdz
jnbdz deleted the fix-contains-instance-location branch August 13, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

contains sub-errors report the wrong instanceLocation

2 participants