z-schema 9.0.0 → 10.0.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.
Files changed (60) hide show
  1. package/README.md +127 -155
  2. package/bin/z-schema +4 -2
  3. package/cjs/index.d.ts +40 -9
  4. package/cjs/index.js +4842 -3990
  5. package/dist/errors.js +5 -0
  6. package/dist/format-validators.js +65 -0
  7. package/dist/json-schema-versions.js +5 -0
  8. package/dist/json-schema.js +11 -4
  9. package/dist/json-validation.js +174 -13
  10. package/dist/report.js +12 -3
  11. package/dist/schema-cache.js +23 -2
  12. package/dist/schema-compiler.js +29 -13
  13. package/dist/schema-validator.js +66 -45
  14. package/dist/schemas/draft-06-hyper-schema.json +132 -0
  15. package/dist/schemas/draft-06-links.json +43 -0
  16. package/dist/schemas/draft-06-schema.json +155 -0
  17. package/dist/types/errors.d.ts +4 -0
  18. package/dist/types/index.d.ts +2 -1
  19. package/dist/types/json-schema-versions.d.ts +23 -0
  20. package/dist/types/json-schema.d.ts +5 -9
  21. package/dist/types/json-validation.d.ts +3 -3
  22. package/dist/types/report.d.ts +10 -3
  23. package/dist/types/schema-cache.d.ts +1 -1
  24. package/dist/types/schema-compiler.d.ts +1 -1
  25. package/dist/types/schema-validator.d.ts +1 -1
  26. package/dist/types/utils/what-is.d.ts +1 -0
  27. package/dist/types/z-schema-base.d.ts +1 -1
  28. package/dist/types/z-schema-options.d.ts +1 -1
  29. package/dist/types/z-schema-reader.d.ts +1 -1
  30. package/dist/types/z-schema-versions.d.ts +1 -0
  31. package/dist/types/z-schema.d.ts +10 -1
  32. package/dist/utils/schema-regex.js +4 -3
  33. package/dist/utils/what-is.js +4 -1
  34. package/dist/z-schema-base.js +7 -5
  35. package/dist/z-schema-options.js +3 -1
  36. package/dist/z-schema-versions.js +27 -0
  37. package/dist/z-schema.js +24 -7
  38. package/package.json +2 -2
  39. package/src/errors.ts +6 -0
  40. package/src/format-validators.ts +65 -0
  41. package/src/index.ts +2 -1
  42. package/src/json-schema-versions.ts +34 -0
  43. package/src/json-schema.ts +22 -16
  44. package/src/json-validation.ts +205 -16
  45. package/src/report.ts +21 -6
  46. package/src/schema-cache.ts +25 -3
  47. package/src/schema-compiler.ts +29 -14
  48. package/src/schema-validator.ts +128 -62
  49. package/src/schemas/draft-06-hyper-schema.json +133 -0
  50. package/src/schemas/draft-06-links.json +43 -0
  51. package/src/schemas/draft-06-schema.json +155 -0
  52. package/src/utils/schema-regex.ts +5 -3
  53. package/src/utils/what-is.ts +5 -1
  54. package/src/z-schema-base.ts +9 -6
  55. package/src/z-schema-options.ts +3 -2
  56. package/src/z-schema-reader.ts +1 -1
  57. package/src/z-schema-versions.ts +38 -0
  58. package/src/z-schema.ts +31 -11
  59. package/umd/ZSchema.js +5100 -4248
  60. package/umd/ZSchema.min.js +1 -1
package/README.md CHANGED
@@ -1,241 +1,213 @@
1
- # z-schema - a JSON Schema validator
1
+ # z-schema
2
+
3
+ JSON Schema validator for Node.js and browsers. Supports **draft-04** and **draft-06** (default).
2
4
 
3
5
  [![NPM](https://nodei.co/npm/z-schema.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/z-schema)
4
6
 
5
7
  [![Coverage Status](https://coveralls.io/repos/github/zaggino/z-schema/badge.svg?branch=main)](https://coveralls.io/github/zaggino/z-schema?branch=main)
6
8
 
7
- ## Topics
8
-
9
- - [What](#what)
10
- - [Versions](#versions)
11
- - [Getting started](#getting-started)
12
- - [Usage](#usage)
13
- - [Features](#features)
14
- - [Options](#options)
15
- - [Contributing](#contributing)
16
- - [Contributors](#contributors)
17
-
18
- ## What
19
-
20
- What is a JSON Schema? Find here: [https://json-schema.org/](https://json-schema.org/)
9
+ ## Install
21
10
 
22
- ## Versions
23
-
24
- - v6 - old version which has been around a long time, supports JSON Schema draft-04
25
- - v7 - modernized version (to ESM module with Typescript) which passes all tests from JSON Schema Test Suite for draft-04
26
- - v8 - by default assumes all schemas without $schema tag are draft-04, the old behaviour from v7 can be explicitly turned on by specifying `validator = ZSchema.create({ version: 'none' });`
27
- - v9 - new api, `new ZSchema()` replaced by `ZSchema.create()` for initialization
11
+ ```bash
12
+ npm install z-schema
13
+ ```
28
14
 
29
- ## Getting started
15
+ Requires **Node.js 22** or later.
30
16
 
31
- Validator will try to perform sync validation when possible for speed, but supports async callbacks when they are necessary.
17
+ ## Quick Start
32
18
 
33
- ### ESM and Typescript:
19
+ ### ESM / TypeScript
34
20
 
35
21
  ```typescript
36
22
  import ZSchema from 'z-schema';
23
+
37
24
  const validator = ZSchema.create();
25
+
26
+ try {
27
+ validator.validate({ name: 'Alice' }, { type: 'object', properties: { name: { type: 'string' } } });
28
+ console.log('Valid');
29
+ } catch (error) {
30
+ console.log('Invalid:', error.details);
31
+ }
38
32
  ```
39
33
 
40
- ### CommonJs:
34
+ ### CommonJS
41
35
 
42
36
  ```javascript
43
37
  const ZSchema = require('z-schema');
44
38
  const validator = ZSchema.create();
45
39
  ```
46
40
 
47
- ### Browser:
41
+ ### Browser (UMD)
48
42
 
49
43
  ```html
50
- <script type="text/javascript" src="z-schema/umd/ZSchema.min.js"></script>
51
- <script type="text/javascript">
52
- var validator = ZSchema.create();
44
+ <script src="z-schema/umd/ZSchema.min.js"></script>
45
+ <script>
46
+ const validator = ZSchema.create();
53
47
  try {
54
- validator.validate('string', { type: 'string' });
55
- console.log('Validation passed');
48
+ validator.validate('hello', { type: 'string' });
56
49
  } catch (error) {
57
- console.log('Validation failed:', error.details);
50
+ console.log(error.details);
58
51
  }
59
52
  </script>
60
53
  ```
61
54
 
62
- ### CLI:
55
+ ### CLI
63
56
 
64
57
  ```bash
65
58
  npm install --global z-schema
66
- z-schema --help
67
59
  z-schema mySchema.json
68
- z-schema mySchema.json myJson.json
69
- z-schema --strictMode mySchema.json myJson.json
60
+ z-schema mySchema.json myData.json
61
+ z-schema --strictMode mySchema.json myData.json
70
62
  ```
71
63
 
72
64
  ## Usage
73
65
 
74
- ### Sync mode:
66
+ ### Sync Validation (Throw Mode)
67
+
68
+ By default, `validate` throws a `ValidateError` on failure. The error has a `details` array with structured error info.
69
+
70
+ ```typescript
71
+ const validator = ZSchema.create();
75
72
 
76
- ```javascript
77
73
  try {
78
74
  validator.validate(json, schema);
79
- // validation passed
80
75
  } catch (error) {
81
- // this will return a native error object with name and message
82
76
  console.log(error.name); // 'z-schema validation error'
83
- console.log(error.message); // common error message
84
- // this will return an array of validation errors encountered
85
- console.log(error.details); // array of detailed errors
77
+ console.log(error.message); // summary message
78
+ console.log(error.details); // array of { code, message, path, ... }
86
79
  }
80
+ ```
81
+
82
+ ### Sync Validation (Safe Mode)
87
83
 
88
- // Or use validateSafe for object-based result
89
- const result = validator.validateSafe(json, schema);
84
+ Use `ZSchema.create({ safe: true })` to get a result object instead of exceptions.
85
+
86
+ ```typescript
87
+ const validator = ZSchema.create({ safe: true });
88
+
89
+ const result = validator.validate(json, schema);
90
90
  if (!result.valid) {
91
- console.log(result.errs); // array of error objects
91
+ console.log(result.err); // ValidateError with .details
92
92
  }
93
-
94
- ...
95
93
  ```
96
94
 
97
- ### Async validation:
95
+ ### Async Validation
98
96
 
99
- ZSchema supports custom format validators that can perform both synchronous and asynchronous validation. This example shows how to validate a person payload with:
100
-
101
- - **Async validation**: User ID against a database
102
- - **Async validation**: Postcode against an external service
103
- - **Sync validation**: Phone number format
97
+ Pass `{ async: true }` to support async format validators. The `validate` method returns a Promise.
104
98
 
105
99
  ```typescript
106
- import ZSchema from 'z-schema';
107
- import db from './db';
108
-
109
- // Initialize ZSchema
110
- const validator = ZSchema.create();
111
-
112
- // Register async and sync format validators
113
- validator.registerFormat('user-exists', async (input: unknown): Promise<boolean> => {
114
- if (typeof input !== 'number') return false;
115
- const user = await db.getUserById(input);
116
- return user != null;
117
- });
118
- validator.registerFormat('valid-postcode', async (input: unknown): Promise<boolean> => {
119
- if (typeof input !== 'string') return false;
120
- const postcode = await db.getPostcode(input);
121
- return postcode != null;
122
- });
123
- validator.registerFormat('phone-number', (input: unknown): boolean => {
124
- if (typeof input !== 'string') return false;
125
- const phoneRegex = /^\+?[1-9]\d{1,14}$/;
126
- return phoneRegex.test(input);
127
- });
100
+ const validator = ZSchema.create({ async: true });
128
101
 
129
- // Define the JSON Schema
130
- const personSchema = {
131
- $schema: 'http://json-schema.org/draft-04/schema#',
132
- type: 'object',
133
- required: ['personId', 'address'],
134
- properties: {
135
- personId: {
136
- type: 'number',
137
- format: 'user-exists',
138
- },
139
- address: {
140
- type: 'object',
141
- required: ['postcode', 'phone'],
142
- properties: {
143
- postcode: {
144
- type: 'string',
145
- format: 'valid-postcode',
146
- },
147
- phone: {
148
- type: 'string',
149
- format: 'phone-number',
150
- },
151
- },
152
- },
153
- },
154
- };
155
-
156
- // Example payload
157
- const payload = {
158
- personId: 'user123',
159
- address: {
160
- postcode: 'SW1A 1AA',
161
- phone: '+441234567890',
162
- },
163
- };
164
-
165
- // Validate asynchronously
166
102
  try {
167
- const validator = ZSchema.create({ async: true });
168
- await validator.validate(payload, personSchema);
169
- console.log('✅ Validation successful!');
170
- } catch (err) {
171
- console.log('❌ Validation failed:', err);
103
+ await validator.validate(json, schema);
104
+ } catch (error) {
105
+ console.log(error.details);
172
106
  }
173
107
 
174
- // or validate without try-catch
175
- const validator = ZSchema.create({ async: true, safe: true });
176
- const res = await validator.validate(payload, personSchema);
177
- if (res.valid) {
178
- console.log('✅ Validation successful!');
179
- } else {
180
- console.log('❌ Validation failed:', res.err);
108
+ // Or combine with safe mode:
109
+ const safeValidator = ZSchema.create({ async: true, safe: true });
110
+ const result = await safeValidator.validate(json, schema);
111
+ if (!result.valid) {
112
+ console.log(result.err);
181
113
  }
182
114
  ```
183
115
 
184
- ### Remote references and schemas:
116
+ ### Schema Compilation
185
117
 
186
- In case you have some remote references in your schemas, you have to download those schemas before using validator.
187
- Otherwise you'll get `UNRESOLVABLE_REFERENCE` error when trying to compile a schema.
118
+ Pre-compile schemas at startup to validate `$ref` references and cache compiled schemas.
188
119
 
189
- ```javascript
190
- var validator = ZSchema.create();
191
- var json = {};
192
- var schema = { "$ref": "http://json-schema.org/draft-04/schema#" };
120
+ ```typescript
121
+ const validator = ZSchema.create();
122
+
123
+ const schemas = [
124
+ { id: 'person', type: 'object', properties: { name: { type: 'string' } }, required: ['name'] },
125
+ { id: 'team', type: 'object', properties: { lead: { $ref: 'person' } } },
126
+ ];
193
127
 
194
128
  try {
195
- validator.validate(json, schema);
196
- // This won't reach here due to unresolvable reference
129
+ validator.validateSchema(schemas);
197
130
  } catch (error) {
198
- // error.details will contain the validation errors
199
- console.log(error.details[0].code); // "UNRESOLVABLE_REFERENCE"
131
+ console.log('Schema errors:', error.details);
200
132
  }
133
+ ```
201
134
 
202
- var requiredUrl = "http://json-schema.org/draft-04/schema";
203
- request(requiredUrl, function (error, response, body) {
135
+ ### Custom Format Validators
204
136
 
205
- validator.setRemoteReference(requiredUrl, JSON.parse(body));
137
+ Register custom format validators for sync or async checks.
206
138
 
207
- try {
208
- validator.validate(json, schema);
209
- // validation passed
210
- } catch (error) {
211
- // shouldn't happen after setting remote reference
212
- }
139
+ ```typescript
140
+ const validator = ZSchema.create();
213
141
 
214
- }
142
+ // Sync format
143
+ validator.registerFormat('uppercase', (value: unknown): boolean => {
144
+ return typeof value === 'string' && value === value.toUpperCase();
145
+ });
146
+
147
+ // Async format
148
+ validator.registerFormat('user-exists', async (value: unknown): Promise<boolean> => {
149
+ if (typeof value !== 'number') return false;
150
+ const user = await db.getUserById(value);
151
+ return user != null;
152
+ });
215
153
  ```
216
154
 
217
- If you're able to load schemas synchronously, you can use `ZSchema.setSchemaReader` feature:
155
+ ### Remote References
218
156
 
219
- ```javascript
220
- ZSchema.setSchemaReader(function (uri) {
221
- var someFilename = path.resolve(__dirname, '..', 'schemas', uri + '.json');
222
- return JSON.parse(fs.readFileSync(someFilename, 'utf8'));
157
+ If your schemas reference remote URIs, register them before validation.
158
+
159
+ ```typescript
160
+ const validator = ZSchema.create();
161
+
162
+ // Register a remote schema manually
163
+ validator.setRemoteReference('http://example.com/person.json', personSchema);
164
+
165
+ // Or set a schema reader to load them automatically
166
+ ZSchema.setSchemaReader((uri: string) => {
167
+ const filePath = path.resolve(__dirname, 'schemas', uri + '.json');
168
+ return JSON.parse(fs.readFileSync(filePath, 'utf8'));
223
169
  });
224
170
  ```
225
171
 
172
+ ## Version History
173
+
174
+ | Version | Changes |
175
+ | ------- | ------------------------------------------------------------------------------------------------- |
176
+ | **v10** | Default version is **draft-06**. Implemented draft-06 tests from JSON Schema Test suite. |
177
+ | **v9** | New factory API: `ZSchema.create()` replaces `new ZSchema()`. Default draft is **draft-06**. |
178
+ | **v8** | Schemas without `$schema` default to draft-04. Use `{ version: 'none' }` for the old v7 behavior. |
179
+ | **v7** | Rewritten in TypeScript/ESM. Passes all JSON Schema Test Suite tests for draft-04. |
180
+ | **v6** | Legacy version. Draft-04 support. |
181
+
226
182
  ## Features
227
183
 
228
- See [FEATURES.md](FEATURES.md) for a full list of features.
184
+ See [docs/features.md](docs/features.md) for the full feature list.
229
185
 
230
186
  ## Options
231
187
 
232
- See [OPTIONS.md](OPTIONS.md) for all available options and their descriptions.
188
+ See [docs/options.md](docs/options.md) for all constructor and per-call options.
189
+
190
+ ## Documentation
191
+
192
+ | Document | Description |
193
+ | -------------------------------------------- | ------------------------------------------------------------------------------------- |
194
+ | [docs/usage.md](docs/usage.md) | Detailed usage guide with all validation modes, error handling, and advanced features |
195
+ | [docs/options.md](docs/options.md) | Constructor options and per-call validation options |
196
+ | [docs/features.md](docs/features.md) | Feature catalog with examples |
197
+ | [docs/architecture.md](docs/architecture.md) | Internal architecture, module structure, and public API reference |
198
+ | [docs/conventions.md](docs/conventions.md) | Code style, naming, and formatting conventions |
199
+ | [docs/testing.md](docs/testing.md) | Test framework, running tests, and writing new tests |
200
+ | [docs/contributing.md](docs/contributing.md) | PR workflow and contribution guidelines |
233
201
 
234
202
  ## Contributing
235
203
 
236
- These repository has several submodules and should be cloned as follows:
204
+ This repository uses submodules. Clone with:
205
+
206
+ ```bash
207
+ git clone --recursive https://github.com/zaggino/z-schema.git
208
+ ```
237
209
 
238
- > git clone **--recursive** https://github.com/zaggino/z-schema.git
210
+ See [docs/contributing.md](docs/contributing.md) for the full contribution guide.
239
211
 
240
212
  ## Contributors
241
213
 
package/bin/z-schema CHANGED
@@ -44,10 +44,11 @@ program
44
44
 
45
45
  var options = {};
46
46
  var defaultOptions = ZSchema.getDefaultOptions();
47
+ var programOptions = program._optionValues; // { breakOnFirstError: true }
47
48
 
48
49
  for (var key in defaultOptions) {
49
- if (program[key]) {
50
- options[key] = program[key];
50
+ if (programOptions[key] != null) {
51
+ options[key] = programOptions[key];
51
52
  }
52
53
  }
53
54
 
@@ -75,6 +76,7 @@ function readJson(fileName) {
75
76
  var validator = ZSchema.create(options);
76
77
  var schemaFilePath = program.args.shift();
77
78
  var schema = readJson(schemaFilePath);
79
+ schema.id = schemaFilePath;
78
80
 
79
81
  function validateWithAutomaticDownloads(filePath, data, schema, callback) {
80
82
  var lastResult;
package/cjs/index.d.ts CHANGED
@@ -57,6 +57,11 @@ interface SchemaErrorDetail {
57
57
  * Example: "#/projects/1"
58
58
  */
59
59
  path: string | Array<string | number>;
60
+ /**
61
+ * A JSON path indicating the location in the schema where the constraint is defined.
62
+ * Example: ["properties", "name", "type"]
63
+ */
64
+ schemaPath?: Array<string | number>;
60
65
  /**
61
66
  * The schema rule description, which is included for certain errors where
62
67
  * this information is useful (e.g. to describe a constraint).
@@ -90,6 +95,7 @@ declare class Report {
90
95
  errors: SchemaErrorDetail[];
91
96
  json?: unknown;
92
97
  path: Array<number | string>;
98
+ schemaPath: Array<number | string>;
93
99
  rootSchema?: JsonSchemaInternal;
94
100
  parentReport?: Report;
95
101
  options: ZSchemaOptions;
@@ -103,11 +109,12 @@ declare class Report {
103
109
  getAncestor(id: string): Report | undefined;
104
110
  processAsyncTasks(timeout: number | undefined, callback: ValidateCallback): void;
105
111
  getPath(returnPathAsString?: boolean): string | (string | number)[];
112
+ getSchemaPath(): Array<string | number>;
106
113
  getSchemaId(): string | undefined;
107
114
  hasError(errCode: string, errParams: Array<any>): boolean;
108
- addError(errCode: ErrorCode, errParams?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema, keyword?: keyof JsonSchema): void;
115
+ addError(errCode: ErrorCode, errParams?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema | boolean, keyword?: keyof JsonSchema): void;
109
116
  getJson(): unknown;
110
- addCustomError(errorCode: ErrorCode, errorMessage: string, params?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema, keyword?: keyof JsonSchema): void;
117
+ addCustomError(errorCode: ErrorCode, errorMessage: string, params?: ErrorParam[], subReports?: Report | Report[], schema?: JsonSchema | boolean, keyword?: keyof JsonSchema): void;
111
118
  }
112
119
 
113
120
  type ErrorCode = keyof typeof Errors;
@@ -155,6 +162,10 @@ declare const Errors: {
155
162
  ASYNC_TIMEOUT: string;
156
163
  PARENT_SCHEMA_VALIDATION_FAILED: string;
157
164
  REMOTE_NOT_VALID: string;
165
+ SCHEMA_IS_FALSE: string;
166
+ CONST: string;
167
+ CONTAINS: string;
168
+ PROPERTY_NAMES: string;
158
169
  };
159
170
  declare class ValidateError extends Error {
160
171
  name: string;
@@ -237,11 +248,10 @@ declare class SchemaCompiler {
237
248
  compileArrayOfSchemasLoop(mainReport: Report, arr: JsonSchemaInternal[]): number;
238
249
  }
239
250
 
240
- type JsonSchemaVersion = 'draft-04';
241
- interface JsonSchema {
251
+ interface JsonSchemaCommon {
242
252
  $ref?: string;
243
- id?: string;
244
253
  $schema?: string;
254
+ id?: string;
245
255
  title?: string;
246
256
  description?: string;
247
257
  default?: unknown;
@@ -249,12 +259,9 @@ interface JsonSchema {
249
259
  type?: string | string[];
250
260
  properties?: Record<string, JsonSchema>;
251
261
  patternProperties?: Record<string, JsonSchema>;
252
- dependencies?: Record<string, string[]>;
253
262
  multipleOf?: number;
254
263
  minimum?: number;
255
- exclusiveMinimum?: boolean;
256
264
  maximum?: number;
257
- exclusiveMaximum?: boolean;
258
265
  minLength?: number;
259
266
  maxLength?: number;
260
267
  pattern?: string;
@@ -267,6 +274,7 @@ interface JsonSchema {
267
274
  maxProperties?: number;
268
275
  required?: string[];
269
276
  additionalProperties?: boolean | JsonSchema;
277
+ dependencies?: Record<string, string[] | JsonSchema>;
270
278
  enum?: Array<unknown>;
271
279
  format?: string;
272
280
  allOf?: JsonSchema[];
@@ -284,12 +292,29 @@ interface ZSchemaInternalProperties {
284
292
  __$validationOptions?: ZSchemaOptions;
285
293
  __$visited?: boolean;
286
294
  }
287
- interface JsonSchemaInternal extends JsonSchema, ZSchemaInternalProperties {
295
+
296
+ type JsonSchemaVersion = 'draft-04' | 'draft-06';
297
+ type JsonSchema = JsonSchemaDraft4 | JsonSchemaDraft6;
298
+ type JsonSchemaInternal = JsonSchema & ZSchemaInternalProperties;
299
+ interface JsonSchemaDraft4 extends JsonSchemaCommon {
300
+ exclusiveMaximum?: boolean;
301
+ exclusiveMinimum?: boolean;
302
+ }
303
+ interface JsonSchemaDraft6 extends JsonSchemaCommon {
304
+ $id?: string;
305
+ examples?: unknown[];
306
+ const?: unknown;
307
+ contains?: JsonSchema;
308
+ propertyNames?: JsonSchema;
309
+ exclusiveMaximum?: number;
310
+ exclusiveMinimum?: number;
288
311
  }
289
312
 
290
313
  type SchemaReader = (uri: string) => JsonSchema;
291
314
 
292
315
  declare class ZSchema extends ZSchemaBase {
316
+ /** @deprecated Use ZSchema.create() instead. */
317
+ private constructor();
293
318
  static registerFormat(name: string, validatorFunction: FormatValidatorFn): void;
294
319
  static unregisterFormat(name: string): void;
295
320
  static getRegisteredFormats(): string[];
@@ -318,14 +343,20 @@ declare class ZSchema extends ZSchemaBase {
318
343
  validateSchemaSafe(schemaOrArr: JsonSchema | JsonSchema[]): ValidateResponse;
319
344
  }
320
345
  declare class ZSchemaSafe extends ZSchemaBase {
346
+ /** @deprecated Use ZSchema.create() instead. */
347
+ private constructor();
321
348
  validate(json: unknown, schema: JsonSchema | string, options?: ValidateOptions): ValidateResponse;
322
349
  validateSchema(schemaOrArr: JsonSchema | JsonSchema[]): ValidateResponse;
323
350
  }
324
351
  declare class ZSchemaAsync extends ZSchemaBase {
352
+ /** @deprecated Use ZSchema.create() instead. */
353
+ private constructor();
325
354
  validate(json: unknown, schema: JsonSchema | string, options?: ValidateOptions): Promise<true>;
326
355
  validateSchema(schemaOrArr: JsonSchema | JsonSchema[]): true;
327
356
  }
328
357
  declare class ZSchemaAsyncSafe extends ZSchemaBase {
358
+ /** @deprecated Use ZSchema.create() instead. */
359
+ private constructor();
329
360
  validate(json: unknown, schema: JsonSchema | string, options?: ValidateOptions): Promise<ValidateResponse>;
330
361
  validateSchema(schemaOrArr: JsonSchema | JsonSchema[]): ValidateResponse;
331
362
  }