You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: propertyNames validation errors show "Invalid JSON Pointer" on $schema instead of the offending key #151
When a schema uses propertyNames and a document has a key that fails it, the real error never shows up. Instead, the server reports "Invalid JSON Pointer" on the $schema line of the document, which is confusing because nothing is wrong with $schema.
Where it happens
src/features/diagnostics/SchemaValidationDiagnosticsProvider.ts: the validation error's instanceLocation is turned into a pointer with:
For propertyNames failures, the location seems to look like #*/123, so after slice(1) the pointer is */123. That isn't a valid JSON Pointer (it doesn't start with /), so findNodeAtPointer throws. The surrounding catch then attaches the exception message to /$schema.
The file also seems to have a toPointer helper that strips the leading *, but this line doesn't use it.
A diagnostic on the "123" key saying it doesn't match the pattern ^[a-z]+$.
Actual behavior
No diagnostic on "123". Instead there's an error on "./schema.json" with the message Invalid JSON Pointer.
How I checked
I found this while reviewing the code with an AI coding agent (Antigravity with
Gemini), then confirmed it myself. Opening doc.json with the schema above
shows "Invalid JSON Pointer" on the $schema line and nothing on "123".
Logging error.instanceLocation gives <paste what you actually saw>.
Suggested fix
When the error location starts with #*, strip the *, find the property node, and attach the diagnostic to the property's key node instead of letting the pointer lookup throw. Reusing the existing toPointer helper may be enough. I'd add tests for:
a key failing propertyNames produces a diagnostic on that key
the diagnostic is not reported on $schema
a document whose keys all pass propertyNames produces no diagnostics
Something else to flag
PR #148 (don't crash when $schema is an invalid IRI) touches nearby code, so I'm happy to rebase on it or wait for it to merge.
Impact
Medium - Feature works but has issues
I'd be glad to open a PR for this if that works for you. Thanks!
I have searched existing issues to avoid duplicates
Activity
tarunagnihotri534 commentedon Oct 11, 2026
happy to work on this
srivastava-diya commentedon Oct 11, 2026
Hi! It's a request that please don't raise a PR until someone validates your issue and assigns it to you. Thanks.
tarunagnihotri534 commentedon Oct 11, 2026
really sorry for this, i got this @srivastava-diya
srivastava-diya commentedon Oct 11, 2026
This part was left as a placeholder, so i wonder if you've actually run it?
srivastava-diya commentedon Oct 11, 2026
I tried your example and the bug is present, the only diagnostic is "Invalid JSON Pointer" on the
$schemavalue, and nothing shows on"123".I see you had already opened #153, so @jdesrosiers can decide whether to take it from that PR.