-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/jsonschema: detect Perl regexps
We want to treat Perl syntax as a missing feature and make genuinely invalid regular expressions an error. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I187be5f8846e02c9af514ec808fa19a8598e41ce Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201127 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
- Loading branch information
Showing
9 changed files
with
93 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Invalid perl syntax should not result in failure when #strictFeatures | ||
isn't enabled. | ||
|
||
-- schema.json -- | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"pattern": "^(?![ \\t\\n]*\\(default(.*)\\))[\\s\\S]*" | ||
} | ||
-- out/decode/extract -- | ||
@jsonschema(schema="https://json-schema.org/draft/2020-12/schema") | ||
_ |
13 changes: 13 additions & 0 deletions
13
encoding/jsonschema/testdata/txtar/perl_pattern_strict.txtar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Invalid perl syntax should result in failure when #strictFeatures | ||
is enabled. | ||
#strictFeatures | ||
|
||
-- schema.json -- | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"pattern": "^(?![ \\t\\n]*\\(default(.*)\\))[\\s\\S]*" | ||
} | ||
-- out/decode/extract -- | ||
ERROR: | ||
unsupported Perl regexp syntax in "^(?![ \\t\\n]*\\(default(.*)\\))[\\s\\S]*": error parsing regexp: invalid or unsupported Perl syntax: `(?!`: | ||
schema.json:3:5 |