z-schema 7.0.8 → 7.1.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 +16 -0
- package/cjs/index.js +127 -1016
- package/dist/json-validation.js +8 -1
- package/dist/report.js +1 -1
- package/dist/schema-validator.js +10 -10
- package/dist/types/utils/json.d.ts +1 -0
- package/dist/types/utils/schema-regex.d.ts +10 -0
- package/dist/utils/json.js +6 -0
- package/dist/utils/schema-regex.js +39 -0
- package/dist/z-schema.js +1 -1
- package/package.json +3 -5
- package/src/json-validation.ts +8 -1
- package/src/report.ts +1 -1
- package/src/schema-validator.ts +10 -8
- package/src/utils/json.ts +7 -0
- package/src/utils/schema-regex.ts +39 -0
- package/src/z-schema.ts +1 -1
- package/umd/ZSchema.js +12860 -13749
- package/umd/ZSchema.min.js +1 -1
package/README.md
CHANGED
|
@@ -142,6 +142,7 @@ ZSchema.setSchemaReader(function (uri) {
|
|
|
142
142
|
- [Turn on z-schema strict mode](#strictmode)
|
|
143
143
|
- [Set validator to collect as many errors as possible](#breakonfirsterror)
|
|
144
144
|
- [Report paths in errors as arrays so they can be processed easier](#reportpathasarray)
|
|
145
|
+
- [Unicode Property Escapes Support](#unicode-property-escapes-support)
|
|
145
146
|
|
|
146
147
|
### Validate against subschema
|
|
147
148
|
|
|
@@ -254,6 +255,21 @@ validator.validate(data, schema);
|
|
|
254
255
|
// data.hello === "world"
|
|
255
256
|
```
|
|
256
257
|
|
|
258
|
+
### Unicode Property Escapes Support
|
|
259
|
+
|
|
260
|
+
Fully supports [Unicode property escapes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Unicode_property_escapes) in JSON Schema `pattern` values (e.g., `/\p{L}/u`). This allows you to write patterns that match Unicode character properties, such as letters, numbers, or scripts, provided your JavaScript environment supports them (Node.js ≥ 10, all modern browsers).
|
|
261
|
+
|
|
262
|
+
**Example:**
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"type": "string",
|
|
267
|
+
"pattern": "^\\p{L}+$" // matches only Unicode letters
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
z-schema will automatically use the `u` (Unicode) flag for all patterns containing Unicode property escapes, both in Node.js and browser environments. If your environment does not support Unicode property escapes, such patterns will be reported as invalid.
|
|
272
|
+
|
|
257
273
|
## Options
|
|
258
274
|
|
|
259
275
|
### asyncTimeout
|