Skip to content

Commit 75cb889

Browse files
committed
publish: bump version to v10.3.0
1 parent e5fc668 commit 75cb889

File tree

8 files changed

+27
-12
lines changed

8 files changed

+27
-12
lines changed

dist/jsonSchemaLibrary.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/module/src/SchemaNode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { validateNode } from "./validateNode";
1515
import { hasProperty } from "./utils/hasProperty";
1616
import { getNode } from "./getNode";
1717
import { getNodeChild } from "./getNodeChild";
18-
const { DYNAMIC_PROPERTIES } = settings;
18+
const { DYNAMIC_PROPERTIES, REGEX_FLAGS } = settings;
1919
export function isSchemaNode(value) {
2020
return isObject(value) && Array.isArray(value === null || value === void 0 ? void 0 : value.reducers) && Array.isArray(value === null || value === void 0 ? void 0 : value.resolvers);
2121
}
@@ -36,7 +36,7 @@ function getDraft(drafts, $schema) {
3636
if (drafts.length === 1) {
3737
return drafts[0];
3838
}
39-
return (_a = drafts.find((d) => new RegExp(d.$schemaRegEx).test($schema))) !== null && _a !== void 0 ? _a : drafts[drafts.length - 1];
39+
return (_a = drafts.find((d) => new RegExp(d.$schemaRegEx, REGEX_FLAGS).test($schema))) !== null && _a !== void 0 ? _a : drafts[drafts.length - 1];
4040
}
4141
export function joinDynamicId(a, b) {
4242
if (a == b) {

dist/module/src/compileSchema.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import { draft2019 } from "./draft2019";
77
import { draft2020 } from "./draft2020";
88
import { pick } from "./utils/pick";
99
import { SchemaNodeMethods, addKeywords, isSchemaNode } from "./SchemaNode";
10+
import settings from "./settings";
11+
const { REGEX_FLAGS } = settings;
1012
const defaultDrafts = [draft04, draft06, draft07, draft2019, draft2020];
1113
function getDraft(drafts, $schema) {
1214
var _a;
13-
return (_a = drafts.find((d) => new RegExp(d.$schemaRegEx).test($schema))) !== null && _a !== void 0 ? _a : drafts[drafts.length - 1];
15+
return (_a = drafts.find((d) => new RegExp(d.$schemaRegEx, REGEX_FLAGS).test($schema))) !== null && _a !== void 0 ? _a : drafts[drafts.length - 1];
1416
}
1517
/**
1618
* With compileSchema we replace the schema and all sub-schemas with a schemaNode,

dist/module/src/formats/formats.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import { getTypeOf } from "../utils/getTypeOf";
33
import validUrl from "valid-url";
44
import { parse as parseIdnEmail } from "smtp-address-parser";
5+
import settings from "../settings";
6+
const { REGEX_FLAGS } = settings;
57
const isValidIPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
68
const isValidIPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
79
const isValidHostname = /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/;
@@ -182,6 +184,7 @@ export const formats = {
182184
return node.createError("format-json-pointer-error", { value: data, pointer, schema });
183185
},
184186
regex: ({ node, pointer, data }) => {
187+
var _a;
185188
const { schema } = node;
186189
if (typeof data === "object" ||
187190
typeof data === "number" ||
@@ -191,7 +194,7 @@ export const formats = {
191194
}
192195
if (typeof data === "string" && /\\Z$/.test(data) === false) {
193196
try {
194-
new RegExp(data, "u");
197+
new RegExp(data, (_a = schema.regexFlags) !== null && _a !== void 0 ? _a : REGEX_FLAGS);
195198
return undefined;
196199
}
197200
catch (e) { } // eslint-disable-line no-empty

dist/module/src/keywords/pattern.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
import settings from "../settings";
2+
const { REGEX_FLAGS } = settings;
13
export const patternKeyword = {
24
id: "pattern",
35
keyword: "pattern",
46
addValidate: ({ schema }) => typeof schema.pattern === "string",
57
validate: validatePattern
68
};
79
function validatePattern({ node, data, pointer = "#" }) {
10+
var _a;
811
const { schema } = node;
912
if (typeof data !== "string") {
1013
return;
1114
}
12-
const pattern = new RegExp(schema.pattern, "u");
15+
const pattern = new RegExp(schema.pattern, (_a = schema.regexFlags) !== null && _a !== void 0 ? _a : REGEX_FLAGS);
1316
if (pattern.test(data) === false) {
1417
return node.createError("pattern-error", {
1518
pattern: schema.pattern,

dist/module/src/keywords/patternProperties.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { mergeSchema } from "../utils/mergeSchema";
22
import { isObject } from "../utils/isObject";
33
import { getValue } from "../utils/getValue";
44
import { validateNode } from "../validateNode";
5+
import settings from "../settings";
6+
const { REGEX_FLAGS } = settings;
57
export const patternPropertiesKeyword = {
68
id: "patternProperties",
79
keyword: "patternProperties",
@@ -22,11 +24,14 @@ export function parsePatternProperties(node) {
2224
if (patterns.length === 0) {
2325
return;
2426
}
25-
node.patternProperties = patterns.map((pattern) => ({
26-
name: pattern,
27-
pattern: new RegExp(pattern, "u"),
28-
node: node.compileSchema(schema.patternProperties[pattern], `${node.evaluationPath}/patternProperties/${pattern}`, `${node.schemaLocation}/patternProperties/${pattern}`)
29-
}));
27+
node.patternProperties = patterns.map((pattern) => {
28+
var _a;
29+
return ({
30+
name: pattern,
31+
pattern: new RegExp(pattern, (_a = schema.regexFlags) !== null && _a !== void 0 ? _a : REGEX_FLAGS),
32+
node: node.compileSchema(schema.patternProperties[pattern], `${node.evaluationPath}/patternProperties/${pattern}`, `${node.schemaLocation}/patternProperties/${pattern}`)
33+
});
34+
});
3035
}
3136
function patternPropertyResolver({ node, key }) {
3237
var _a, _b;

dist/module/src/settings.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export default {
1515
"definitions",
1616
"dependencies",
1717
"patternProperties"
18-
]
18+
],
19+
REGEX_FLAGS: "u"
1920
};

dist/src/settings.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ declare const _default: {
22
DECLARATOR_ONEOF: string;
33
propertyBlacklist: string[];
44
DYNAMIC_PROPERTIES: string[];
5+
REGEX_FLAGS: string;
56
};
67
export default _default;

0 commit comments

Comments
 (0)