-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Environment
- CLI version:
jsonschema --version→ 14.12.0 - Node version: (output of
node --version) - OS: Linux (WSL Ubuntu)
Summary
Running:
jsonschema lint --fix schema.jsonfails with:
error: Could not autofix the schema without breaking its internal references
at location "/patternProperties/^~1~1.*/$ref"
The tool aborts safely, but the auto-fix does not complete.
Minimal Reproducible Example
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$defs": {
"foo": { "description": "ignored" }
},
"type": "object",
"patternProperties": {
"^//.*": { "$ref": "#/$defs/foo" }
}
}Then:
jsonschema lint --fix schema.jsonObserved error:
Could not autofix the schema without breaking its internal references
at location "/patternProperties/^~1~1.*/$ref"
Observations
-
The
patternPropertieskey contains/. -
In JSON Pointer encoding,
^//.*becomes^~1~1.*. -
The reported failure location:
/patternProperties/^~1~1.*/$refcorrectly maps to that key.
The error location suggests the fixer's JSON Pointer decoder/encoder fails to correctly handle the tilde-escaped path when reconstructing updated $ref values during the $defs → definitions rewrite.
Flattening $defs or removing / from the pattern key avoids the failure.
Question
Is this:
- A known limitation of pointer reconstruction during auto-fix?
- An edge case in handling escaped JSON Pointer segments?
- Expected conservative behavior for certain graph rewrites?
If useful, I can provide additional test cases.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels