json-schema-library 10.2.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/dist/jsonSchemaLibrary.js +1 -1
- package/dist/module/src/SchemaNode.js +3 -3
- package/dist/module/src/compileSchema.js +4 -2
- package/dist/module/src/draft2019-09/keywords/$ref.js +18 -1
- package/dist/module/src/formats/formats.js +4 -1
- package/dist/module/src/keywords/$ref.js +2 -1
- package/dist/module/src/keywords/pattern.js +4 -1
- package/dist/module/src/keywords/patternProperties.js +10 -5
- package/dist/module/src/settings.js +2 -1
- package/dist/src/settings.d.ts +1 -0
- package/package.json +1 -1
- package/src/SchemaNode.ts +3 -3
- package/src/compileSchema.ts +6 -3
- package/src/draft2019-09/keywords/$ref.ts +20 -1
- package/src/formats/formats.ts +3 -1
- package/src/keywords/$ref.ts +2 -1
- package/src/keywords/pattern.ts +4 -1
- package/src/keywords/patternProperties.ts +5 -1
- package/src/settings.ts +2 -1
package/README.md
CHANGED
|
@@ -561,7 +561,7 @@ const data = compileSchema({
|
|
|
561
561
|
console.log(data); // {}
|
|
562
562
|
```
|
|
563
563
|
|
|
564
|
-
|
|
564
|
+
**Note** object and array-properties will still be added if required:
|
|
565
565
|
|
|
566
566
|
```ts
|
|
567
567
|
const data = compileSchema({
|
|
@@ -571,7 +571,7 @@ const data = compileSchema({
|
|
|
571
571
|
console.log(data); // { valid: {} }
|
|
572
572
|
```
|
|
573
573
|
|
|
574
|
-
|
|
574
|
+
**Note** enforced array-items will be `undefined` if required and `initialValues: false`
|
|
575
575
|
|
|
576
576
|
```ts
|
|
577
577
|
const data = compileSchema({
|
|
@@ -1336,8 +1336,38 @@ const { errors } = compileSchema({
|
|
|
1336
1336
|
assert.deepEqual(errors[0].message, "Custom error 2");
|
|
1337
1337
|
```
|
|
1338
1338
|
|
|
1339
|
+
### regexFlags
|
|
1340
|
+
|
|
1341
|
+
In order to allow customization of regular expressions a schema property `regexFlags` is supported for `pattern`, `patternProperties` and format `regex`:
|
|
1342
|
+
|
|
1343
|
+
```ts
|
|
1344
|
+
const { errors } = compileSchema({
|
|
1345
|
+
type: "string",
|
|
1346
|
+
pattern: "^[a-zA-Z0-9+_.-]+",
|
|
1347
|
+
regexFlags: "v"
|
|
1348
|
+
}).validate("-");
|
|
1349
|
+
```
|
|
1350
|
+
|
|
1351
|
+
Per default, a regexFlags `"u"` is used. To change this setting globally, change `REGEX_FLAGS` in settings:
|
|
1352
|
+
|
|
1353
|
+
```ts
|
|
1354
|
+
import settings from "json-schema-library";
|
|
1355
|
+
|
|
1356
|
+
settings.REGEX_FLAGS = "v";
|
|
1357
|
+
```
|
|
1358
|
+
|
|
1339
1359
|
## Breaking Changes
|
|
1340
1360
|
|
|
1361
|
+
### v10.3.0
|
|
1362
|
+
|
|
1363
|
+
- introduce setting `REGEX_FLAGS` and schema-property `regexFlags` to customize regex flags to use evaluating regex
|
|
1364
|
+
- fixed an issue resolving non-URI compatible $ref-targets containing `#/definitions`
|
|
1365
|
+
|
|
1366
|
+
### v10.2.0
|
|
1367
|
+
|
|
1368
|
+
- introduce getData setting `useTypeDefaults`
|
|
1369
|
+
- introduce support to merge meta-properties using $ref-resolution
|
|
1370
|
+
|
|
1341
1371
|
### v10.1.0
|
|
1342
1372
|
|
|
1343
1373
|
- replaced `node.additionalItems` by `node.items` for drafts below 2020-12
|