-
-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
option regExp to specify RegExp engine (e.g. re2) #1684
commit 1835f3517ffb750ea4c75ce3ee8d9c262374e8f4 Author: Evgeny Poberezkin <[email protected]> Date: Sat Nov 13 18:04:08 2021 +0000 simplify regExp option commit e7f1eb9 Merge: 98f04d3 f68ef8f Author: Evgeny Poberezkin <[email protected]> Date: Sat Nov 13 17:20:15 2021 +0000 Merge branch 'master' into master commit 98f04d3 Author: Evgeny Poberezkin <[email protected]> Date: Sat Nov 13 17:20:04 2021 +0000 Update docs/options.md commit 0ff99ed Merge: d9ea90c 8fccddb Author: Efe Barlas <[email protected]> Date: Wed Nov 10 00:15:33 2021 -0500 Merge branch 'master' into master commit d9ea90c Author: efebarlas <[email protected]> Date: Wed Nov 10 00:09:17 2021 -0500 prettier:write to pass CI Signed-off-by: efebarlas <[email protected]> commit b29cd91 Merge: f50eb43 20089ed Author: efebarlas <[email protected]> Date: Tue Nov 9 21:54:45 2021 -0500 Merge branch 'master' of github.com:efebarlas/ajv Tests added for code.regExp option commit f50eb43 Author: efebarlas <[email protected]> Date: Tue Nov 9 21:54:28 2021 -0500 Tests added Signed-off-by: efebarlas <[email protected]> commit 20089ed Author: Efe Barlas <[email protected]> Date: Tue Nov 9 21:53:34 2021 -0500 Update options.md commit fd3e290 Merge: 41dd4bc 6ef0c66 Author: Evgeny Poberezkin <[email protected]> Date: Sun Sep 12 19:07:28 2021 +0100 Merge branch 'master' into master commit 41dd4bc Merge: 698f411 a9f38cd Author: Evgeny Poberezkin <[email protected]> Date: Sun Sep 12 11:35:20 2021 +0100 Merge branch 'master' into master commit 698f411 Author: Efe Barlas <[email protected]> Date: Thu Aug 12 14:55:17 2021 -0400 dev-dependency to node-re2 added commit a0720f8 Author: Efe Barlas <[email protected]> Date: Thu Aug 12 14:43:39 2021 -0400 re2 runtime lib + regExp code option added commit 1470c23 Author: Efe Barlas <[email protected]> Date: Fri Jul 9 14:14:45 2021 -0400 variable name changes Signed-off-by: Efe Barlas <[email protected]> commit 8f7ca34 Author: Efe Barlas <[email protected]> Date: Fri Jul 9 13:22:38 2021 -0400 minor changes Signed-off-by: Efe Barlas <[email protected]> commit 9791cce Author: Efe Barlas <[email protected]> Date: Fri Jul 9 13:20:47 2021 -0400 remove comments Signed-off-by: Efe Barlas <[email protected]> commit b07542d Author: Efe Barlas <[email protected]> Date: Fri Jul 9 11:28:29 2021 -0400 added: RE2 Option with fallback Signed-off-by: Efe Barlas <[email protected]> Co-authored-by: Evgeny Poberezkin <[email protected]>
- Loading branch information
1 parent
f68ef8f
commit 8ed855b
Showing
8 changed files
with
76 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as re2 from "re2" | ||
|
||
type Re2 = typeof re2 & {code: string} | ||
;(re2 as Re2).code = 'require("ajv/dist/runtime/re2").default' | ||
|
||
export default re2 as Re2 |
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,33 @@ | ||
import getAjvAllInstances from "../ajv_all_instances" | ||
import {withStandalone} from "../ajv_standalone" | ||
import {_} from "../../dist/compile/codegen/code" | ||
import jsonSchemaTest = require("json-schema-test") | ||
import options from "../ajv_options" | ||
import {afterError, afterEach} from "../after_test" | ||
import chai from "../chai" | ||
import re2 from "../../dist/runtime/re2" | ||
import re2tests from "./re2" | ||
|
||
const instances = getAjvAllInstances(options, { | ||
$data: true, | ||
formats: {allowedUnknown: true}, | ||
strictTypes: false, | ||
strictTuples: false, | ||
}) | ||
|
||
instances.forEach((ajv) => { | ||
ajv.opts.code.source = true | ||
ajv.opts.code.formats = _`{allowedUnknown: true}` | ||
ajv.opts.code.regExp = re2 | ||
}) | ||
|
||
jsonSchemaTest(withStandalone(instances), { | ||
description: "Test with re2 RegExp engine with " + instances.length + " ajv instances", | ||
suites: {"regular expressions": re2tests}, | ||
assert: chai.assert, | ||
afterError, | ||
afterEach, | ||
cwd: __dirname, | ||
hideFolder: "extras/", | ||
timeout: 90000, | ||
}) |
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,4 @@ | ||
export default [ | ||
{name: "$data/format", test: require("../extras/$data/format.json")}, | ||
{name: "$data/pattern", test: require("../extras/$data/pattern.json")}, | ||
] |