schema-truth 0.8.7 → 0.8.8

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.
@@ -1,4 +1,4 @@
1
- import { s as sanitizeSchema, vt as makeSafeKey, yt as normalizeTypes } from "./helper-1oDB5NHM.js";
1
+ import { s as sanitizeSchema, vt as makeSafeKey, yt as normalizeTypes } from "./helper-C-PSZHCx.js";
2
2
  // src/generator/ajv/integer.ts
3
3
  /**
4
4
  * Reconstruct a draft-07 integer schema. `minimum` is the only numeric keyword
package/dist/ajv.js CHANGED
@@ -1 +1 @@
1
- export { t as schemaToAjv } from "./ajv-BjWqjOc9.js";
1
+ export { t as schemaToAjv } from "./ajv-B4_v47gT.js";
@@ -1,42 +1,27 @@
1
- import { $ as itemsSchemaOf, A as wireArrayOnce, At as hasFixedItemCount, Bt as isNullable, C as isNullTextRead, D as stringboolPattern, E as ownProperties, Ft as isArktypeDefinition, H as emitOptionsOf, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, Kt as isRootRef, Ln as UNSAFE_GENERATED_MARKER, Lt as isDeepLocalPointer, M as wireNumericKind, N as formatPattern, O as stringboolTruthyPattern, Ot as hasCombinator, P as regexSource, S as isNullMatchedFirst, T as numberWirePattern, U as missingDefinitionComment, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, Wt as isQuoted, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, _t as issueMessageExpression, b as impliedWireType, bn as NUMBER_RANGES, bt as resolveOpenAPIRef, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, et as arktypePreprocess, f as propertyEmitOptions, fn as INTEGER_TEXT_PATTERN, g as valueListLiteral, h as notPredicate, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, j as wireNullText, jt as hasFixedLength, k as unionPrimitiveTypes, kn as QUOTE_OR_BACKSLASH_PATTERN, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, nt as callbackReturn, on as DEFINITION_REF_PREFIXES, ot as constraintMessage, p as withoutParameterSerialization, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, rt as callbackType, s as sanitizeSchema, st as constraintPredicate, tt as arktypeWrap, u as hasParameterSerialization, vt as makeSafeKey, w as isPrimitiveUnion, x as integerWirePattern, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-1oDB5NHM.js";
1
+ import { $ as itemsSchemaOf, A as wireArrayOnce, At as hasFixedItemCount, Bt as isNullable, C as isNullTextRead, D as stringboolPattern, E as ownProperties, Ft as isArktypeDefinition, H as emitOptionsOf, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, Kt as isRootRef, Ln as UNSAFE_GENERATED_MARKER, Lt as isDeepLocalPointer, M as wireNumericKind, N as formatPattern, O as stringboolTruthyPattern, Ot as hasCombinator, P as regexSource, S as isNullMatchedFirst, T as numberWirePattern, U as missingDefinitionComment, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, Wt as isQuoted, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, _t as issueMessageExpression, b as impliedWireType, bn as NUMBER_RANGES, bt as resolveOpenAPIRef, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, et as arktypePreprocess, f as propertyEmitOptions, fn as INTEGER_TEXT_PATTERN, g as valueListLiteral, h as notPredicate, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, j as wireNullText, jt as hasFixedLength, k as unionPrimitiveTypes, kn as QUOTE_OR_BACKSLASH_PATTERN, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, nt as callbackReturn, on as DEFINITION_REF_PREFIXES, ot as constraintMessage, p as withoutParameterSerialization, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, rt as callbackType, s as sanitizeSchema, st as constraintPredicate, tt as arktypeWrap, u as hasParameterSerialization, vt as makeSafeKey, w as isPrimitiveUnion, x as integerWirePattern, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-C-PSZHCx.js";
2
2
  // src/generator/arktype/number.ts
3
3
  /** The comparators of a numeric node: `>= 1`, `< 5`, `% 2`. */
4
4
  function numericConstraints(schema) {
5
5
  return [
6
- (() => {
7
- if (schema.minimum !== void 0) return schema.exclusiveMinimum === true ? {
8
- op: ">",
9
- value: String(schema.minimum)
10
- } : {
11
- op: ">=",
12
- value: String(schema.minimum)
13
- };
14
- if (typeof schema.exclusiveMinimum === "number") return {
15
- op: ">",
16
- value: String(schema.exclusiveMinimum)
17
- };
18
- })(),
19
- (() => {
20
- if (schema.maximum !== void 0) return schema.exclusiveMaximum === true ? {
21
- op: "<",
22
- value: String(schema.maximum)
23
- } : {
24
- op: "<=",
25
- value: String(schema.maximum)
26
- };
27
- if (typeof schema.exclusiveMaximum === "number") return {
28
- op: "<",
29
- value: String(schema.exclusiveMaximum)
30
- };
31
- })(),
6
+ schema.minimum !== void 0 ? {
7
+ op: schema.exclusiveMinimum === true ? ">" : ">=",
8
+ value: String(schema.minimum)
9
+ } : typeof schema.exclusiveMinimum === "number" ? {
10
+ op: ">",
11
+ value: String(schema.exclusiveMinimum)
12
+ } : void 0,
13
+ schema.maximum !== void 0 ? {
14
+ op: schema.exclusiveMaximum === true ? "<" : "<=",
15
+ value: String(schema.maximum)
16
+ } : typeof schema.exclusiveMaximum === "number" ? {
17
+ op: "<",
18
+ value: String(schema.exclusiveMaximum)
19
+ } : void 0,
32
20
  schema.multipleOf !== void 0 ? {
33
21
  op: "%",
34
22
  value: String(schema.multipleOf)
35
23
  } : void 0
36
- ].filter(isNumericBound);
37
- }
38
- function isNumericBound(bound) {
39
- return bound !== void 0;
24
+ ].filter((bound) => bound !== void 0);
40
25
  }
41
26
  /** The range comparators of a fixed-width numeric `format`, if it has one. */
42
27
  function rangeConstraints(format) {
@@ -817,7 +802,7 @@ function schemaToArktype(input, options) {
817
802
  const schema = withPolymorphicBases(hoistNestedRefs(sanitizeSchema(input)));
818
803
  const exportType = options?.exportType ?? true;
819
804
  const baseOptions = emitOptionsOf(options);
820
- const prefix = baseOptions.unsafeCodeExtensions === true && findCodeExtensionKeysInSchema(schema).length > 0 ? [UNSAFE_GENERATED_MARKER] : [];
805
+ const prefix = baseOptions.unsafeCodeExtensions && findCodeExtensionKeysInSchema(schema).length > 0 ? [UNSAFE_GENERATED_MARKER] : [];
821
806
  const toName = schemaNamer(baseOptions.openapi);
822
807
  const plan = planDocument(schema, rootNameOf(schema, toName));
823
808
  const definitions = definitionsOf(baseOptions, plan.definitions);
package/dist/arktype.js CHANGED
@@ -1 +1 @@
1
- export { t as schemaToArktype } from "./arktype-pHeYh_IG.js";
1
+ export { t as schemaToArktype } from "./arktype-C3NDHHVK.js";
package/dist/cli/ajv.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as schemaToAjv } from "../ajv-BjWqjOc9.js";
3
- import { n as version, t as cli } from "../cli-CLh6PrSG.js";
2
+ import { t as schemaToAjv } from "../ajv-B4_v47gT.js";
3
+ import { n as version, t as cli } from "../cli-CS_1z6nJ.js";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
6
  import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as schemaToArktype } from "../arktype-pHeYh_IG.js";
3
- import { n as version, t as cli } from "../cli-CLh6PrSG.js";
2
+ import { t as schemaToArktype } from "../arktype-C3NDHHVK.js";
3
+ import { n as version, t as cli } from "../cli-CS_1z6nJ.js";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
6
  import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as schemaToEffect } from "../effect-CM1XVqvf.js";
3
- import { n as version, t as cli } from "../cli-CLh6PrSG.js";
2
+ import { t as schemaToEffect } from "../effect-BFmI1iE2.js";
3
+ import { n as version, t as cli } from "../cli-CS_1z6nJ.js";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
6
  import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as schemaToTypebox } from "../typebox-CnmZohGb.js";
3
- import { n as version, t as cli } from "../cli-CLh6PrSG.js";
2
+ import { t as schemaToTypebox } from "../typebox-D8PiVdQo.js";
3
+ import { n as version, t as cli } from "../cli-CS_1z6nJ.js";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
6
  import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as schemaToValibot } from "../valibot-1p_Y7fu6.js";
3
- import { n as version, t as cli } from "../cli-CLh6PrSG.js";
2
+ import { t as schemaToValibot } from "../valibot-LwlmJZa1.js";
3
+ import { n as version, t as cli } from "../cli-CS_1z6nJ.js";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
6
  import * as NodeServices from "@effect/platform-node/NodeServices";
package/dist/cli/yup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as schemaToYup } from "../yup-IOat93gr.js";
3
- import { n as version, t as cli } from "../cli-CLh6PrSG.js";
2
+ import { t as schemaToYup } from "../yup-CkaQI_2s.js";
3
+ import { n as version, t as cli } from "../cli-CS_1z6nJ.js";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
6
  import * as NodeServices from "@effect/platform-node/NodeServices";
package/dist/cli/zod.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as schemaToZod } from "../zod-q9c0XhJO.js";
3
- import { n as version, t as cli } from "../cli-CLh6PrSG.js";
2
+ import { t as schemaToZod } from "../zod-CHHsf7VI.js";
3
+ import { n as version, t as cli } from "../cli-CS_1z6nJ.js";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
6
6
  import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -1,4 +1,4 @@
1
- import { Gt as isRecord } from "./helper-1oDB5NHM.js";
1
+ import { Gt as isRecord } from "./helper-C-PSZHCx.js";
2
2
  import { i as fmt, n as parseSchemaFile } from "./parser-RBrkz7ZL.js";
3
3
  import * as Effect from "effect/Effect";
4
4
  import path from "node:path";
@@ -9,7 +9,7 @@ import * as Stdio from "effect/Stdio";
9
9
  import "@effect/platform-node/NodeFileSystem";
10
10
  import * as FileSystem from "effect/FileSystem";
11
11
  // package.json
12
- var version = "0.8.7";
12
+ var version = "0.8.8";
13
13
  // src/file/index.ts
14
14
  /** Creates the directory and its parents. An existing directory is not an error. */
15
15
  function mkdir(dir) {
@@ -1,4 +1,4 @@
1
- import { $ as itemsSchemaOf, A as wireArrayOnce, At as hasFixedItemCount, Bt as isNullable, C as isNullTextRead, D as stringboolPattern, E as ownProperties, G as renderDefinitions, H as emitOptionsOf, I as deepEqualExpression, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, L as jsLiteral, Ln as UNSAFE_GENERATED_MARKER, M as wireNumericKind, N as formatPattern, O as stringboolTruthyPattern, Ot as hasCombinator, P as regexSource, Pt as hasType, Rt as isDefaultOnlyMember, T as numberWirePattern, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, X as hasRootSelfReference, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, b as impliedWireType, bn as NUMBER_RANGES, c as refTarget, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, f as propertyEmitOptions, fn as INTEGER_TEXT_PATTERN, g as valueListLiteral, h as notPredicate, ht as effectMessage, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, jt as hasFixedLength, k as unionPrimitiveTypes, kt as hasConditional, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, mt as effectErrorPart, o as typeDeclaration, ot as constraintMessage, p as withoutParameterSerialization, pt as effectError, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, st as constraintPredicate, u as hasParameterSerialization, v as effectPreprocess, vt as makeSafeKey, w as isPrimitiveUnion, x as integerWirePattern, y as effectWrap, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-1oDB5NHM.js";
1
+ import { $ as itemsSchemaOf, A as wireArrayOnce, At as hasFixedItemCount, Bt as isNullable, C as isNullTextRead, D as stringboolPattern, E as ownProperties, G as renderDefinitions, H as emitOptionsOf, I as deepEqualExpression, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, L as jsLiteral, Ln as UNSAFE_GENERATED_MARKER, M as wireNumericKind, N as formatPattern, O as stringboolTruthyPattern, Ot as hasCombinator, P as regexSource, Pt as hasType, Rt as isDefaultOnlyMember, T as numberWirePattern, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, X as hasRootSelfReference, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, b as impliedWireType, bn as NUMBER_RANGES, c as refTarget, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, f as propertyEmitOptions, fn as INTEGER_TEXT_PATTERN, g as valueListLiteral, h as notPredicate, ht as effectMessage, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, jt as hasFixedLength, k as unionPrimitiveTypes, kt as hasConditional, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, mt as effectErrorPart, o as typeDeclaration, ot as constraintMessage, p as withoutParameterSerialization, pt as effectError, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, st as constraintPredicate, u as hasParameterSerialization, v as effectPreprocess, vt as makeSafeKey, w as isPrimitiveUnion, x as integerWirePattern, y as effectWrap, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-C-PSZHCx.js";
2
2
  // src/generator/effect/number.ts
3
3
  /** The bound and `multipleOf` checks of a numeric node. */
4
4
  function numberChecks(schema, lit = (n) => `${n}`, suffix = "") {
@@ -675,7 +675,7 @@ function schemaToEffect(input, options) {
675
675
  const schema = withPolymorphicBases(hoistNestedRefs(sanitizeSchema(input)));
676
676
  const exportType = options?.exportType ?? true;
677
677
  const baseOptions = emitOptionsOf(options);
678
- const codeExtensionsPresent = baseOptions.unsafeCodeExtensions === true && findCodeExtensionKeysInSchema(schema).length > 0;
678
+ const codeExtensionsPresent = baseOptions.unsafeCodeExtensions && findCodeExtensionKeysInSchema(schema).length > 0;
679
679
  const toName = schemaNamer(baseOptions.openapi);
680
680
  const pascalTitle = rootNameOf(schema, toName, EFFECT_ROOT_FALLBACK);
681
681
  const plan = planDocument(schema, pascalTitle === "Schema" ? EFFECT_ROOT_FALLBACK : pascalTitle);
package/dist/effect.js CHANGED
@@ -1 +1 @@
1
- export { t as schemaToEffect } from "./effect-CM1XVqvf.js";
1
+ export { t as schemaToEffect } from "./effect-BFmI1iE2.js";
@@ -1837,7 +1837,8 @@ function definitionName(ref) {
1837
1837
  * The discriminator values that select each `oneOf` / `anyOf` member (OpenAPI 3.x
1838
1838
  * Discriminator Object): the `mapping` keys whose target names the member's `$ref`, or,
1839
1839
  * when the mapping names it nowhere, the definition name itself (the implicit mapping).
1840
- * `undefined` when the node has no discriminator property.
1840
+ * A member's `values` is `undefined` when it is not a `$ref` the mapping can name, and the
1841
+ * whole result is `undefined` when the node has no discriminator property.
1841
1842
  */
1842
1843
  function discriminatedMembers(schema, members) {
1843
1844
  const propertyName = schema.discriminator?.propertyName;
@@ -2690,6 +2691,11 @@ function withPolymorphicBases(schema) {
2690
2691
  * Resolves a `$ref` for the Zod, Valibot and Effect generators, which name declarations
2691
2692
  * alike: a definition is `Name` inside a document (`isDocument`), `NameSchema` when a
2692
2693
  * single schema is emitted under the default root name, and a thunk everywhere else.
2694
+ *
2695
+ * The `kind` says how the declaration is reached from the node being emitted: `lazy` through
2696
+ * a deferred thunk (`z.lazy`, `v.lazy`, `Schema.suspend`), `value` by its identifier because
2697
+ * it is known to be initialised first, `unknown` for a pointer into a sub-schema, which has
2698
+ * no declaration of its own, and `any` for a `$ref` the generators do not follow.
2693
2699
  */
2694
2700
  function refTarget(ref, rootName, isDocument, openapi) {
2695
2701
  if (isRootRef(ref)) return {
package/dist/index.d.ts CHANGED
@@ -60,70 +60,6 @@ export declare function wholeValueMessage(inner: string, message: string): strin
60
60
  * has no separate runtime "readonly" wrapper.
61
61
  */
62
62
  export declare function effect(schema: JSONSchema, rootName?: string, isEffect?: boolean, options?: EmitOptions): string;
63
- /**
64
- * Generation options threaded through every TypeBox emitter.
65
- *
66
- * `cyclicRefs` holds the PascalCase names that `schemaToTypebox` is emitting
67
- * inside a single `Type.Cyclic($defs, root)` map. References to those names
68
- * become `Type.Ref('Name')` instead of a bare identifier, because a `const`
69
- * cannot reference a peer that is declared later in the cycle.
70
- *
71
- * `ref` is a host `$ref` name for the **current** node only (the outermost
72
- * `Type.*` factory). Nested calls drop it so properties and `$defs` members
73
- * do not inherit the root's name.
74
- */
75
- export type TypeboxOptions = {
76
- readonly openapi?: boolean;
77
- readonly readonly?: boolean;
78
- readonly paramIn?: ParamIn;
79
- readonly cyclicRefs?: ReadonlySet<string>;
80
- readonly ref?: string;
81
- /** Definitions a `default` beside a `$ref` is checked against. */
82
- readonly definitions?: SchemaDefinitions;
83
- };
84
- /**
85
- * Options for a nested TypeBox node: the same as `options` but without a
86
- * host `ref`, so only the outermost factory of a declaration receives it.
87
- */
88
- export declare function nestedTypeboxOptions(options?: TypeboxOptions): TypeboxOptions | undefined;
89
- export declare function typebox(schema: JSONSchema, rootName?: string, isTypebox?: boolean, options?: TypeboxOptions): string;
90
- /**
91
- * Generate Valibot schema code from JSON Schema.
92
- *
93
- * @example
94
- * ```ts
95
- * valibot({ type: 'string' }, 'MySchema') // 'v.string()'
96
- * ```
97
- */
98
- export declare function valibot(schema: JSONSchema, rootName?: string, isValibot?: boolean, options?: EmitOptions): string;
99
- /**
100
- * Generate a Yup expression from one JSON Schema node.
101
- *
102
- * Unsupported keywords, combinators, `$ref` and `x-*` extensions are silent
103
- * no-ops. Unknown nodes fall back to `yup.mixed()`.
104
- *
105
- * @example
106
- * ```ts
107
- * yup({ type: 'string' }) // 'yup.string()'
108
- * ```
109
- */
110
- export declare function yup(schema: JSONSchema): string;
111
- /**
112
- * Re-push `issue` into `ctx` with `message`. Each issue code is narrowed first: the union of
113
- * parsed issues does not type-check as a raw issue, while each member does.
114
- */
115
- export declare function forwardIssue(message: string): string;
116
- /** A message for the issues under the value (with a path); the root's own issues keep theirs. */
117
- export declare function nestedIssueMessageWrap(inner: string, msg: string): string;
118
- /**
119
- * Generate Zod schema code from JSON Schema.
120
- *
121
- * @example
122
- * ```ts
123
- * zod({ type: 'string' }, 'MySchema') // 'z.string()'
124
- * ```
125
- */
126
- export declare function zod(schema: JSONSchema, rootName?: string, isZod?: boolean, options?: EmitOptions): string;
127
63
  /**
128
64
  * Convert string to PascalCase (first character uppercase).
129
65
  *
@@ -320,4 +256,74 @@ export declare function resolveOpenAPIRef($ref: string): string | null;
320
256
  * ```
321
257
  */
322
258
  export declare function makeSafeKey(key: string): string;
259
+ /**
260
+ * Generation options threaded through every TypeBox emitter.
261
+ *
262
+ * `cyclicRefs` holds the PascalCase names that `schemaToTypebox` is emitting
263
+ * inside a single `Type.Cyclic($defs, root)` map. References to those names
264
+ * become `Type.Ref('Name')` instead of a bare identifier, because a `const`
265
+ * cannot reference a peer that is declared later in the cycle.
266
+ *
267
+ * `ref` is a host `$ref` name for the **current** node only (the outermost
268
+ * `Type.*` factory). Nested calls drop it so properties and `$defs` members
269
+ * do not inherit the root's name.
270
+ */
271
+ export type TypeboxOptions = {
272
+ readonly openapi?: boolean;
273
+ readonly readonly?: boolean;
274
+ readonly paramIn?: ParamIn;
275
+ readonly cyclicRefs?: ReadonlySet<string>;
276
+ readonly ref?: string;
277
+ /** Definitions a `default` beside a `$ref` is checked against. */
278
+ readonly definitions?: SchemaDefinitions;
279
+ };
280
+ /**
281
+ * Options for a nested TypeBox node: the same as `options` but without a
282
+ * host `ref`, so only the outermost factory of a declaration receives it.
283
+ */
284
+ export declare function nestedTypeboxOptions(options?: TypeboxOptions): {
285
+ openapi?: boolean;
286
+ readonly?: boolean;
287
+ paramIn?: "cookie" | "formData" | "header" | "path" | "query";
288
+ cyclicRefs?: ReadonlySet<string>;
289
+ definitions?: SchemaDefinitions;
290
+ } | undefined;
291
+ export declare function typebox(schema: JSONSchema, rootName?: string, isTypebox?: boolean, options?: TypeboxOptions): string;
292
+ /**
293
+ * Generate Valibot schema code from JSON Schema.
294
+ *
295
+ * @example
296
+ * ```ts
297
+ * valibot({ type: 'string' }, 'MySchema') // 'v.string()'
298
+ * ```
299
+ */
300
+ export declare function valibot(schema: JSONSchema, rootName?: string, isValibot?: boolean, options?: EmitOptions): string;
301
+ /**
302
+ * Generate a Yup expression from one JSON Schema node.
303
+ *
304
+ * Unsupported keywords, combinators, `$ref` and `x-*` extensions are silent
305
+ * no-ops. Unknown nodes fall back to `yup.mixed()`.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * yup({ type: 'string' }) // 'yup.string()'
310
+ * ```
311
+ */
312
+ export declare function yup(schema: JSONSchema): string;
313
+ /**
314
+ * Re-push `issue` into `ctx` with `message`. Each issue code is narrowed first: the union of
315
+ * parsed issues does not type-check as a raw issue, while each member does.
316
+ */
317
+ export declare function forwardIssue(message: string): string;
318
+ /** A message for the issues under the value (with a path); the root's own issues keep theirs. */
319
+ export declare function nestedIssueMessageWrap(inner: string, msg: string): string;
320
+ /**
321
+ * Generate Zod schema code from JSON Schema.
322
+ *
323
+ * @example
324
+ * ```ts
325
+ * zod({ type: 'string' }, 'MySchema') // 'z.string()'
326
+ * ```
327
+ */
328
+ export declare function zod(schema: JSONSchema, rootName?: string, isZod?: boolean, options?: EmitOptions): string;
323
329
  export { ALL_CODE_EXTENSION_KEYS, ANCHOR_REF_PATTERN, ARKTYPE_CODE_EXTENSION_KEYS, ARROW_FUNCTION_PATTERN, COMPONENT_SCHEMA_REF_PREFIX, CONTENT_ENCODINGS, ContentEncoding, DATE_PATTERN_SOURCE, DEFAULT_ROOT_NAME, DEFINITION_KEYWORDS, DEFINITION_POINTER_PATTERN, DEFINITION_REF_PREFIXES, EFFECT_CODE_EXTENSION_KEYS, type EmitOptions, ExternalRef, FORMAT_PATTERNS, type GenerateOptions, IDENTIFIER_PATTERN, IF_THEN_ELSE_UNSUPPORTED_MARKER, INPUT_EXTENSIONS, INTEGER_TEXT_PATTERN, INTEGER_WIRE_PATTERN, ISO_4217_CURRENCY_CODES, JSONSchema, JSONSchemaFormat, JSONSchemaNumberFormat, JSONSchemaStringFormat, JSONSchemaType, JSONSchemaTypes, type JSONValue, JSON_SCHEMA_TYPES, LocalRef, MISSING_DEFINITION_PREFIX, NON_IDENTIFIER_CHARACTER_PATTERN, NOT_KEYWORD_UNSUPPORTED_MARKER, NUMBER_FORMATS, NUMBER_RANGES, NUMBER_WIRE_PATTERN, NUMERIC_KEYWORDS, OBJECT_PROTOTYPE_PROPERTIES, OFFSET_PATTERN_SOURCE, OPENAPI_COMPONENT_SUFFIX_MAP, OUTPUT_EXTENSION, PARAM_LOCATIONS, PARAM_STYLES, type ParamIn, type ParamStyle, ParseError, QUOTE_OR_BACKSLASH_PATTERN, ROOT_REFS, Ref, STRINGBOOL_PATTERN, STRINGBOOL_TRUTHY_PATTERN, STRING_FORMATS, STRING_KEYWORDS, STRING_WIRE_LOCATIONS, TypeboxGenerateOptions, UNICODE_ESCAPE_PATTERN, UNSAFE_GENERATED_MARKER, VALIBOT_CODE_EXTENSION_KEYS, WIRE_PRIMITIVE_ORDER, type XExtCode, type XExtMessages, type XExtParam, type XExtTransform, ZOD_CODE_EXTENSION_KEYS, parseSchemaFile, schemaToAjv, schemaToArktype, schemaToEffect, schemaToTypebox, schemaToValibot, schemaToYup, schemaToZod };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { $t as ARROW_FUNCTION_PATTERN, An as ROOT_REFS, Bn as ZOD_CODE_EXTENSION_KEYS, Cn as OBJECT_PROTOTYPE_PROPERTIES, Ct as valibotError, Dn as PARAM_LOCATIONS, Dt as zodErrorPart, En as OUTPUT_EXTENSION, Et as zodError, Fn as STRING_WIRE_LOCATIONS, In as UNICODE_ESCAPE_PATTERN, Ln as UNSAFE_GENERATED_MARKER, Mn as STRINGBOOL_TRUTHY_PATTERN, Nn as STRING_FORMATS, On as PARAM_STYLES, Pn as STRING_KEYWORDS, Qt as ARKTYPE_CODE_EXTENSION_KEYS, Rn as VALIBOT_CODE_EXTENSION_KEYS, Sn as NUMERIC_KEYWORDS, St as toPascalCase, Tn as OPENAPI_COMPONENT_SUFFIX_MAP, Tt as zodBaseError, Xt as ALL_CODE_EXTENSION_KEYS, Zt as ANCHOR_REF_PATTERN, _n as NON_IDENTIFIER_CHARACTER_PATTERN, _t as issueMessageExpression, an as DEFINITION_POINTER_PATTERN, bn as NUMBER_RANGES, bt as resolveOpenAPIRef, cn as FORMAT_PATTERNS, dn as INPUT_EXTENSIONS, en as COMPONENT_SCHEMA_REF_PREFIX, fn as INTEGER_TEXT_PATTERN, ft as coerceDefault, gn as MISSING_DEFINITION_PREFIX, gt as encodeNonAscii, hn as JSON_SCHEMA_TYPES, ht as effectMessage, in as DEFINITION_KEYWORDS, jn as STRINGBOOL_PATTERN, kn as QUOTE_OR_BACKSLASH_PATTERN, ln as IDENTIFIER_PATTERN, mn as ISO_4217_CURRENCY_CODES, mt as effectErrorPart, nn as DATE_PATTERN_SOURCE, on as DEFINITION_REF_PREFIXES, pn as INTEGER_WIRE_PATTERN, pt as effectError, rn as DEFAULT_ROOT_NAME, sn as EFFECT_CODE_EXTENSION_KEYS, tn as CONTENT_ENCODINGS, un as IF_THEN_ELSE_UNSUPPORTED_MARKER, vn as NOT_KEYWORD_UNSUPPORTED_MARKER, vt as makeSafeKey, wn as OFFSET_PATTERN_SOURCE, wt as valibotErrorPart, xn as NUMBER_WIRE_PATTERN, xt as toIdentifierPascalCase, yn as NUMBER_FORMATS, yt as normalizeTypes, zn as WIRE_PRIMITIVE_ORDER } from "./helper-1oDB5NHM.js";
1
+ import { $t as ARROW_FUNCTION_PATTERN, An as ROOT_REFS, Bn as ZOD_CODE_EXTENSION_KEYS, Cn as OBJECT_PROTOTYPE_PROPERTIES, Ct as valibotError, Dn as PARAM_LOCATIONS, Dt as zodErrorPart, En as OUTPUT_EXTENSION, Et as zodError, Fn as STRING_WIRE_LOCATIONS, In as UNICODE_ESCAPE_PATTERN, Ln as UNSAFE_GENERATED_MARKER, Mn as STRINGBOOL_TRUTHY_PATTERN, Nn as STRING_FORMATS, On as PARAM_STYLES, Pn as STRING_KEYWORDS, Qt as ARKTYPE_CODE_EXTENSION_KEYS, Rn as VALIBOT_CODE_EXTENSION_KEYS, Sn as NUMERIC_KEYWORDS, St as toPascalCase, Tn as OPENAPI_COMPONENT_SUFFIX_MAP, Tt as zodBaseError, Xt as ALL_CODE_EXTENSION_KEYS, Zt as ANCHOR_REF_PATTERN, _n as NON_IDENTIFIER_CHARACTER_PATTERN, _t as issueMessageExpression, an as DEFINITION_POINTER_PATTERN, bn as NUMBER_RANGES, bt as resolveOpenAPIRef, cn as FORMAT_PATTERNS, dn as INPUT_EXTENSIONS, en as COMPONENT_SCHEMA_REF_PREFIX, fn as INTEGER_TEXT_PATTERN, ft as coerceDefault, gn as MISSING_DEFINITION_PREFIX, gt as encodeNonAscii, hn as JSON_SCHEMA_TYPES, ht as effectMessage, in as DEFINITION_KEYWORDS, jn as STRINGBOOL_PATTERN, kn as QUOTE_OR_BACKSLASH_PATTERN, ln as IDENTIFIER_PATTERN, mn as ISO_4217_CURRENCY_CODES, mt as effectErrorPart, nn as DATE_PATTERN_SOURCE, on as DEFINITION_REF_PREFIXES, pn as INTEGER_WIRE_PATTERN, pt as effectError, rn as DEFAULT_ROOT_NAME, sn as EFFECT_CODE_EXTENSION_KEYS, tn as CONTENT_ENCODINGS, un as IF_THEN_ELSE_UNSUPPORTED_MARKER, vn as NOT_KEYWORD_UNSUPPORTED_MARKER, vt as makeSafeKey, wn as OFFSET_PATTERN_SOURCE, wt as valibotErrorPart, xn as NUMBER_WIRE_PATTERN, xt as toIdentifierPascalCase, yn as NUMBER_FORMATS, yt as normalizeTypes, zn as WIRE_PRIMITIVE_ORDER } from "./helper-C-PSZHCx.js";
2
2
  import { i as fmt, n as parseSchemaFile, r as FormatError, t as ParseError } from "./parser-RBrkz7ZL.js";
3
- import { n as ajv, t as schemaToAjv } from "./ajv-BjWqjOc9.js";
4
- import { n as arktype, t as schemaToArktype } from "./arktype-pHeYh_IG.js";
5
- import { n as effect, r as wholeValueMessage, t as schemaToEffect } from "./effect-CM1XVqvf.js";
6
- import { n as nestedTypeboxOptions, r as typebox, t as schemaToTypebox } from "./typebox-CnmZohGb.js";
7
- import { n as valibot, t as schemaToValibot } from "./valibot-1p_Y7fu6.js";
8
- import { n as yup, t as schemaToYup } from "./yup-IOat93gr.js";
9
- import { i as zod, n as forwardIssue, r as nestedIssueMessageWrap, t as schemaToZod } from "./zod-q9c0XhJO.js";
3
+ import { n as ajv, t as schemaToAjv } from "./ajv-B4_v47gT.js";
4
+ import { n as arktype, t as schemaToArktype } from "./arktype-C3NDHHVK.js";
5
+ import { n as effect, r as wholeValueMessage, t as schemaToEffect } from "./effect-BFmI1iE2.js";
6
+ import { n as nestedTypeboxOptions, r as typebox, t as schemaToTypebox } from "./typebox-D8PiVdQo.js";
7
+ import { n as valibot, t as schemaToValibot } from "./valibot-LwlmJZa1.js";
8
+ import { n as yup, t as schemaToYup } from "./yup-CkaQI_2s.js";
9
+ import { i as zod, n as forwardIssue, r as nestedIssueMessageWrap, t as schemaToZod } from "./zod-CHHsf7VI.js";
10
10
  export { ALL_CODE_EXTENSION_KEYS, ANCHOR_REF_PATTERN, ARKTYPE_CODE_EXTENSION_KEYS, ARROW_FUNCTION_PATTERN, COMPONENT_SCHEMA_REF_PREFIX, CONTENT_ENCODINGS, DATE_PATTERN_SOURCE, DEFAULT_ROOT_NAME, DEFINITION_KEYWORDS, DEFINITION_POINTER_PATTERN, DEFINITION_REF_PREFIXES, EFFECT_CODE_EXTENSION_KEYS, FORMAT_PATTERNS, FormatError, IDENTIFIER_PATTERN, IF_THEN_ELSE_UNSUPPORTED_MARKER, INPUT_EXTENSIONS, INTEGER_TEXT_PATTERN, INTEGER_WIRE_PATTERN, ISO_4217_CURRENCY_CODES, JSON_SCHEMA_TYPES, MISSING_DEFINITION_PREFIX, NON_IDENTIFIER_CHARACTER_PATTERN, NOT_KEYWORD_UNSUPPORTED_MARKER, NUMBER_FORMATS, NUMBER_RANGES, NUMBER_WIRE_PATTERN, NUMERIC_KEYWORDS, OBJECT_PROTOTYPE_PROPERTIES, OFFSET_PATTERN_SOURCE, OPENAPI_COMPONENT_SUFFIX_MAP, OUTPUT_EXTENSION, PARAM_LOCATIONS, PARAM_STYLES, ParseError, QUOTE_OR_BACKSLASH_PATTERN, ROOT_REFS, STRINGBOOL_PATTERN, STRINGBOOL_TRUTHY_PATTERN, STRING_FORMATS, STRING_KEYWORDS, STRING_WIRE_LOCATIONS, UNICODE_ESCAPE_PATTERN, UNSAFE_GENERATED_MARKER, VALIBOT_CODE_EXTENSION_KEYS, WIRE_PRIMITIVE_ORDER, ZOD_CODE_EXTENSION_KEYS, ajv, arktype, coerceDefault, effect, effectError, effectErrorPart, effectMessage, encodeNonAscii, fmt, forwardIssue, issueMessageExpression, makeSafeKey, nestedIssueMessageWrap, nestedTypeboxOptions, normalizeTypes, parseSchemaFile, resolveOpenAPIRef, schemaToAjv, schemaToArktype, schemaToEffect, schemaToTypebox, schemaToValibot, schemaToYup, schemaToZod, toIdentifierPascalCase, toPascalCase, typebox, valibot, valibotError, valibotErrorPart, wholeValueMessage, yup, zod, zodBaseError, zodError, zodErrorPart };
@@ -1,4 +1,4 @@
1
- import { $ as itemsSchemaOf, B as typeboxRefOpt, Bt as isNullable, D as stringboolPattern, G as renderDefinitions, H as emitOptionsOf, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, Kt as isRootRef, Lt as isDeepLocalPointer, Mt as hasNumericKeyword, Nt as hasStringKeyword, O as stringboolTruthyPattern, Ot as hasCombinator, Q as isOptionalByDefault, R as typeboxDefaultOpt, Rt as isDefaultOnlyMember, U as missingDefinitionComment, V as definitionsOf, W as planDocument, X as hasRootSelfReference, Y as cyclicDefinitionNames, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, a as typeboxWrap, at as hasNotKeyword, bt as resolveOpenAPIRef, ct as foldAllOfMembers, jt as hasFixedLength, l as withPolymorphicBases, lt as isKeywordOnlyMember, on as DEFINITION_REF_PREFIXES, pn as INTEGER_WIRE_PATTERN, q as schemaNamer, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, ut as patternSource, vn as NOT_KEYWORD_UNSUPPORTED_MARKER, vt as makeSafeKey, xn as NUMBER_WIRE_PATTERN, yt as normalizeTypes, z as typeboxMetaOpts, zt as isNullTypeMember } from "./helper-1oDB5NHM.js";
1
+ import { $ as itemsSchemaOf, B as typeboxRefOpt, Bt as isNullable, D as stringboolPattern, G as renderDefinitions, H as emitOptionsOf, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, Kt as isRootRef, Lt as isDeepLocalPointer, Mt as hasNumericKeyword, Nt as hasStringKeyword, O as stringboolTruthyPattern, Ot as hasCombinator, Q as isOptionalByDefault, R as typeboxDefaultOpt, Rt as isDefaultOnlyMember, U as missingDefinitionComment, V as definitionsOf, W as planDocument, X as hasRootSelfReference, Y as cyclicDefinitionNames, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, a as typeboxWrap, at as hasNotKeyword, bt as resolveOpenAPIRef, ct as foldAllOfMembers, jt as hasFixedLength, l as withPolymorphicBases, lt as isKeywordOnlyMember, on as DEFINITION_REF_PREFIXES, pn as INTEGER_WIRE_PATTERN, q as schemaNamer, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, ut as patternSource, vn as NOT_KEYWORD_UNSUPPORTED_MARKER, vt as makeSafeKey, xn as NUMBER_WIRE_PATTERN, yt as normalizeTypes, z as typeboxMetaOpts, zt as isNullTypeMember } from "./helper-C-PSZHCx.js";
2
2
  // src/generator/typebox/enum.ts
3
3
  function lit(v) {
4
4
  if (v === null) return "null";
package/dist/typebox.js CHANGED
@@ -1 +1 @@
1
- export { t as schemaToTypebox } from "./typebox-CnmZohGb.js";
1
+ export { t as schemaToTypebox } from "./typebox-D8PiVdQo.js";
@@ -1,4 +1,4 @@
1
- import { $ as itemsSchemaOf, A as wireArrayOnce, At as hasFixedItemCount, Bt as isNullable, C as isNullTextRead, Ct as valibotError, D as stringboolPattern, E as ownProperties, G as renderDefinitions, H as emitOptionsOf, I as deepEqualExpression, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, L as jsLiteral, Ln as UNSAFE_GENERATED_MARKER, M as wireNumericKind, N as formatPattern, O as stringboolTruthyPattern, Ot as hasCombinator, P as regexSource, Pt as hasType, Q as isOptionalByDefault, Rt as isDefaultOnlyMember, T as numberWirePattern, Ut as isPrimitive, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, X as hasRootSelfReference, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, _t as issueMessageExpression, b as impliedWireType, bn as NUMBER_RANGES, c as refTarget, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, f as propertyEmitOptions, fn as INTEGER_TEXT_PATTERN, g as valueListLiteral, h as notPredicate, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, jt as hasFixedLength, k as unionPrimitiveTypes, kt as hasConditional, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, n as valibotWrap, o as typeDeclaration, ot as constraintMessage, p as withoutParameterSerialization, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, st as constraintPredicate, u as hasParameterSerialization, vt as makeSafeKey, w as isPrimitiveUnion, wt as valibotErrorPart, x as integerWirePattern, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-1oDB5NHM.js";
1
+ import { $ as itemsSchemaOf, A as wireArrayOnce, At as hasFixedItemCount, Bt as isNullable, C as isNullTextRead, Ct as valibotError, D as stringboolPattern, E as ownProperties, G as renderDefinitions, H as emitOptionsOf, I as deepEqualExpression, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, L as jsLiteral, Ln as UNSAFE_GENERATED_MARKER, M as wireNumericKind, N as formatPattern, O as stringboolTruthyPattern, Ot as hasCombinator, P as regexSource, Pt as hasType, Q as isOptionalByDefault, Rt as isDefaultOnlyMember, T as numberWirePattern, Ut as isPrimitive, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, X as hasRootSelfReference, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, _t as issueMessageExpression, b as impliedWireType, bn as NUMBER_RANGES, c as refTarget, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, f as propertyEmitOptions, fn as INTEGER_TEXT_PATTERN, g as valueListLiteral, h as notPredicate, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, jt as hasFixedLength, k as unionPrimitiveTypes, kt as hasConditional, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, n as valibotWrap, o as typeDeclaration, ot as constraintMessage, p as withoutParameterSerialization, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, st as constraintPredicate, u as hasParameterSerialization, vt as makeSafeKey, w as isPrimitiveUnion, wt as valibotErrorPart, x as integerWirePattern, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-C-PSZHCx.js";
2
2
  // src/generator/valibot/type.ts
3
3
  /** The TypeScript type declared beside a recursive Valibot schema: its output type. */
4
4
  function type(schema, rootName = DEFAULT_ROOT_NAME) {
@@ -701,7 +701,7 @@ function schemaToValibot(input, options) {
701
701
  const schema = withPolymorphicBases(hoistNestedRefs(sanitizeSchema(input)));
702
702
  const exportType = options?.exportType ?? true;
703
703
  const baseOptions = emitOptionsOf(options);
704
- const codeExtensionsPresent = baseOptions.unsafeCodeExtensions === true && findCodeExtensionKeysInSchema(schema).length > 0;
704
+ const codeExtensionsPresent = baseOptions.unsafeCodeExtensions && findCodeExtensionKeysInSchema(schema).length > 0;
705
705
  const toName = schemaNamer(baseOptions.openapi);
706
706
  const plan = planDocument(schema, rootNameOf(schema, toName));
707
707
  const definitions = definitionsOf(baseOptions, plan.definitions);
package/dist/valibot.js CHANGED
@@ -1 +1 @@
1
- export { t as schemaToValibot } from "./valibot-1p_Y7fu6.js";
1
+ export { t as schemaToValibot } from "./valibot-LwlmJZa1.js";
@@ -1,4 +1,4 @@
1
- import { K as rootNameOf, q as schemaNamer, s as sanitizeSchema, vt as makeSafeKey, yt as normalizeTypes } from "./helper-1oDB5NHM.js";
1
+ import { K as rootNameOf, q as schemaNamer, s as sanitizeSchema, vt as makeSafeKey, yt as normalizeTypes } from "./helper-C-PSZHCx.js";
2
2
  // src/generator/yup/integer.ts
3
3
  /**
4
4
  * Generate a Yup integer schema as `yup.number().integer()`, with `minimum`
package/dist/yup.js CHANGED
@@ -1 +1 @@
1
- export { t as schemaToYup } from "./yup-IOat93gr.js";
1
+ export { t as schemaToYup } from "./yup-CkaQI_2s.js";
@@ -1,4 +1,4 @@
1
- import { $ as itemsSchemaOf, A as wireArrayOnce, Bt as isNullable, C as isNullTextRead, Dt as zodErrorPart, Et as zodError, F as timePattern, G as renderDefinitions, H as emitOptionsOf, Ht as isPlainObject, I as deepEqualExpression, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, Ln as UNSAFE_GENERATED_MARKER, M as wireNumericKind, Ot as hasCombinator, Pt as hasType, Rt as isDefaultOnlyMember, S as isNullMatchedFirst, T as numberWirePattern, Tt as zodBaseError, Ut as isPrimitive, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, X as hasRootSelfReference, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, _t as issueMessageExpression, b as impliedWireType, c as refTarget, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, f as propertyEmitOptions, g as valueListLiteral, h as notPredicate, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, j as wireNullText, jt as hasFixedLength, k as unionPrimitiveTypes, kt as hasConditional, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, mn as ISO_4217_CURRENCY_CODES, o as typeDeclaration, ot as constraintMessage, p as withoutParameterSerialization, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, st as constraintPredicate, t as zodWrap, u as hasParameterSerialization, vt as makeSafeKey, w as isPrimitiveUnion, x as integerWirePattern, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-1oDB5NHM.js";
1
+ import { $ as itemsSchemaOf, A as wireArrayOnce, Bt as isNullable, C as isNullTextRead, Dt as zodErrorPart, Et as zodError, F as timePattern, G as renderDefinitions, H as emitOptionsOf, Ht as isPlainObject, I as deepEqualExpression, It as isComposite, J as discriminatedMembers, Jt as isShapelessMember, K as rootNameOf, Ln as UNSAFE_GENERATED_MARKER, M as wireNumericKind, Ot as hasCombinator, Pt as hasType, Rt as isDefaultOnlyMember, S as isNullMatchedFirst, T as numberWirePattern, Tt as zodBaseError, Ut as isPrimitive, V as definitionsOf, Vt as isObjectPrototypeProperty, W as planDocument, X as hasRootSelfReference, Yt as isStringWireLocation, Z as enumWithoutWrappedNull, _ as hoistNestedRefs, _t as issueMessageExpression, b as impliedWireType, c as refTarget, ct as foldAllOfMembers, d as parameterReaders, dt as regexLiteral, f as propertyEmitOptions, g as valueListLiteral, h as notPredicate, i as isEvaluatedKeyExpression, it as findCodeExtensionKeysInSchema, j as wireNullText, jt as hasFixedLength, k as unionPrimitiveTypes, kt as hasConditional, l as withPolymorphicBases, lt as isKeywordOnlyMember, m as isBigintFormat, mn as ISO_4217_CURRENCY_CODES, o as typeDeclaration, ot as constraintMessage, p as withoutParameterSerialization, q as schemaNamer, qt as isSchemaObject, r as evaluatedProperties, rn as DEFAULT_ROOT_NAME, s as sanitizeSchema, st as constraintPredicate, t as zodWrap, u as hasParameterSerialization, vt as makeSafeKey, w as isPrimitiveUnion, x as integerWirePattern, yt as normalizeTypes, zt as isNullTypeMember } from "./helper-C-PSZHCx.js";
2
2
  // src/generator/zod/type.ts
3
3
  /** The TypeScript type declared beside a recursive Zod schema. */
4
4
  function type(schema, rootName = DEFAULT_ROOT_NAME) {
@@ -821,7 +821,7 @@ function schemaToZod(input, options) {
821
821
  const schema = withPolymorphicBases(hoistNestedRefs(sanitizeSchema(input)));
822
822
  const exportType = options?.exportType ?? true;
823
823
  const baseOptions = emitOptionsOf(options);
824
- const codeExtensionsPresent = baseOptions.unsafeCodeExtensions === true && findCodeExtensionKeysInSchema(schema).length > 0;
824
+ const codeExtensionsPresent = baseOptions.unsafeCodeExtensions && findCodeExtensionKeysInSchema(schema).length > 0;
825
825
  const toName = schemaNamer(baseOptions.openapi);
826
826
  const plan = planDocument(schema, rootNameOf(schema, toName));
827
827
  const definitions = definitionsOf(baseOptions, plan.definitions);
package/dist/zod.js CHANGED
@@ -1 +1 @@
1
- export { t as schemaToZod } from "./zod-q9c0XhJO.js";
1
+ export { t as schemaToZod } from "./zod-CHHsf7VI.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schema-truth",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Generate Zod/Valibot/Effect/TypeBox/ArkType/Ajv/Yup schemas from JSON or YAML files",
5
5
  "keywords": [
6
6
  "ajv",