@modulify/validator 0.1.0 → 0.2.1

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 (61) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +324 -107
  3. package/dist/assert.cjs +66 -0
  4. package/dist/assert.d.ts +16 -0
  5. package/dist/assert.mjs +66 -0
  6. package/dist/assertions.cjs +190 -92
  7. package/dist/assertions.d.ts +58 -2
  8. package/dist/assertions.mjs +191 -93
  9. package/dist/checkers.d.ts +8 -0
  10. package/dist/combinators.cjs +341 -0
  11. package/dist/combinators.d.ts +17 -0
  12. package/dist/combinators.mjs +341 -0
  13. package/dist/constraints.d.ts +4 -0
  14. package/dist/extractors.d.ts +2 -0
  15. package/dist/index.cjs +172 -61
  16. package/dist/index.d.ts +10 -4
  17. package/dist/index.mjs +176 -64
  18. package/dist/json-schema.cjs +514 -0
  19. package/dist/json-schema.d.ts +14 -0
  20. package/dist/json-schema.mjs +514 -0
  21. package/dist/metadata.cjs +8 -0
  22. package/dist/metadata.cjs.js +130 -0
  23. package/dist/metadata.d.ts +8 -0
  24. package/dist/metadata.es.js +131 -0
  25. package/dist/metadata.mjs +8 -0
  26. package/dist/predicates.cjs +40 -5
  27. package/dist/predicates.d.ts +25 -3
  28. package/dist/predicates.mjs +40 -5
  29. package/dist/violations.d.ts +29 -0
  30. package/docs/en/00-index.md +14 -0
  31. package/docs/en/01-shape-api.md +348 -0
  32. package/docs/en/02-metadata-and-introspection.md +276 -0
  33. package/docs/en/03-violations.md +267 -0
  34. package/docs/en/04-json-schema-export.md +264 -0
  35. package/docs/en/05-public-api.md +123 -0
  36. package/docs/en/06-common-recipes.md +273 -0
  37. package/docs/en/07-ai-reference.md +215 -0
  38. package/docs/en/08-violation-code-types.md +241 -0
  39. package/docs/ru/00-index.md +15 -0
  40. package/docs/ru/01-shape-api.md +348 -0
  41. package/docs/ru/02-metadata-and-introspection.md +276 -0
  42. package/docs/ru/03-violations.md +267 -0
  43. package/docs/ru/04-json-schema-export.md +264 -0
  44. package/docs/ru/05-public-api.md +123 -0
  45. package/docs/ru/06-common-recipes.md +273 -0
  46. package/docs/ru/07-ai-reference.md +215 -0
  47. package/docs/ru/08-violation-code-types.md +241 -0
  48. package/docs/ru/README.md +371 -0
  49. package/package.json +51 -33
  50. package/types/index.d.ts +789 -30
  51. package/types/json-schema.d.ts +75 -0
  52. package/dist/assertions/Assert.d.ts +0 -2
  53. package/dist/assertions/HasLength.d.ts +0 -7
  54. package/dist/assertions/check.d.ts +0 -3
  55. package/dist/assertions/index.d.ts +0 -16
  56. package/dist/runners/Each.d.ts +0 -3
  57. package/dist/runners/HasProperties.d.ts +0 -6
  58. package/dist/runners/index.d.ts +0 -2
  59. package/dist/runners.cjs +0 -32
  60. package/dist/runners.d.ts +0 -2
  61. package/dist/runners.mjs +0 -32
@@ -0,0 +1,514 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const metadata = require("./metadata.cjs.js");
4
+ const jsonSchemaMetadataKeys = [
5
+ "title",
6
+ "description",
7
+ "format",
8
+ "default",
9
+ "examples",
10
+ "deprecated",
11
+ "readOnly",
12
+ "writeOnly"
13
+ ];
14
+ const typeOf = (value) => Object.prototype.toString.call(value);
15
+ const isEmptySchema = (schema) => Object.keys(schema).length === 0;
16
+ const isFiniteJsonNumber = (value) => typeof value === "number" && Number.isFinite(value);
17
+ const isJsonScalar = (value) => {
18
+ return value === null || typeof value === "string" || typeof value === "boolean" || isFiniteJsonNumber(value);
19
+ };
20
+ const isLength = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
21
+ const isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
22
+ const isPositiveFiniteNumber = (value) => isFiniteNumber(value) && value > 0;
23
+ const withPath = (context, segment) => ({
24
+ ...context,
25
+ path: [...context.path, segment]
26
+ });
27
+ const formatPath = (path) => path.length === 0 ? "<root>" : path.map((segment) => typeof segment === "symbol" ? segment.toString() : String(segment)).join(".");
28
+ const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
29
+ const setSchemaProperty = (schema, key, value) => {
30
+ schema[key] = value;
31
+ };
32
+ const pickMetadata = (metadata2) => {
33
+ if (!metadata2) {
34
+ return {};
35
+ }
36
+ const schemaMetadata = {};
37
+ jsonSchemaMetadataKeys.forEach((key) => {
38
+ if (!(key in metadata2)) {
39
+ return;
40
+ }
41
+ const value = metadata2[key];
42
+ if (key === "examples") {
43
+ if (Array.isArray(value)) {
44
+ setSchemaProperty(schemaMetadata, "examples", [...value]);
45
+ }
46
+ return;
47
+ }
48
+ if (key === "default") {
49
+ setSchemaProperty(schemaMetadata, "default", value);
50
+ return;
51
+ }
52
+ if ((key === "deprecated" || key === "readOnly" || key === "writeOnly") && typeof value === "boolean") {
53
+ setSchemaProperty(schemaMetadata, key, value);
54
+ return;
55
+ }
56
+ if (typeof value === "string") {
57
+ setSchemaProperty(schemaMetadata, key, value);
58
+ }
59
+ });
60
+ return schemaMetadata;
61
+ };
62
+ const applyMetadata = (schema, metadata2) => {
63
+ const schemaMetadata = pickMetadata(metadata2);
64
+ const nextSchema = { ...schema };
65
+ jsonSchemaMetadataKeys.forEach((key) => {
66
+ if (!(key in schemaMetadata) || key in nextSchema) {
67
+ return;
68
+ }
69
+ setSchemaProperty(nextSchema, key, schemaMetadata[key]);
70
+ });
71
+ return nextSchema;
72
+ };
73
+ class JsonSchemaExportError extends Error {
74
+ constructor(message, {
75
+ descriptor,
76
+ path = [],
77
+ reason
78
+ }) {
79
+ super(message);
80
+ this.name = "JsonSchemaExportError";
81
+ this.descriptor = descriptor;
82
+ this.reason = reason;
83
+ this.path = [...path];
84
+ }
85
+ }
86
+ const unsupported = (descriptor, context, reason) => {
87
+ if (context.mode === "strict") {
88
+ throw new JsonSchemaExportError(
89
+ `Cannot export ${descriptor.kind} at ${formatPath(context.path)}: ${reason}`,
90
+ { descriptor, path: context.path, reason }
91
+ );
92
+ }
93
+ return {};
94
+ };
95
+ const mergeNullable = (schema) => {
96
+ if (isEmptySchema(schema)) {
97
+ return schema;
98
+ }
99
+ return {
100
+ anyOf: [schema, { type: "null" }]
101
+ };
102
+ };
103
+ const toPropertyName = (key, descriptor, context) => {
104
+ if (typeof key === "symbol") {
105
+ return unsupported(descriptor, context, "symbol keys cannot be represented in JSON Schema");
106
+ }
107
+ return String(key);
108
+ };
109
+ const lengthSchema = (descriptor, context) => {
110
+ const stringSchema2 = { type: "string" };
111
+ const arraySchema = { type: "array" };
112
+ for (const constraint of descriptor.constraints) {
113
+ switch (constraint.code) {
114
+ case "length.exact": {
115
+ const exact = constraint.args[0];
116
+ if (!isLength(exact)) {
117
+ return unsupported(descriptor, context, "hasLength exact bounds must be non-negative integers");
118
+ }
119
+ setSchemaProperty(stringSchema2, "minLength", exact);
120
+ setSchemaProperty(stringSchema2, "maxLength", exact);
121
+ setSchemaProperty(arraySchema, "minItems", exact);
122
+ setSchemaProperty(arraySchema, "maxItems", exact);
123
+ break;
124
+ }
125
+ case "length.min": {
126
+ const min = constraint.args[0];
127
+ if (!isLength(min)) {
128
+ return unsupported(descriptor, context, "hasLength minimum bounds must be non-negative integers");
129
+ }
130
+ setSchemaProperty(stringSchema2, "minLength", min);
131
+ setSchemaProperty(arraySchema, "minItems", min);
132
+ break;
133
+ }
134
+ case "length.max": {
135
+ const max = constraint.args[0];
136
+ if (!isLength(max)) {
137
+ return unsupported(descriptor, context, "hasLength maximum bounds must be non-negative integers");
138
+ }
139
+ setSchemaProperty(stringSchema2, "maxLength", max);
140
+ setSchemaProperty(arraySchema, "maxItems", max);
141
+ break;
142
+ }
143
+ case "length.range": {
144
+ const range = constraint.args[0];
145
+ if (!Array.isArray(range) || range.length !== 2 || !isLength(range[0]) || !isLength(range[1])) {
146
+ return unsupported(descriptor, context, "hasLength ranges must be `[min, max]` integer tuples");
147
+ }
148
+ setSchemaProperty(stringSchema2, "minLength", range[0]);
149
+ setSchemaProperty(stringSchema2, "maxLength", range[1]);
150
+ setSchemaProperty(arraySchema, "minItems", range[0]);
151
+ setSchemaProperty(arraySchema, "maxItems", range[1]);
152
+ break;
153
+ }
154
+ default:
155
+ return unsupported(descriptor, context, `unsupported hasLength constraint "${constraint.code}"`);
156
+ }
157
+ }
158
+ return {
159
+ anyOf: [stringSchema2, arraySchema]
160
+ };
161
+ };
162
+ const exactSchema = (descriptor, context) => {
163
+ const [value] = descriptor.args ?? [];
164
+ if (!isJsonScalar(value)) {
165
+ return unsupported(
166
+ descriptor,
167
+ context,
168
+ `exact(...) supports only JSON scalar values, got ${typeOf(value)}`
169
+ );
170
+ }
171
+ return { const: value };
172
+ };
173
+ const enumSchema = (descriptor, context) => {
174
+ const [values] = descriptor.args ?? [];
175
+ if (!Array.isArray(values) || values.some((value) => !isJsonScalar(value))) {
176
+ return unsupported(
177
+ descriptor,
178
+ context,
179
+ "oneOf(...) supports only arrays of JSON scalar values"
180
+ );
181
+ }
182
+ return { enum: [...new Set(values)] };
183
+ };
184
+ const stringSchema = (descriptor, context) => {
185
+ if (descriptor.name === "hasPattern") {
186
+ const [pattern] = descriptor.constraints[0]?.args ?? [];
187
+ if (!(pattern instanceof RegExp)) {
188
+ return unsupported(descriptor, context, "hasPattern(...) requires a RegExp pattern");
189
+ }
190
+ if (pattern.flags !== "") {
191
+ return unsupported(descriptor, context, "hasPattern(...) supports only flagless regular expressions in JSON Schema");
192
+ }
193
+ return {
194
+ type: "string",
195
+ pattern: pattern.source
196
+ };
197
+ }
198
+ if (descriptor.name === "startsWith") {
199
+ const [prefix] = descriptor.constraints[0]?.args ?? [];
200
+ if (typeof prefix !== "string") {
201
+ return unsupported(descriptor, context, "startsWith(...) requires a string prefix");
202
+ }
203
+ return {
204
+ type: "string",
205
+ pattern: `^${escapeRegExp(prefix)}`
206
+ };
207
+ }
208
+ const [suffix] = descriptor.constraints[0]?.args ?? [];
209
+ if (typeof suffix !== "string") {
210
+ return unsupported(descriptor, context, "endsWith(...) requires a string suffix");
211
+ }
212
+ return {
213
+ type: "string",
214
+ pattern: `${escapeRegExp(suffix)}$`
215
+ };
216
+ };
217
+ const numberSchema = (descriptor, context) => {
218
+ const schema = { type: "number" };
219
+ if (descriptor.name === "multipleOf") {
220
+ const [step] = descriptor.constraints[0]?.args ?? [];
221
+ if (!isPositiveFiniteNumber(step)) {
222
+ return unsupported(descriptor, context, "multipleOf(...) requires a positive finite divisor");
223
+ }
224
+ setSchemaProperty(schema, "multipleOf", step);
225
+ return schema;
226
+ }
227
+ for (const constraint of descriptor.constraints) {
228
+ switch (constraint.code) {
229
+ case "number.exact": {
230
+ const exact = constraint.args[0];
231
+ if (!isFiniteNumber(exact)) {
232
+ return unsupported(descriptor, context, "hasValue exact bounds must be finite numbers");
233
+ }
234
+ setSchemaProperty(schema, "const", exact);
235
+ break;
236
+ }
237
+ case "number.min": {
238
+ const min = constraint.args[0];
239
+ if (!isFiniteNumber(min)) {
240
+ return unsupported(descriptor, context, "hasValue minimum bounds must be finite numbers");
241
+ }
242
+ setSchemaProperty(schema, "minimum", min);
243
+ break;
244
+ }
245
+ case "number.max": {
246
+ const max = constraint.args[0];
247
+ if (!isFiniteNumber(max)) {
248
+ return unsupported(descriptor, context, "hasValue maximum bounds must be finite numbers");
249
+ }
250
+ setSchemaProperty(schema, "maximum", max);
251
+ break;
252
+ }
253
+ case "number.range": {
254
+ const range = constraint.args[0];
255
+ if (!Array.isArray(range) || range.length !== 2 || !isFiniteNumber(range[0]) || !isFiniteNumber(range[1])) {
256
+ return unsupported(descriptor, context, "hasValue ranges must be `[min, max]` finite number tuples");
257
+ }
258
+ setSchemaProperty(schema, "minimum", range[0]);
259
+ setSchemaProperty(schema, "maximum", range[1]);
260
+ break;
261
+ }
262
+ default:
263
+ return unsupported(descriptor, context, `unsupported number assertion "${descriptor.name}"`);
264
+ }
265
+ }
266
+ return schema;
267
+ };
268
+ const assertionAcceptsUndefined = (descriptor) => {
269
+ switch (descriptor.name) {
270
+ case "exact":
271
+ return descriptor.args?.[0] === void 0;
272
+ case "oneOf": {
273
+ const [values] = descriptor.args ?? [];
274
+ return Array.isArray(values) && values.includes(void 0);
275
+ }
276
+ default:
277
+ return false;
278
+ }
279
+ };
280
+ const acceptsUndefined = (descriptor) => {
281
+ switch (descriptor.kind) {
282
+ case "optional":
283
+ case "nullish":
284
+ return true;
285
+ case "nullable":
286
+ case "each":
287
+ case "tuple":
288
+ case "record":
289
+ case "shape":
290
+ case "discriminatedUnion":
291
+ case "validator":
292
+ return false;
293
+ case "allOf":
294
+ return descriptor.constraints.every(acceptsUndefined);
295
+ case "union":
296
+ return descriptor.branches.some(acceptsUndefined);
297
+ case "assertion":
298
+ return assertionAcceptsUndefined(descriptor);
299
+ default:
300
+ return false;
301
+ }
302
+ };
303
+ const exportShapeRules = (descriptor, context) => {
304
+ if (descriptor.rules.length === 0 || context.mode === "bestEffort") {
305
+ return;
306
+ }
307
+ const [rule] = descriptor.rules;
308
+ throw new JsonSchemaExportError(
309
+ `Cannot export shape at ${formatPath([...context.path, "rules"])}: object-level rule "${rule.kind}" has no JSON Schema mapping`,
310
+ {
311
+ descriptor,
312
+ path: [...context.path, "rules"],
313
+ reason: `object-level rule "${rule.kind}" has no JSON Schema mapping`
314
+ }
315
+ );
316
+ };
317
+ const exportAssertion = (descriptor, context) => {
318
+ switch (descriptor.name) {
319
+ case "isString":
320
+ return { type: "string" };
321
+ case "isNumber":
322
+ return { type: "number" };
323
+ case "isBoolean":
324
+ return { type: "boolean" };
325
+ case "isBigInt":
326
+ return unsupported(descriptor, context, "bigint values cannot be represented in JSON Schema");
327
+ case "isBlob":
328
+ return unsupported(descriptor, context, "Blob instances do not have a stable JSON Schema representation");
329
+ case "isNull":
330
+ return { type: "null" };
331
+ case "isEmail":
332
+ return {
333
+ type: "string",
334
+ format: "email"
335
+ };
336
+ case "hasPattern":
337
+ case "startsWith":
338
+ case "endsWith":
339
+ return stringSchema(descriptor, context);
340
+ case "isFile":
341
+ return unsupported(descriptor, context, "File instances do not have a stable JSON Schema representation");
342
+ case "isFunction":
343
+ return unsupported(descriptor, context, "functions cannot be represented in JSON Schema");
344
+ case "isDefined":
345
+ return {};
346
+ case "isMap":
347
+ return unsupported(descriptor, context, "Map instances do not have a stable JSON Schema representation");
348
+ case "isNaN":
349
+ return unsupported(descriptor, context, "NaN cannot be represented in JSON Schema");
350
+ case "hasValue":
351
+ case "multipleOf":
352
+ return numberSchema(descriptor, context);
353
+ case "exact":
354
+ return exactSchema(descriptor, context);
355
+ case "hasSize":
356
+ return unsupported(descriptor, context, "Map and Set sizes do not have a stable JSON Schema representation");
357
+ case "oneOf":
358
+ return enumSchema(descriptor, context);
359
+ case "hasLength":
360
+ return lengthSchema(descriptor, context);
361
+ case "isDate":
362
+ return unsupported(descriptor, context, "Date instances do not have a stable JSON Schema representation");
363
+ case "isSet":
364
+ return unsupported(descriptor, context, "Set instances do not have a stable JSON Schema representation");
365
+ case "isSymbol":
366
+ return unsupported(descriptor, context, "symbols cannot be represented in JSON Schema");
367
+ default:
368
+ return unsupported(descriptor, context, `unsupported assertion "${descriptor.name}"`);
369
+ }
370
+ };
371
+ const exportDiscriminatedUnion = (descriptor, context) => {
372
+ if (typeof descriptor.key === "symbol") {
373
+ return unsupported(descriptor, context, "symbol discriminators cannot be represented in JSON Schema");
374
+ }
375
+ const key = String(descriptor.key);
376
+ const variants = descriptor.variants;
377
+ const branches = Reflect.ownKeys(variants).map((variantKey) => {
378
+ if (typeof variantKey === "symbol") {
379
+ return unsupported(descriptor, withPath(context, variantKey), "symbol discriminator values cannot be represented in JSON Schema");
380
+ }
381
+ const variant = variants[variantKey];
382
+ const branch = exportDescriptor(variant, withPath(context, variantKey));
383
+ return {
384
+ allOf: [{
385
+ type: "object",
386
+ properties: {
387
+ [key]: {
388
+ const: variantKey
389
+ }
390
+ },
391
+ required: [key]
392
+ }, branch]
393
+ };
394
+ });
395
+ return {
396
+ oneOf: branches
397
+ };
398
+ };
399
+ const exportRulesAsComment = (rules, schema) => ({
400
+ ...schema,
401
+ $comment: `Dropped ${rules.length} object rule(s) during best-effort JSON Schema export.`
402
+ });
403
+ const exportDescriptor = (descriptor, context) => {
404
+ let schema;
405
+ switch (descriptor.kind) {
406
+ case "assertion":
407
+ schema = exportAssertion(descriptor, context);
408
+ break;
409
+ case "allOf": {
410
+ const allOfDescriptor = descriptor;
411
+ schema = {
412
+ allOf: allOfDescriptor.constraints.map((child, index) => exportDescriptor(child, withPath(context, index)))
413
+ };
414
+ break;
415
+ }
416
+ case "optional": {
417
+ const wrapperDescriptor = descriptor;
418
+ schema = exportDescriptor(wrapperDescriptor.child, withPath(context, "optional"));
419
+ break;
420
+ }
421
+ case "nullable":
422
+ case "nullish": {
423
+ const wrapperDescriptor = descriptor;
424
+ schema = mergeNullable(exportDescriptor(wrapperDescriptor.child, withPath(context, descriptor.kind)));
425
+ break;
426
+ }
427
+ case "each": {
428
+ const eachDescriptor = descriptor;
429
+ schema = {
430
+ type: "array",
431
+ items: exportDescriptor(eachDescriptor.item, withPath(context, "items"))
432
+ };
433
+ break;
434
+ }
435
+ case "tuple": {
436
+ const tupleDescriptor = descriptor;
437
+ schema = {
438
+ type: "array",
439
+ prefixItems: tupleDescriptor.items.map((item, index) => exportDescriptor(item, withPath(context, index))),
440
+ minItems: tupleDescriptor.items.length,
441
+ maxItems: tupleDescriptor.items.length
442
+ };
443
+ break;
444
+ }
445
+ case "union": {
446
+ const unionDescriptor = descriptor;
447
+ schema = {
448
+ anyOf: unionDescriptor.branches.map((branch, index) => exportDescriptor(branch, withPath(context, index)))
449
+ };
450
+ break;
451
+ }
452
+ case "record": {
453
+ const recordDescriptor = descriptor;
454
+ schema = {
455
+ type: "object",
456
+ additionalProperties: exportDescriptor(recordDescriptor.values, withPath(context, "additionalProperties"))
457
+ };
458
+ break;
459
+ }
460
+ case "shape": {
461
+ const shapeDescriptor = descriptor;
462
+ const fields = shapeDescriptor.fields;
463
+ const rules = shapeDescriptor.rules;
464
+ exportShapeRules(shapeDescriptor, context);
465
+ const properties = {};
466
+ const required = [];
467
+ Reflect.ownKeys(fields).forEach((key) => {
468
+ const childContext = withPath(context, key);
469
+ const propertyName = toPropertyName(key, shapeDescriptor, childContext);
470
+ if (typeof propertyName !== "string") {
471
+ return;
472
+ }
473
+ const child = fields[key];
474
+ properties[propertyName] = exportDescriptor(child, childContext);
475
+ if (!acceptsUndefined(child)) {
476
+ required.push(propertyName);
477
+ }
478
+ });
479
+ const shapeSchema = {
480
+ type: "object",
481
+ properties,
482
+ additionalProperties: shapeDescriptor.unknownKeys === "strict" ? false : true
483
+ };
484
+ if (required.length > 0) {
485
+ setSchemaProperty(shapeSchema, "required", required);
486
+ }
487
+ schema = shapeSchema;
488
+ if (rules.length > 0 && context.mode === "bestEffort") {
489
+ schema = exportRulesAsComment(rules, schema);
490
+ }
491
+ break;
492
+ }
493
+ case "discriminatedUnion":
494
+ schema = exportDiscriminatedUnion(descriptor, context);
495
+ break;
496
+ case "validator":
497
+ schema = unsupported(descriptor, context, "custom validators need a supported public descriptor");
498
+ break;
499
+ default:
500
+ schema = unsupported(descriptor, context, `unsupported descriptor kind "${descriptor.kind}"`);
501
+ break;
502
+ }
503
+ return applyMetadata(schema, descriptor.metadata);
504
+ };
505
+ const toJsonSchema = (constraints, options = {}) => {
506
+ const descriptor = metadata.describeConstraints(constraints);
507
+ const context = {
508
+ mode: options.mode ?? "bestEffort",
509
+ path: []
510
+ };
511
+ return exportDescriptor(descriptor, context);
512
+ };
513
+ exports.JsonSchemaExportError = JsonSchemaExportError;
514
+ exports.toJsonSchema = toJsonSchema;
@@ -0,0 +1,14 @@
1
+ import { Constraint, ConstraintDescriptor, MaybeMany } from '../types';
2
+ import { JsonSchema, ToJsonSchemaOptions } from '../types/json-schema';
3
+ export type { JsonSchema, JsonSchemaExportMode, JsonSchemaTypeName, ToJsonSchemaOptions, } from '../types/json-schema';
4
+ export declare class JsonSchemaExportError extends Error {
5
+ readonly descriptor: ConstraintDescriptor;
6
+ readonly reason: string;
7
+ readonly path: readonly PropertyKey[];
8
+ constructor(message: string, { descriptor, path, reason, }: {
9
+ descriptor: ConstraintDescriptor;
10
+ reason: string;
11
+ path?: readonly PropertyKey[];
12
+ });
13
+ }
14
+ export declare const toJsonSchema: <const C extends MaybeMany<Constraint>>(constraints: C, options?: ToJsonSchemaOptions) => JsonSchema;