schema-truth 0.0.0-stage → 0.8.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 (45) hide show
  1. package/README.md +143 -2
  2. package/dist/ajv-DS9gtNZC.js +105 -0
  3. package/dist/ajv.d.ts +24 -0
  4. package/dist/ajv.js +1 -0
  5. package/dist/arktype-CRZ8vXZ5.js +803 -0
  6. package/dist/arktype.d.ts +10 -0
  7. package/dist/arktype.js +1 -0
  8. package/dist/cli/ajv.d.ts +1 -0
  9. package/dist/cli/ajv.js +15 -0
  10. package/dist/cli/arktype.d.ts +1 -0
  11. package/dist/cli/arktype.js +15 -0
  12. package/dist/cli/effect.d.ts +1 -0
  13. package/dist/cli/effect.js +15 -0
  14. package/dist/cli/typebox.d.ts +1 -0
  15. package/dist/cli/typebox.js +15 -0
  16. package/dist/cli/valibot.d.ts +1 -0
  17. package/dist/cli/valibot.js +15 -0
  18. package/dist/cli/yup.d.ts +1 -0
  19. package/dist/cli/yup.js +15 -0
  20. package/dist/cli/zod.d.ts +1 -0
  21. package/dist/cli/zod.js +15 -0
  22. package/dist/cli-eAY8LqwP.js +124 -0
  23. package/dist/effect-BkWovUi3.js +678 -0
  24. package/dist/effect.d.ts +12 -0
  25. package/dist/effect.js +1 -0
  26. package/dist/helper-CbeedY35.js +1798 -0
  27. package/dist/index-DYzAccyT.d.ts +69 -0
  28. package/dist/index-G7UqNQ4w.d.ts +603 -0
  29. package/dist/index.d.ts +332 -0
  30. package/dist/index.js +10 -0
  31. package/dist/parser-CyJ2auea.js +36 -0
  32. package/dist/typebox-wYeJqy7T.js +563 -0
  33. package/dist/typebox.d.ts +21 -0
  34. package/dist/typebox.js +1 -0
  35. package/dist/utils-Bky98UmP.js +1146 -0
  36. package/dist/valibot-DQUEDYKt.js +705 -0
  37. package/dist/valibot.d.ts +9 -0
  38. package/dist/valibot.js +1 -0
  39. package/dist/yup-BMpa9Co1.js +92 -0
  40. package/dist/yup.d.ts +17 -0
  41. package/dist/yup.js +1 -0
  42. package/dist/zod-Dq9LtqPL.js +816 -0
  43. package/dist/zod.d.ts +9 -0
  44. package/dist/zod.js +1 -0
  45. package/package.json +112 -4
@@ -0,0 +1,603 @@
1
+ import * as Effect from "effect/Effect";
2
+ //#region src/constants/index.d.ts
3
+ /**
4
+ * The values the generators agree on: every list of literals, every prefix and every
5
+ * pattern that more than one module reads. Types that mirror a list are derived from it in
6
+ * `parser/index.ts`, so adding a member here is the whole change.
7
+ */
8
+ /**
9
+ * The `type` values a JSON Schema node may carry, in the order the specification lists
10
+ * them. `date` is not a JSON Schema type: it is the extension the generators accept for a
11
+ * `Date`-typed value (Zod `z.date()`, Valibot `v.date()`).
12
+ *
13
+ * @see https://json-schema.org/understanding-json-schema/reference/type
14
+ */
15
+ declare const JSON_SCHEMA_TYPES: readonly ['string', 'number', 'integer', 'boolean', 'array', 'object', 'null', 'date'];
16
+ /**
17
+ * The `format` values a string node may carry: the JSON Schema built-ins, the OpenAPI
18
+ * data-type formats, and the names the target libraries add (`uuidv7`, `cuid2`, `jwt`,
19
+ * `hash`, ...). A format a target has no equivalent for is a no-op there.
20
+ *
21
+ * @see https://json-schema.org/understanding-json-schema/reference/string#built-in-formats
22
+ * @see https://zod.dev/api#strings
23
+ */
24
+ declare const STRING_FORMATS: readonly ['date-time', 'date', 'time', 'duration', 'email', 'idn-email', 'hostname', 'idn-hostname', 'ipv4', 'ipv6', 'uri', 'uri-reference', 'iri', 'iri-reference', 'uuid', 'uri-template', 'json-pointer', 'relative-json-pointer', 'regex', 'binary', 'byte', 'password', 'url', 'httpUrl', 'uuidv4', 'uuidv6', 'uuidv7', 'guid', 'emoji', 'base64', 'base64url', 'hex', 'nanoid', 'cuid', 'cuid2', 'ulid', 'ksuid', 'xid', 'ip', 'cidrv4', 'cidrv6', 'mac', 'jwt', 'hash', 'e164', 'creditCard', 'iban', 'currencyCode', 'httpurl', 'creditcard', 'currencycode', 'toLowerCase', 'toUpperCase', 'trim', 'slugify'];
25
+ /**
26
+ * The `format` values a numeric node may carry: the OpenAPI data-type formats plus the
27
+ * widths the target libraries distinguish (`int32`, `float32`, `bigint`, ...).
28
+ *
29
+ * @see https://spec.openapis.org/oas/v3.1.0#data-types
30
+ */
31
+ declare const NUMBER_FORMATS: readonly ['int32', 'uint32', 'int64', 'uint64', 'bigint', 'float', 'float32', 'float64', 'double', 'decimal'];
32
+ /**
33
+ * The `contentEncoding` values of a string node.
34
+ *
35
+ * @see https://json-schema.org/draft/2020-12/json-schema-validation#section-8.3
36
+ */
37
+ declare const CONTENT_ENCODINGS: readonly ['base64', 'base64url', 'binary', '7bit', '8bit', 'quoted-printable'];
38
+ /**
39
+ * The OpenAPI parameter locations, plus `formData` for the fields of an
40
+ * `application/x-www-form-urlencoded` or `multipart/form-data` body. Every one of them is
41
+ * string-wire: a primitive schema emitted under one of them is coerced from a string.
42
+ *
43
+ * @see https://spec.openapis.org/oas/v3.2.0.html#parameter-object
44
+ */
45
+ declare const PARAM_LOCATIONS: readonly ['query', 'path', 'header', 'cookie', 'formData'];
46
+ /** The parameter locations whose values arrive as strings and are coerced. */
47
+ declare const STRING_WIRE_LOCATIONS: readonly ['query', 'path', 'header', 'cookie', 'formData'];
48
+ /**
49
+ * The `type` values a value on the wire is coerced to, in the order a union tries them:
50
+ * the text `1` is an integer before it is a number, and a string last of all.
51
+ */
52
+ declare const WIRE_PRIMITIVE_ORDER: readonly ['integer', 'number', 'boolean', 'string'];
53
+ /**
54
+ * The spellings of a boolean on the wire, as Zod's `z.stringbool()` reads them: `true`,
55
+ * `1`, `yes`, `on`, `y`, `enabled` and their opposites, in any case.
56
+ */
57
+ declare const STRINGBOOL_PATTERN: RegExp;
58
+ /** The spellings of {@link STRINGBOOL_PATTERN} that read as `true`. */
59
+ declare const STRINGBOOL_TRUTHY_PATTERN: RegExp;
60
+ /** The text of a 64-bit integer: a sign and digits, which `BigInt` reads losslessly. */
61
+ declare const INTEGER_TEXT_PATTERN: RegExp;
62
+ /**
63
+ * Integer text on the string wire. A sign and digits, with no leading zero, no exponent
64
+ * and no fraction: `Number` and `parseInt` both accept more than this (`""`, `" "`,
65
+ * `"0x10"`, `"1e3"`, `"1.9xyz"`).
66
+ */
67
+ declare const INTEGER_WIRE_PATTERN: RegExp;
68
+ /**
69
+ * Number text on the string wire: the JSON number grammar (RFC 8259). An exponent is a
70
+ * number (`1e3`) and is not an integer. Blank, hex and trailing junk are not numbers.
71
+ */
72
+ declare const NUMBER_WIRE_PATTERN: RegExp;
73
+ /** The range of each fixed-width numeric format, as the literals the generators emit. */
74
+ declare const NUMBER_RANGES: {
75
+ readonly [k: string]: {
76
+ readonly minimum: string;
77
+ readonly maximum: string;
78
+ };
79
+ };
80
+ /**
81
+ * The `style` values of an OpenAPI Parameter Object: how the parameter's text maps onto its
82
+ * schema.
83
+ *
84
+ * @see https://spec.openapis.org/oas/v3.2.0.html#style-values
85
+ */
86
+ declare const PARAM_STYLES: readonly ['matrix', 'label', 'simple', 'form', 'spaceDelimited', 'pipeDelimited', 'deepObject'];
87
+ /**
88
+ * The properties every plain object inherits from `Object.prototype`. A parameter object
89
+ * read from a request answers these even when the request did not send them.
90
+ */
91
+ declare const OBJECT_PROTOTYPE_PROPERTIES: readonly ['__proto__', '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
92
+ /**
93
+ * The string formats checked with a regular expression where a target has no validator
94
+ * of its own, keyed by the lower-cased format. The patterns are Zod's, so every target
95
+ * accepts and rejects the same text.
96
+ *
97
+ * @see https://github.com/colinhacks/zod/blob/main/packages/zod/src/v4/core/regexes.ts
98
+ */
99
+ declare const FORMAT_PATTERNS: {
100
+ readonly [k: string]: RegExp;
101
+ };
102
+ /**
103
+ * The source of an RFC 3339 `full-date` that is a real calendar date: the month decides
104
+ * the days, and February 29 needs a leap year.
105
+ */
106
+ declare const DATE_PATTERN_SOURCE: string;
107
+ /** The source of a UTC offset: `Z`, or a signed `hh:mm`. */
108
+ declare const OFFSET_PATTERN_SOURCE: string;
109
+ /** The keywords that only constrain a number: on their own they imply `type: number`. */
110
+ declare const NUMERIC_KEYWORDS: readonly ['minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum', 'multipleOf'];
111
+ /** The keywords that only constrain a string: on their own they imply `type: string`. */
112
+ declare const STRING_KEYWORDS: readonly ['minLength', 'maxLength', 'pattern'];
113
+ /**
114
+ * The keywords that hold a document's named definitions: `$defs` since Draft 2019-09, and
115
+ * `definitions` before it. A document may use both, and the generators read them as one map.
116
+ */
117
+ declare const DEFINITION_KEYWORDS: readonly ['definitions', '$defs'];
118
+ /** The `$ref` spellings of the whole document: the schema being emitted refers to itself. */
119
+ declare const ROOT_REFS: readonly ['#', ''];
120
+ /** The `$ref` prefixes under which a named definition is found. */
121
+ declare const DEFINITION_REF_PREFIXES: readonly ['#/components/schemas/', '#/definitions/', '#/$defs/'];
122
+ /** The `$ref` prefix of an OpenAPI component schema. */
123
+ declare const COMPONENT_SCHEMA_REF_PREFIX = "#/components/schemas/";
124
+ /**
125
+ * The variable-name suffix of each OpenAPI component kind, by its `$ref` prefix.
126
+ *
127
+ * @see https://swagger.io/docs/specification/v3_0/components/
128
+ */
129
+ declare const OPENAPI_COMPONENT_SUFFIX_MAP: readonly {
130
+ readonly prefix: string;
131
+ readonly suffix: string;
132
+ }[];
133
+ /** The name a root schema is exported under when the document has no `title`. */
134
+ declare const DEFAULT_ROOT_NAME = "Schema";
135
+ /** The extensions of an input document: a JSON Schema as JSON or YAML. */
136
+ declare const INPUT_EXTENSIONS: readonly ['.json', '.yaml'];
137
+ /** The extension of the generated file. */
138
+ declare const OUTPUT_EXTENSION = ".ts";
139
+ /** A JavaScript identifier that can be written bare: as a binding, or a key or member access. */
140
+ declare const IDENTIFIER_PATTERN: RegExp;
141
+ /**
142
+ * A message option written as an arrow function, `(issue) => ...`, rather than as text.
143
+ * Such a message is spliced into the generated code as an expression instead of a string.
144
+ */
145
+ declare const ARROW_FUNCTION_PATTERN: RegExp;
146
+ /**
147
+ * A regular expression that needs the `u` flag: Unicode property escapes (`\p{...}`,
148
+ * `\P{...}`) and brace code points (`\u{...}`), which TypeScript rejects without it (TS1530).
149
+ */
150
+ declare const UNICODE_ESCAPE_PATTERN: RegExp;
151
+ /** A non-ASCII character, which an identifier cannot carry as is. */
152
+ declare const NON_IDENTIFIER_CHARACTER_PATTERN: RegExp;
153
+ /** A character that breaks a string-DSL literal and the JS string around it. */
154
+ declare const QUOTE_OR_BACKSLASH_PATTERN: RegExp;
155
+ /** The code-emitting extensions each target honours, in the order they are chained. */
156
+ declare const ZOD_CODE_EXTENSION_KEYS: readonly ['x-refine', 'x-transform', 'x-pipe', 'x-codec', 'x-preprocess'];
157
+ declare const VALIBOT_CODE_EXTENSION_KEYS: readonly ['x-check', 'x-transform', 'x-pipe'];
158
+ declare const EFFECT_CODE_EXTENSION_KEYS: readonly ['x-filter', 'x-transform', 'x-pipe'];
159
+ declare const ARKTYPE_CODE_EXTENSION_KEYS: readonly ['x-narrow', 'x-morph', 'x-pipe'];
160
+ /** Every code-emitting extension any target honours, deduplicated and sorted. */
161
+ declare const ALL_CODE_EXTENSION_KEYS: readonly string[];
162
+ /** The first line of a file that spliced a caller-supplied code extension into its source. */
163
+ declare const UNSAFE_GENERATED_MARKER = "// @generated-with-unsafe-code-extensions";
164
+ /** The first line of a file whose generator dropped `if` / `then` / `else`. */
165
+ declare const IF_THEN_ELSE_UNSUPPORTED_MARKER = "// FIXME: JSON Schema if/then/else is not yet supported by this generator; conditional validation is omitted";
166
+ /** The first line of a TypeBox file whose generator dropped a `not` keyword. */
167
+ declare const NOT_KEYWORD_UNSUPPORTED_MARKER = "// FIXME: JSON Schema `not` is not enforced by this generator; TypeBox v1 has no runtime `Type.Not` and `Value.Check` ignores the keyword (falls back to `Type.Any()`)";
168
+ /** The comment left where a `$ref` names a definition the document does not hold. */
169
+ declare const MISSING_DEFINITION_PREFIX = "// ⚠️ missing definition for ";
170
+ /** A JSON Pointer `$ref` to a named definition: `#/$defs/Name` or `#/definitions/Name`. */
171
+ declare const DEFINITION_POINTER_PATTERN: RegExp;
172
+ /** The Draft-04 anchor shorthand for a named definition: `#Name`. */
173
+ declare const ANCHOR_REF_PATTERN: RegExp;
174
+ /**
175
+ * The ISO 4217 alphabetic codes in current use, funds and precious-metal codes included:
176
+ * what `format: currencyCode` accepts.
177
+ *
178
+ * @see https://www.iso.org/iso-4217-currency-codes.html
179
+ */
180
+ declare const ISO_4217_CURRENCY_CODES: readonly ['AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BOV', 'BRL', 'BSD', 'BTN', 'BWP', 'BYN', 'BZD', 'CAD', 'CDF', 'CHE', 'CHF', 'CHW', 'CLF', 'CLP', 'CNY', 'COP', 'COU', 'CRC', 'CUP', 'CVE', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EGP', 'ERN', 'ETB', 'EUR', 'FJD', 'FKP', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD', 'HKD', 'HNL', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRU', 'MUR', 'MVR', 'MWK', 'MXN', 'MXV', 'MYR', 'MZN', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SBD', 'SCR', 'SDG', 'SEK', 'SGD', 'SHP', 'SLE', 'SOS', 'SRD', 'SSP', 'STN', 'SVC', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS', 'UAH', 'UGX', 'USD', 'USN', 'UYI', 'UYU', 'UYW', 'UZS', 'VED', 'VES', 'VND', 'VUV', 'WST', 'XAF', 'XAG', 'XAU', 'XBA', 'XBB', 'XBC', 'XBD', 'XCD', 'XCG', 'XDR', 'XOF', 'XPD', 'XPF', 'XPT', 'XSU', 'XTS', 'XUA', 'XXX', 'YER', 'ZAR', 'ZMW', 'ZWG'];
181
+ //#endregion
182
+ //#region src/parser/json.d.ts
183
+ /**
184
+ * A JSON value, as `enum`, `const`, `default` and `examples` carry one. A document read
185
+ * from disk holds nothing else, so an `undefined` or a function never reaches a generator.
186
+ */
187
+ type JSONValue = string | number | boolean | null | readonly JSONValue[] | {
188
+ readonly [k: string]: JSONValue;
189
+ };
190
+ //#endregion
191
+ //#region src/parser/x-ext/code.d.ts
192
+ /**
193
+ * C 層: Code-emitting vendor extensions (escape hatch).
194
+ *
195
+ * Values are complete validator-specific TS expression fragments that are
196
+ * appended verbatim to the generated schema. **DANGEROUS** — only honored
197
+ * when the programmatic API is called with `{ unsafeCodeExtensions: true }`
198
+ * and the value passes the denylist check in `helper/code-extensions.ts`.
199
+ * Treat untrusted JSON Schemas as unsafe.
200
+ *
201
+ * @see helper/code-extensions.ts for the denylist and `readCodeExtension`.
202
+ */
203
+ type XExtCode = {
204
+ /** Zod-only: `.refine(...)` chain fragment appended verbatim */
205
+ readonly 'x-refine'?: string;
206
+ /** Zod-only: `.superRefine(...)` chain fragment appended verbatim */
207
+ readonly 'x-superRefine'?: string;
208
+ /** Zod-only: complete `z.codec(...)` expression that replaces the base schema */
209
+ readonly 'x-codec'?: string;
210
+ /** Zod-only: complete `z.preprocess(...)` expression that replaces the base schema */
211
+ readonly 'x-preprocess'?: string;
212
+ /** Complete transform expression that replaces the base schema */
213
+ readonly 'x-transform'?: string;
214
+ /** Complete `.pipe(...)` expression appended verbatim */
215
+ readonly 'x-pipe'?: string;
216
+ /** Valibot-only: `.check(...)` fragment appended verbatim */
217
+ readonly 'x-check'?: string;
218
+ /** Effect-only: `.filter(...)` fragment appended verbatim */
219
+ readonly 'x-filter'?: string;
220
+ /** Arktype-only: `.narrow(...)` fragment appended verbatim */
221
+ readonly 'x-narrow'?: string;
222
+ /** Arktype-only: `.morph(...)` fragment appended verbatim */
223
+ readonly 'x-morph'?: string;
224
+ };
225
+ //#endregion
226
+ //#region src/parser/x-ext/messages.d.ts
227
+ type XExtMessages = {
228
+ readonly 'x-error-message'?: string;
229
+ readonly 'x-length-message'?: string;
230
+ readonly 'x-pattern-message'?: string;
231
+ readonly 'x-minimum-message'?: string;
232
+ readonly 'x-maximum-message'?: string;
233
+ readonly 'x-exclusiveMinimum-message'?: string;
234
+ readonly 'x-exclusiveMaximum-message'?: string;
235
+ readonly 'x-multipleOf-message'?: string;
236
+ readonly 'x-dependentRequired-message'?: string;
237
+ /**
238
+ * Overrides the validation message for `dependentSchemas` violations
239
+ * (JSON Schema 2020-12 §10.2.2.4). The inner sub-schema's `code` / `path`
240
+ * / `expected` are preserved; only `message` is replaced. Falls back to
241
+ * `x-error-message`.
242
+ */
243
+ readonly 'x-dependentSchemas-message'?: string;
244
+ readonly 'x-propertyNames-message'?: string;
245
+ readonly 'x-allOf-message'?: string;
246
+ readonly 'x-anyOf-message'?: string;
247
+ readonly 'x-oneOf-message'?: string;
248
+ readonly 'x-not-message'?: string;
249
+ /**
250
+ * Semantic alias for the implication pattern (`A → B`) encoded as
251
+ * `anyOf:[{not:A},{required:B}]`. Takes precedence over `x-anyOf-message`
252
+ * in the anyOf code path, then falls back to `x-error-message`. Acts as a
253
+ * documentation aid — explicitly marking the schema author's intent — and
254
+ * is silently ignored on schemas without `anyOf`.
255
+ */
256
+ readonly 'x-implication-message'?: string;
257
+ readonly 'x-required-message'?: string;
258
+ readonly 'x-additionalProperties-message'?: string;
259
+ readonly 'x-uniqueItems-message'?: string;
260
+ readonly 'x-const-message'?: string;
261
+ readonly 'x-enum-message'?: string;
262
+ readonly 'x-minLength-message'?: string;
263
+ readonly 'x-maxLength-message'?: string;
264
+ readonly 'x-minItems-message'?: string;
265
+ readonly 'x-maxItems-message'?: string;
266
+ readonly 'x-minProperties-message'?: string;
267
+ readonly 'x-maxProperties-message'?: string;
268
+ readonly 'x-patternProperties-message'?: string;
269
+ readonly 'x-contains-message'?: string;
270
+ readonly 'x-minContains-message'?: string;
271
+ readonly 'x-maxContains-message'?: string;
272
+ readonly 'x-properties-message'?: string;
273
+ readonly 'x-prefixItems-message'?: string;
274
+ readonly 'x-items-message'?: string;
275
+ readonly 'x-unevaluatedProperties-message'?: string;
276
+ readonly 'x-unevaluatedItems-message'?: string;
277
+ readonly 'x-if-message'?: string;
278
+ readonly 'x-then-message'?: string;
279
+ readonly 'x-else-message'?: string;
280
+ };
281
+ //#endregion
282
+ //#region src/parser/x-ext/param.d.ts
283
+ /**
284
+ * OpenAPI parameter location, or `formData` for a field of a form body
285
+ * (`application/x-www-form-urlencoded`, `multipart/form-data`).
286
+ *
287
+ * Every location is string-wire — when a primitive schema is emitted under one of
288
+ * them, generators read a number from the JSON number grammar and an integer from
289
+ * digits with no leading zero before converting the text, read a literal, an `enum`
290
+ * and the text `null` from the text, wrap a value sent once into an array of one,
291
+ * and copy an object with an `Object.prototype`-named property onto a null-prototype
292
+ * object before the check. Boolean text is the same set for every target.
293
+ *
294
+ * @see https://spec.openapis.org/oas/v3.2.0.html#parameter-object
295
+ */
296
+ type ParamIn = (typeof PARAM_LOCATIONS)[number];
297
+ /**
298
+ * Per-property OpenAPI serialization, for one property of an object schema emitted
299
+ * with `paramIn`. The root `style` / `explode` / `allowEmptyValue` options read the
300
+ * object itself; these keywords read that property's own text (`x-ids: 1,2,3` splits
301
+ * on commas before the elements are coerced). They survive inside `$defs`, unlike a
302
+ * generator option keyed by property name.
303
+ *
304
+ * Honoured by Zod, Valibot, Effect Schema and ArkType when the object is emitted with
305
+ * `paramIn`. A no-op for TypeBox, Ajv and Yup, and when `paramIn` is unset.
306
+ */
307
+ type XExtParam = {
308
+ /** The property's `style`. Defaults to the location's style when unset. */
309
+ readonly 'x-style'?: ParamStyle;
310
+ /** The property's `explode`. Defaults to `true` for `style: form`, otherwise `false`. */
311
+ readonly 'x-explode'?: boolean;
312
+ /** The property's `allowEmptyValue`: an empty value reads as an absent one. */
313
+ readonly 'x-allowEmptyValue'?: boolean;
314
+ };
315
+ /**
316
+ * The `style` of an OpenAPI Parameter Object: how its text is serialised. Defaults to
317
+ * `form` for `query` / `cookie` / `formData` and `simple` for `path` / `header`.
318
+ *
319
+ * @see https://spec.openapis.org/oas/v3.2.0.html#style-values
320
+ */
321
+ type ParamStyle = (typeof PARAM_STYLES)[number];
322
+ //#endregion
323
+ //#region src/parser/x-ext/transform.d.ts
324
+ /**
325
+ * B 層: 振る舞い・transform 系 vendor extensions.
326
+ *
327
+ * Declarative knobs that adjust the generated validator's runtime behavior
328
+ * (coercion, normalization, branding) or constrain format APIs without
329
+ * embedding code. Most are validator-portable; format-option fields are
330
+ * tagged Zod-only and become no-ops on validators without an equivalent API.
331
+ */
332
+ type XExtTransform = {
333
+ /** Apply `.trim()` / `v.trim()` etc. before validation */
334
+ readonly 'x-trim'?: boolean;
335
+ /** Apply `.toLowerCase()` before validation */
336
+ readonly 'x-toLowerCase'?: boolean;
337
+ /** Apply `.toUpperCase()` before validation */
338
+ readonly 'x-toUpperCase'?: boolean;
339
+ /** Apply Unicode normalization */
340
+ readonly 'x-normalize'?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD';
341
+ /** Mark schema as readonly (array / object) */
342
+ readonly 'x-readonly'?: boolean;
343
+ /** Require value to start with a literal prefix */
344
+ readonly 'x-startsWith'?: string;
345
+ /** Require value to end with a literal suffix */
346
+ readonly 'x-endsWith'?: string;
347
+ /** Require value to contain a literal substring */
348
+ readonly 'x-includes'?: string;
349
+ /** Zod-only: enable `z.coerce.<type>` for number / integer / boolean / date */
350
+ readonly 'x-coerce'?: boolean;
351
+ /**
352
+ * Zod-only: emit `z.stringbool()` — string-typed input parsed as boolean
353
+ * via a fixed (or custom) truthy/falsy whitelist. Trigger is `type: "string"`;
354
+ * when set, supersedes `format` / `pattern` / `x-coerce` / other string options.
355
+ * `true` enables defaults; an object configures truthy/falsy/case/error.
356
+ * @see https://zod.dev/api?id=stringbools
357
+ */
358
+ readonly 'x-stringbool'?: boolean | {
359
+ readonly truthy?: readonly string[];
360
+ readonly falsy?: readonly string[];
361
+ readonly case?: 'sensitive' | 'insensitive';
362
+ readonly error?: string;
363
+ };
364
+ /** Zod-only: `.prefault(value)` — apply default to input before parse */
365
+ readonly 'x-prefault'?: JSONValue;
366
+ /** Zod-only: `.catch(value)` — fall back to value on parse failure */
367
+ readonly 'x-catch'?: JSONValue;
368
+ /** Valibot-only: `v.fallback(schema, value)` — fall back to value on parse failure */
369
+ readonly 'x-fallback'?: JSONValue;
370
+ /** Zod-only: select the email regex preset for `format: email` */
371
+ readonly 'x-emailPattern'?: 'html5' | 'rfc5322' | 'browser' | 'unicode';
372
+ /** Zod-only: custom email regex source for `format: email` */
373
+ readonly 'x-emailRegex'?: string;
374
+ /** Restrict UUID version on `format: uuid` (Zod, Valibot, Effect Schema, ArkType) */
375
+ readonly 'x-uuidVersion'?: 'v1' | 'v2' | 'v3' | 'v4' | 'v5' | 'v6' | 'v7' | 'v8';
376
+ /** Zod-only: restrict URL hostname on `format: uri` / `format: url` */
377
+ readonly 'x-urlHostname'?: string;
378
+ /** Zod-only: restrict URL protocol on `format: uri` / `format: url` */
379
+ readonly 'x-urlProtocol'?: string;
380
+ /** Zod-only: enable / disable URL normalization */
381
+ readonly 'x-urlNormalize'?: boolean;
382
+ /**
383
+ * ISO `date-time` / `time` sub-second precision: `-1` minutes only, `0` whole seconds, `n`
384
+ * exactly `n` fraction digits (Zod, Valibot, Effect Schema, ArkType)
385
+ */
386
+ readonly 'x-isoPrecision'?: number;
387
+ /**
388
+ * Whether an ISO `date-time` / `time` accepts a numeric UTC offset; RFC 3339 carries one,
389
+ * so `false` is what rules it out (Zod, Valibot, Effect Schema, ArkType)
390
+ */
391
+ readonly 'x-isoOffset'?: boolean;
392
+ /** Allow a local (offset-less) ISO `date-time` (Zod, Valibot, Effect Schema, ArkType) */
393
+ readonly 'x-isoLocal'?: boolean;
394
+ /** Zod-only: allowed algorithm(s) for `format: jwt` */
395
+ readonly 'x-jwtAlg'?: string;
396
+ /** Zod-only: hash algorithm for `format: hash` (required positional arg of `z.hash`) */
397
+ readonly 'x-hashAlg'?: 'sha1' | 'sha256' | 'sha384' | 'sha512' | 'md5';
398
+ /** Zod-only: hash encoding for `format: hash` */
399
+ readonly 'x-hashEnc'?: 'hex' | 'base64' | 'base64url';
400
+ /** Zod-only: delimiter for `format: mac` */
401
+ readonly 'x-macDelimiter'?: string;
402
+ /** Zod-only: enforce lowercase via `.lowercase()` validation */
403
+ readonly 'x-lowercase'?: boolean;
404
+ /** Zod-only: enforce uppercase via `.uppercase()` validation */
405
+ readonly 'x-uppercase'?: boolean;
406
+ /** Branded type tag — emitted as Zod `.brand<"Tag">()` etc. */
407
+ readonly 'x-brand'?: string;
408
+ };
409
+ //#endregion
410
+ //#region src/parser/index.d.ts
411
+ declare const ParseError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
412
+ readonly _tag: "ParseError";
413
+ } & Readonly<A>;
414
+ /** The document could not be bundled as a JSON Schema. */
415
+ declare class ParseError extends ParseError_base<{
416
+ readonly message: string;
417
+ }> {}
418
+ /** The bundled document at `input`. Failures land in the error channel. */
419
+ declare function parseSchemaFile(input: string): Effect.Effect<JSONSchema, ParseError, never>;
420
+ /**
421
+ * A JSON Schema `type` value: the seven of the specification plus the `date` extension.
422
+ *
423
+ * @see https://json-schema.org/understanding-json-schema/reference/type
424
+ */
425
+ type JSONSchemaType = (typeof JSON_SCHEMA_TYPES)[number];
426
+ /** A `format` of a string node. */
427
+ type JSONSchemaStringFormat = (typeof STRING_FORMATS)[number];
428
+ /** A `format` of a numeric node. */
429
+ type JSONSchemaNumberFormat = (typeof NUMBER_FORMATS)[number];
430
+ /**
431
+ * Every `format` a node may carry: the JSON Schema built-ins, the OpenAPI data-type
432
+ * formats and the target libraries' own names. A format without an equivalent in a target
433
+ * is a no-op there, never an error.
434
+ *
435
+ * @see https://json-schema.org/understanding-json-schema/reference/string#built-in-formats
436
+ */
437
+ type JSONSchemaFormat = JSONSchemaStringFormat | JSONSchemaNumberFormat;
438
+ /** A `contentEncoding` of a string node. */
439
+ type ContentEncoding = (typeof CONTENT_ENCODINGS)[number];
440
+ /**
441
+ * A `$ref` into the same document: the whole document (`#`, or the empty string some
442
+ * tools write), a JSON Pointer (`#/$defs/X`, `#/components/schemas/X`), or a plain-name
443
+ * fragment (`#X`, the Draft-04 anchor shorthand).
444
+ */
445
+ type LocalRef = '' | '#' | `#${string}`;
446
+ /**
447
+ * A `$ref` into another document: a relative path, with or without a fragment, or an
448
+ * absolute URL. `parseSchemaFile` bundles these into the document, so a generator only
449
+ * meets one when it is handed an unbundled schema. A bare name (`User`) is none of these:
450
+ * it is the most common misspelling of `#/$defs/User`, and the type says so.
451
+ */
452
+ type ExternalRef = `${string}.json` | `${string}.yaml` | `${string}.yml` | `${string}/${string}` | `${string}#${string}` | `${string}://${string}`;
453
+ /** Every `$ref` form the generators understand. */
454
+ type Ref = LocalRef | ExternalRef;
455
+ /**
456
+ * A `type` as written: one name, or a non-empty list of names (`["string", "null"]`).
457
+ *
458
+ * @see https://json-schema.org/understanding-json-schema/reference/type
459
+ */
460
+ type JSONSchemaTypes = JSONSchemaType | readonly [JSONSchemaType, ...JSONSchemaType[]];
461
+ /**
462
+ * JSON Schema Definition
463
+ *
464
+ * Supports JSON Schema Draft 2020-12, Draft 2019-09, Draft-07, Draft-06, and Draft-04, plus
465
+ * the OpenAPI 3.x additions (`nullable`, `discriminator`, `xml`, `externalDocs`, `example`).
466
+ * There is no index signature: a key the type does not name is a typo, not a keyword, and
467
+ * the vendor extensions are enumerated in `x-ext/`.
468
+ *
469
+ * @see https://json-schema.org/draft/2020-12/json-schema-core
470
+ * @see https://json-schema.org/draft/2020-12/json-schema-validation
471
+ */
472
+ type JSONSchemaCore = {
473
+ readonly $schema?: string;
474
+ readonly $id?: string;
475
+ readonly $ref?: Ref;
476
+ readonly $comment?: string;
477
+ readonly $vocabulary?: {
478
+ readonly [k: string]: boolean;
479
+ };
480
+ readonly $anchor?: string;
481
+ /** Dynamic anchor (Draft 2020-12) */
482
+ readonly $dynamicAnchor?: string;
483
+ /** Dynamic reference (Draft 2020-12) */
484
+ readonly $dynamicRef?: Ref;
485
+ /** Schema definitions (Draft 2020-12 / Draft 2019-09) */
486
+ readonly $defs?: {
487
+ readonly [k: string]: JSONSchema;
488
+ };
489
+ /** Schema definitions (Draft-07 and earlier) */
490
+ readonly definitions?: {
491
+ readonly [k: string]: JSONSchema;
492
+ };
493
+ readonly title?: string;
494
+ readonly description?: string;
495
+ readonly default?: JSONValue;
496
+ /** Example values (Draft 2019-09+) */
497
+ readonly examples?: readonly JSONValue[];
498
+ /** Single example value (OpenAPI) */
499
+ readonly example?: JSONValue;
500
+ readonly deprecated?: boolean;
501
+ readonly readOnly?: boolean;
502
+ readonly writeOnly?: boolean;
503
+ readonly type?: JSONSchemaTypes;
504
+ readonly format?: JSONSchemaFormat;
505
+ readonly const?: JSONValue;
506
+ readonly enum?: readonly JSONValue[];
507
+ readonly minLength?: number;
508
+ readonly maxLength?: number;
509
+ readonly pattern?: string;
510
+ readonly contentMediaType?: string;
511
+ readonly contentEncoding?: ContentEncoding;
512
+ readonly contentSchema?: JSONSchema;
513
+ readonly minimum?: number;
514
+ readonly maximum?: number;
515
+ /** Exclusive minimum (Draft 2020-12: number, Draft-04: boolean) */
516
+ readonly exclusiveMinimum?: number | boolean;
517
+ /** Exclusive maximum (Draft 2020-12: number, Draft-04: boolean) */
518
+ readonly exclusiveMaximum?: number | boolean;
519
+ readonly multipleOf?: number;
520
+ readonly properties?: {
521
+ readonly [k: string]: JSONSchema;
522
+ };
523
+ readonly required?: readonly string[];
524
+ readonly additionalProperties?: boolean | JSONSchema;
525
+ readonly patternProperties?: {
526
+ readonly [k: string]: JSONSchema;
527
+ };
528
+ readonly propertyNames?: JSONSchema;
529
+ readonly minProperties?: number;
530
+ readonly maxProperties?: number;
531
+ /** Dependent required properties (Draft 2019-09+) */
532
+ readonly dependentRequired?: {
533
+ readonly [k: string]: readonly string[];
534
+ };
535
+ /** Dependent schemas (Draft 2019-09+) */
536
+ readonly dependentSchemas?: {
537
+ readonly [k: string]: JSONSchema;
538
+ };
539
+ /**
540
+ * Draft-07 `dependencies`: a list of property names is `dependentRequired`, a schema is
541
+ * `dependentSchemas`. Read for completeness; the generators emit the split keywords.
542
+ */
543
+ readonly dependencies?: {
544
+ readonly [k: string]: readonly string[] | JSONSchema;
545
+ };
546
+ /** Unevaluated properties (Draft 2019-09+) */
547
+ readonly unevaluatedProperties?: boolean | JSONSchema;
548
+ /**
549
+ * JSON Schema 2020-12 §10.3.1.2: `items` may be a schema, a tuple of schemas (Draft-04
550
+ * compat), or a boolean schema (`true` = any item allowed, `false` = no trailing items).
551
+ * The boolean form matters when paired with `prefixItems`.
552
+ */
553
+ readonly items?: JSONSchema | readonly JSONSchema[] | boolean;
554
+ /** Draft-07 `additionalItems`: the schema of the items past a tuple-form `items`. */
555
+ readonly additionalItems?: boolean | JSONSchema;
556
+ /** Positional item schemas (Draft 2020-12) */
557
+ readonly prefixItems?: readonly JSONSchema[];
558
+ readonly contains?: JSONSchema;
559
+ readonly minItems?: number;
560
+ readonly maxItems?: number;
561
+ readonly uniqueItems?: boolean;
562
+ /** Minimum number of contains matches (Draft 2019-09+) */
563
+ readonly minContains?: number;
564
+ /** Maximum number of contains matches (Draft 2019-09+) */
565
+ readonly maxContains?: number;
566
+ /** Unevaluated items (Draft 2019-09+) */
567
+ readonly unevaluatedItems?: boolean | JSONSchema;
568
+ readonly allOf?: readonly JSONSchema[];
569
+ readonly anyOf?: readonly JSONSchema[];
570
+ readonly oneOf?: readonly JSONSchema[];
571
+ readonly not?: JSONSchema;
572
+ readonly if?: JSONSchema;
573
+ readonly then?: JSONSchema;
574
+ readonly else?: JSONSchema;
575
+ /** Whether the value can be null (OpenAPI 3.0) */
576
+ readonly nullable?: boolean;
577
+ readonly discriminator?: {
578
+ readonly propertyName?: string;
579
+ readonly mapping?: {
580
+ readonly [k: string]: string;
581
+ };
582
+ /** The branch an unlisted discriminator value selects (OpenAPI 3.2) */
583
+ readonly defaultMapping?: string;
584
+ };
585
+ readonly xml?: {
586
+ /** How the value is rendered as XML (OpenAPI 3.2) */
587
+ readonly nodeType?: string;
588
+ readonly name?: string;
589
+ readonly namespace?: string;
590
+ readonly prefix?: string;
591
+ readonly attribute?: boolean;
592
+ readonly wrapped?: boolean;
593
+ };
594
+ readonly externalDocs?: {
595
+ readonly url?: string;
596
+ readonly description?: string;
597
+ };
598
+ /** Schema name (non-standard) */
599
+ readonly name?: string;
600
+ };
601
+ type JSONSchema = JSONSchemaCore & XExtMessages & XExtTransform & XExtCode & XExtParam;
602
+ //#endregion
603
+ export { QUOTE_OR_BACKSLASH_PATTERN as $, DEFINITION_REF_PREFIXES as A, MISSING_DEFINITION_PREFIX as B, ARROW_FUNCTION_PATTERN as C, DEFAULT_ROOT_NAME as D, DATE_PATTERN_SOURCE as E, INPUT_EXTENSIONS as F, NUMBER_WIRE_PATTERN as G, NOT_KEYWORD_UNSUPPORTED_MARKER as H, INTEGER_TEXT_PATTERN as I, OFFSET_PATTERN_SOURCE as J, NUMERIC_KEYWORDS as K, INTEGER_WIRE_PATTERN as L, FORMAT_PATTERNS as M, IDENTIFIER_PATTERN as N, DEFINITION_KEYWORDS as O, IF_THEN_ELSE_UNSUPPORTED_MARKER as P, PARAM_STYLES as Q, ISO_4217_CURRENCY_CODES as R, ARKTYPE_CODE_EXTENSION_KEYS as S, CONTENT_ENCODINGS as T, NUMBER_FORMATS as U, NON_IDENTIFIER_CHARACTER_PATTERN as V, NUMBER_RANGES as W, OUTPUT_EXTENSION as X, OPENAPI_COMPONENT_SUFFIX_MAP as Y, PARAM_LOCATIONS as Z, XExtMessages as _, JSONSchemaNumberFormat as a, STRING_WIRE_LOCATIONS as at, ALL_CODE_EXTENSION_KEYS as b, JSONSchemaTypes as c, VALIBOT_CODE_EXTENSION_KEYS as ct, Ref as d, ROOT_REFS as et, parseSchemaFile as f, XExtParam as g, ParamStyle as h, JSONSchemaFormat as i, STRING_KEYWORDS as it, EFFECT_CODE_EXTENSION_KEYS as j, DEFINITION_POINTER_PATTERN as k, LocalRef as l, WIRE_PRIMITIVE_ORDER as lt, ParamIn as m, ExternalRef as n, STRINGBOOL_TRUTHY_PATTERN as nt, JSONSchemaStringFormat as o, UNICODE_ESCAPE_PATTERN as ot, XExtTransform as p, OBJECT_PROTOTYPE_PROPERTIES as q, JSONSchema as r, STRING_FORMATS as rt, JSONSchemaType as s, UNSAFE_GENERATED_MARKER as st, ContentEncoding as t, STRINGBOOL_PATTERN as tt, ParseError as u, ZOD_CODE_EXTENSION_KEYS as ut, XExtCode as v, COMPONENT_SCHEMA_REF_PREFIX as w, ANCHOR_REF_PATTERN as x, JSONValue as y, JSON_SCHEMA_TYPES as z };