@trigger.dev/schema-to-json 4.0.2 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/index.d.ts +6 -28
- package/dist/commonjs/index.js +98 -135
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +6 -28
- package/dist/esm/index.js +74 -132
- package/dist/esm/index.js.map +1 -1
- package/package.json +7 -19
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -3,23 +3,18 @@ export type Schema = unknown;
|
|
|
3
3
|
export type { JSONSchema };
|
|
4
4
|
export interface ConversionOptions {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Enables support for references in the schema.
|
|
7
|
+
* This is required for recursive schemas, e.g. with `z.lazy`.
|
|
8
|
+
* However, not all language models and providers support such references.
|
|
9
|
+
* Defaults to `false`.
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Additional JSON Schema properties to merge
|
|
11
|
-
*/
|
|
12
|
-
additionalProperties?: Record<string, unknown>;
|
|
11
|
+
useReferences?: boolean;
|
|
13
12
|
}
|
|
14
13
|
export interface ConversionResult {
|
|
15
14
|
/**
|
|
16
15
|
* The JSON Schema representation (JSON Schema Draft 7)
|
|
17
16
|
*/
|
|
18
17
|
jsonSchema: JSONSchema;
|
|
19
|
-
/**
|
|
20
|
-
* The detected schema type
|
|
21
|
-
*/
|
|
22
|
-
schemaType: "zod" | "yup" | "arktype" | "effect" | "valibot" | "superstruct" | "runtypes" | "typebox" | "unknown";
|
|
23
18
|
}
|
|
24
19
|
/**
|
|
25
20
|
* Convert a schema from various validation libraries to JSON Schema
|
|
@@ -34,25 +29,8 @@ export interface ConversionResult {
|
|
|
34
29
|
* @returns The conversion result or undefined if conversion is not possible
|
|
35
30
|
*/
|
|
36
31
|
export declare function schemaToJsonSchema(schema: Schema, options?: ConversionOptions): ConversionResult | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Initialize the schema conversion libraries
|
|
39
|
-
* This should be called by the consuming application if they want to enable
|
|
40
|
-
* conversion for schemas that don't have built-in JSON Schema support
|
|
41
|
-
*/
|
|
42
|
-
export declare function initializeSchemaConverters(): Promise<void>;
|
|
43
32
|
/**
|
|
44
33
|
* Check if a schema can be converted to JSON Schema
|
|
45
34
|
*/
|
|
46
35
|
export declare function canConvertSchema(schema: Schema): boolean;
|
|
47
|
-
|
|
48
|
-
* Get the detected schema type
|
|
49
|
-
*/
|
|
50
|
-
export declare function detectSchemaType(schema: Schema): ConversionResult["schemaType"];
|
|
51
|
-
/**
|
|
52
|
-
* Check if the conversion libraries are initialized
|
|
53
|
-
*/
|
|
54
|
-
export declare function areConvertersInitialized(): {
|
|
55
|
-
zod: boolean;
|
|
56
|
-
yup: boolean;
|
|
57
|
-
effect: boolean;
|
|
58
|
-
};
|
|
36
|
+
export declare function isZodSchema(schema: any): boolean;
|
package/dist/commonjs/index.js
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.schemaToJsonSchema = schemaToJsonSchema;
|
|
4
|
-
exports.initializeSchemaConverters = initializeSchemaConverters;
|
|
5
27
|
exports.canConvertSchema = canConvertSchema;
|
|
6
|
-
exports.
|
|
7
|
-
|
|
28
|
+
exports.isZodSchema = isZodSchema;
|
|
29
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
30
|
+
const z4 = __importStar(require("zod/v4"));
|
|
31
|
+
const yup_to_json_schema_1 = require("@sodaru/yup-to-json-schema");
|
|
32
|
+
const effect_1 = require("effect");
|
|
8
33
|
/**
|
|
9
34
|
* Convert a schema from various validation libraries to JSON Schema
|
|
10
35
|
*
|
|
@@ -23,103 +48,43 @@ function schemaToJsonSchema(schema, options) {
|
|
|
23
48
|
if (typeof parser.toJsonSchema === "function") {
|
|
24
49
|
try {
|
|
25
50
|
const jsonSchema = parser.toJsonSchema();
|
|
26
|
-
// Determine if it's Zod or ArkType based on other methods
|
|
27
|
-
const schemaType = typeof parser.parseAsync === "function" || typeof parser.parse === "function"
|
|
28
|
-
? "zod"
|
|
29
|
-
: "arktype";
|
|
30
51
|
return {
|
|
31
|
-
jsonSchema
|
|
32
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
33
|
-
: jsonSchema,
|
|
34
|
-
schemaType,
|
|
52
|
+
jsonSchema,
|
|
35
53
|
};
|
|
36
54
|
}
|
|
37
55
|
catch (error) {
|
|
38
56
|
// If toJsonSchema fails, continue to other checks
|
|
39
57
|
}
|
|
40
58
|
}
|
|
59
|
+
if (isZodSchema(parser)) {
|
|
60
|
+
const jsonSchema = convertZodSchema(parser, options);
|
|
61
|
+
if (jsonSchema) {
|
|
62
|
+
return {
|
|
63
|
+
jsonSchema: jsonSchema,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
41
67
|
// Check if it's a TypeBox schema (has Static and Kind symbols)
|
|
42
68
|
if (parser[Symbol.for("TypeBox.Kind")] !== undefined) {
|
|
43
69
|
// TypeBox schemas are already JSON Schema compliant
|
|
44
70
|
return {
|
|
45
|
-
jsonSchema:
|
|
46
|
-
? { ...parser, ...options.additionalProperties }
|
|
47
|
-
: parser,
|
|
48
|
-
schemaType: "typebox",
|
|
71
|
+
jsonSchema: parser,
|
|
49
72
|
};
|
|
50
73
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// @ts-ignore - This is intentionally dynamic
|
|
58
|
-
if (typeof globalThis.__zodToJsonSchema !== "undefined") {
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
const { zodToJsonSchema } = globalThis.__zodToJsonSchema;
|
|
61
|
-
const jsonSchema = options?.name
|
|
62
|
-
? zodToJsonSchema(parser, options.name)
|
|
63
|
-
: zodToJsonSchema(parser);
|
|
64
|
-
if (jsonSchema && typeof jsonSchema === "object" && "$schema" in jsonSchema) {
|
|
65
|
-
const { $schema, ...rest } = jsonSchema;
|
|
66
|
-
return {
|
|
67
|
-
jsonSchema: options?.additionalProperties
|
|
68
|
-
? { ...rest, ...options.additionalProperties }
|
|
69
|
-
: rest,
|
|
70
|
-
schemaType: "zod",
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
jsonSchema: options?.additionalProperties
|
|
75
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
76
|
-
: jsonSchema,
|
|
77
|
-
schemaType: "zod",
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
// Library not available
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// Check if it's a Yup schema
|
|
86
|
-
if (typeof parser.validateSync === "function" && typeof parser.describe === "function") {
|
|
87
|
-
try {
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
if (typeof globalThis.__yupToJsonSchema !== "undefined") {
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
const { convertSchema } = globalThis.__yupToJsonSchema;
|
|
92
|
-
const jsonSchema = convertSchema(parser);
|
|
93
|
-
return {
|
|
94
|
-
jsonSchema: options?.additionalProperties
|
|
95
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
96
|
-
: jsonSchema,
|
|
97
|
-
schemaType: "yup",
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
// Library not available
|
|
74
|
+
if (isYupSchema(parser)) {
|
|
75
|
+
const jsonSchema = convertYupSchema(parser);
|
|
76
|
+
if (jsonSchema) {
|
|
77
|
+
return {
|
|
78
|
+
jsonSchema: jsonSchema,
|
|
79
|
+
};
|
|
103
80
|
}
|
|
104
81
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const { JSONSchema } = globalThis.__effectJsonSchema;
|
|
112
|
-
const jsonSchema = JSONSchema.make(parser);
|
|
113
|
-
return {
|
|
114
|
-
jsonSchema: options?.additionalProperties
|
|
115
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
116
|
-
: jsonSchema,
|
|
117
|
-
schemaType: "effect",
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
// Library not available
|
|
82
|
+
if (isEffectSchema(parser)) {
|
|
83
|
+
const jsonSchema = convertEffectSchema(parser);
|
|
84
|
+
if (jsonSchema) {
|
|
85
|
+
return {
|
|
86
|
+
jsonSchema: jsonSchema,
|
|
87
|
+
};
|
|
123
88
|
}
|
|
124
89
|
}
|
|
125
90
|
// Future schema types can be added here...
|
|
@@ -127,66 +92,64 @@ function schemaToJsonSchema(schema, options) {
|
|
|
127
92
|
return undefined;
|
|
128
93
|
}
|
|
129
94
|
/**
|
|
130
|
-
*
|
|
131
|
-
* This should be called by the consuming application if they want to enable
|
|
132
|
-
* conversion for schemas that don't have built-in JSON Schema support
|
|
95
|
+
* Check if a schema can be converted to JSON Schema
|
|
133
96
|
*/
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
97
|
+
function canConvertSchema(schema) {
|
|
98
|
+
const result = schemaToJsonSchema(schema);
|
|
99
|
+
return result !== undefined;
|
|
100
|
+
}
|
|
101
|
+
function isZodSchema(schema) {
|
|
102
|
+
return isZod3Schema(schema) || isZod4Schema(schema);
|
|
103
|
+
}
|
|
104
|
+
function isZod3Schema(schema) {
|
|
105
|
+
return "_def" in schema && "parse" in schema && "parseAsync" in schema && "safeParse" in schema;
|
|
106
|
+
}
|
|
107
|
+
function isZod4Schema(schema) {
|
|
108
|
+
return "_zod" in schema;
|
|
109
|
+
}
|
|
110
|
+
function convertZodSchema(schema, options) {
|
|
111
|
+
if (isZod4Schema(schema)) {
|
|
112
|
+
return convertZod4Schema(schema, options);
|
|
138
113
|
}
|
|
139
|
-
|
|
140
|
-
|
|
114
|
+
if (isZod3Schema(schema)) {
|
|
115
|
+
return convertZod3Schema(schema, options);
|
|
141
116
|
}
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
function convertZod3Schema(schema, options) {
|
|
120
|
+
const useReferences = options?.useReferences ?? false;
|
|
121
|
+
return (0, zod_to_json_schema_1.zodToJsonSchema)(schema, {
|
|
122
|
+
$refStrategy: useReferences ? "root" : "none",
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function convertZod4Schema(schema, options) {
|
|
126
|
+
const useReferences = options?.useReferences ?? false;
|
|
127
|
+
return z4.toJSONSchema(schema, {
|
|
128
|
+
target: "draft-7",
|
|
129
|
+
io: "output",
|
|
130
|
+
reused: useReferences ? "ref" : "inline",
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function isYupSchema(schema) {
|
|
134
|
+
return "spec" in schema && "_typeCheck" in schema;
|
|
135
|
+
}
|
|
136
|
+
function convertYupSchema(schema) {
|
|
142
137
|
try {
|
|
143
|
-
|
|
144
|
-
globalThis.__yupToJsonSchema = await import("@sodaru/yup-to-json-schema");
|
|
138
|
+
return (0, yup_to_json_schema_1.convertSchema)(schema);
|
|
145
139
|
}
|
|
146
140
|
catch {
|
|
147
|
-
|
|
141
|
+
return undefined;
|
|
148
142
|
}
|
|
143
|
+
}
|
|
144
|
+
function isEffectSchema(schema) {
|
|
145
|
+
return "ast" in schema && typeof schema.ast === "object" && typeof schema.ast._tag === "string";
|
|
146
|
+
}
|
|
147
|
+
function convertEffectSchema(schema) {
|
|
149
148
|
try {
|
|
150
|
-
|
|
151
|
-
let module;
|
|
152
|
-
try {
|
|
153
|
-
module = await import("effect");
|
|
154
|
-
}
|
|
155
|
-
catch { }
|
|
156
|
-
if (module?.JSONSchema) {
|
|
157
|
-
// @ts-ignore
|
|
158
|
-
globalThis.__effectJsonSchema = { JSONSchema: module.JSONSchema };
|
|
159
|
-
}
|
|
149
|
+
return effect_1.JSONSchema.make(schema);
|
|
160
150
|
}
|
|
161
151
|
catch {
|
|
162
|
-
|
|
152
|
+
return undefined;
|
|
163
153
|
}
|
|
164
154
|
}
|
|
165
|
-
/**
|
|
166
|
-
* Check if a schema can be converted to JSON Schema
|
|
167
|
-
*/
|
|
168
|
-
function canConvertSchema(schema) {
|
|
169
|
-
const result = schemaToJsonSchema(schema);
|
|
170
|
-
return result !== undefined;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Get the detected schema type
|
|
174
|
-
*/
|
|
175
|
-
function detectSchemaType(schema) {
|
|
176
|
-
const result = schemaToJsonSchema(schema);
|
|
177
|
-
return result?.schemaType ?? "unknown";
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Check if the conversion libraries are initialized
|
|
181
|
-
*/
|
|
182
|
-
function areConvertersInitialized() {
|
|
183
|
-
return {
|
|
184
|
-
// @ts-ignore
|
|
185
|
-
zod: typeof globalThis.__zodToJsonSchema !== "undefined",
|
|
186
|
-
// @ts-ignore
|
|
187
|
-
yup: typeof globalThis.__yupToJsonSchema !== "undefined",
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
effect: typeof globalThis.__effectJsonSchema !== "undefined",
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
155
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,gDA2DC;AAKD,4CAGC;AAED,kCAEC;AA5GD,2DAAqD;AACrD,2CAA6B;AAC7B,mEAA2D;AAC3D,mCAAwD;AAsBxD;;;;;;;;;;;GAWG;AACH,SAAgB,kBAAkB,CAChC,MAAc,EACd,OAA2B;IAE3B,MAAM,MAAM,GAAG,MAAa,CAAC;IAE7B,4EAA4E;IAC5E,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QAC9C,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;YAEzC,OAAO;gBACL,UAAU;aACX,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,kDAAkD;QACpD,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,MAAM,UAAU,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAErD,IAAI,UAAU,EAAE,CAAC;YACf,OAAO;gBACL,UAAU,EAAE,UAAU;aACvB,CAAC;QACJ,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KAAK,QAAQ,CAAC;AAClG,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAW;IACtC,IAAI,CAAC;QACH,OAAO,mBAAgB,CAAC,IAAI,CAAC,MAAM,CAAe,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,23 +3,18 @@ export type Schema = unknown;
|
|
|
3
3
|
export type { JSONSchema };
|
|
4
4
|
export interface ConversionOptions {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Enables support for references in the schema.
|
|
7
|
+
* This is required for recursive schemas, e.g. with `z.lazy`.
|
|
8
|
+
* However, not all language models and providers support such references.
|
|
9
|
+
* Defaults to `false`.
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Additional JSON Schema properties to merge
|
|
11
|
-
*/
|
|
12
|
-
additionalProperties?: Record<string, unknown>;
|
|
11
|
+
useReferences?: boolean;
|
|
13
12
|
}
|
|
14
13
|
export interface ConversionResult {
|
|
15
14
|
/**
|
|
16
15
|
* The JSON Schema representation (JSON Schema Draft 7)
|
|
17
16
|
*/
|
|
18
17
|
jsonSchema: JSONSchema;
|
|
19
|
-
/**
|
|
20
|
-
* The detected schema type
|
|
21
|
-
*/
|
|
22
|
-
schemaType: "zod" | "yup" | "arktype" | "effect" | "valibot" | "superstruct" | "runtypes" | "typebox" | "unknown";
|
|
23
18
|
}
|
|
24
19
|
/**
|
|
25
20
|
* Convert a schema from various validation libraries to JSON Schema
|
|
@@ -34,25 +29,8 @@ export interface ConversionResult {
|
|
|
34
29
|
* @returns The conversion result or undefined if conversion is not possible
|
|
35
30
|
*/
|
|
36
31
|
export declare function schemaToJsonSchema(schema: Schema, options?: ConversionOptions): ConversionResult | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Initialize the schema conversion libraries
|
|
39
|
-
* This should be called by the consuming application if they want to enable
|
|
40
|
-
* conversion for schemas that don't have built-in JSON Schema support
|
|
41
|
-
*/
|
|
42
|
-
export declare function initializeSchemaConverters(): Promise<void>;
|
|
43
32
|
/**
|
|
44
33
|
* Check if a schema can be converted to JSON Schema
|
|
45
34
|
*/
|
|
46
35
|
export declare function canConvertSchema(schema: Schema): boolean;
|
|
47
|
-
|
|
48
|
-
* Get the detected schema type
|
|
49
|
-
*/
|
|
50
|
-
export declare function detectSchemaType(schema: Schema): ConversionResult["schemaType"];
|
|
51
|
-
/**
|
|
52
|
-
* Check if the conversion libraries are initialized
|
|
53
|
-
*/
|
|
54
|
-
export declare function areConvertersInitialized(): {
|
|
55
|
-
zod: boolean;
|
|
56
|
-
yup: boolean;
|
|
57
|
-
effect: boolean;
|
|
58
|
-
};
|
|
36
|
+
export declare function isZodSchema(schema: any): boolean;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
2
|
+
import * as z4 from "zod/v4";
|
|
3
|
+
import { convertSchema } from "@sodaru/yup-to-json-schema";
|
|
4
|
+
import { JSONSchema as EffectJSONSchema } from "effect";
|
|
1
5
|
/**
|
|
2
6
|
* Convert a schema from various validation libraries to JSON Schema
|
|
3
7
|
*
|
|
@@ -16,103 +20,43 @@ export function schemaToJsonSchema(schema, options) {
|
|
|
16
20
|
if (typeof parser.toJsonSchema === "function") {
|
|
17
21
|
try {
|
|
18
22
|
const jsonSchema = parser.toJsonSchema();
|
|
19
|
-
// Determine if it's Zod or ArkType based on other methods
|
|
20
|
-
const schemaType = typeof parser.parseAsync === "function" || typeof parser.parse === "function"
|
|
21
|
-
? "zod"
|
|
22
|
-
: "arktype";
|
|
23
23
|
return {
|
|
24
|
-
jsonSchema
|
|
25
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
26
|
-
: jsonSchema,
|
|
27
|
-
schemaType,
|
|
24
|
+
jsonSchema,
|
|
28
25
|
};
|
|
29
26
|
}
|
|
30
27
|
catch (error) {
|
|
31
28
|
// If toJsonSchema fails, continue to other checks
|
|
32
29
|
}
|
|
33
30
|
}
|
|
31
|
+
if (isZodSchema(parser)) {
|
|
32
|
+
const jsonSchema = convertZodSchema(parser, options);
|
|
33
|
+
if (jsonSchema) {
|
|
34
|
+
return {
|
|
35
|
+
jsonSchema: jsonSchema,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
34
39
|
// Check if it's a TypeBox schema (has Static and Kind symbols)
|
|
35
40
|
if (parser[Symbol.for("TypeBox.Kind")] !== undefined) {
|
|
36
41
|
// TypeBox schemas are already JSON Schema compliant
|
|
37
42
|
return {
|
|
38
|
-
jsonSchema:
|
|
39
|
-
? { ...parser, ...options.additionalProperties }
|
|
40
|
-
: parser,
|
|
41
|
-
schemaType: "typebox",
|
|
43
|
+
jsonSchema: parser,
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// @ts-ignore - This is intentionally dynamic
|
|
51
|
-
if (typeof globalThis.__zodToJsonSchema !== "undefined") {
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
const { zodToJsonSchema } = globalThis.__zodToJsonSchema;
|
|
54
|
-
const jsonSchema = options?.name
|
|
55
|
-
? zodToJsonSchema(parser, options.name)
|
|
56
|
-
: zodToJsonSchema(parser);
|
|
57
|
-
if (jsonSchema && typeof jsonSchema === "object" && "$schema" in jsonSchema) {
|
|
58
|
-
const { $schema, ...rest } = jsonSchema;
|
|
59
|
-
return {
|
|
60
|
-
jsonSchema: options?.additionalProperties
|
|
61
|
-
? { ...rest, ...options.additionalProperties }
|
|
62
|
-
: rest,
|
|
63
|
-
schemaType: "zod",
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
jsonSchema: options?.additionalProperties
|
|
68
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
69
|
-
: jsonSchema,
|
|
70
|
-
schemaType: "zod",
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
// Library not available
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// Check if it's a Yup schema
|
|
79
|
-
if (typeof parser.validateSync === "function" && typeof parser.describe === "function") {
|
|
80
|
-
try {
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
if (typeof globalThis.__yupToJsonSchema !== "undefined") {
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
const { convertSchema } = globalThis.__yupToJsonSchema;
|
|
85
|
-
const jsonSchema = convertSchema(parser);
|
|
86
|
-
return {
|
|
87
|
-
jsonSchema: options?.additionalProperties
|
|
88
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
89
|
-
: jsonSchema,
|
|
90
|
-
schemaType: "yup",
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
// Library not available
|
|
46
|
+
if (isYupSchema(parser)) {
|
|
47
|
+
const jsonSchema = convertYupSchema(parser);
|
|
48
|
+
if (jsonSchema) {
|
|
49
|
+
return {
|
|
50
|
+
jsonSchema: jsonSchema,
|
|
51
|
+
};
|
|
96
52
|
}
|
|
97
53
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const { JSONSchema } = globalThis.__effectJsonSchema;
|
|
105
|
-
const jsonSchema = JSONSchema.make(parser);
|
|
106
|
-
return {
|
|
107
|
-
jsonSchema: options?.additionalProperties
|
|
108
|
-
? { ...jsonSchema, ...options.additionalProperties }
|
|
109
|
-
: jsonSchema,
|
|
110
|
-
schemaType: "effect",
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
// Library not available
|
|
54
|
+
if (isEffectSchema(parser)) {
|
|
55
|
+
const jsonSchema = convertEffectSchema(parser);
|
|
56
|
+
if (jsonSchema) {
|
|
57
|
+
return {
|
|
58
|
+
jsonSchema: jsonSchema,
|
|
59
|
+
};
|
|
116
60
|
}
|
|
117
61
|
}
|
|
118
62
|
// Future schema types can be added here...
|
|
@@ -120,66 +64,64 @@ export function schemaToJsonSchema(schema, options) {
|
|
|
120
64
|
return undefined;
|
|
121
65
|
}
|
|
122
66
|
/**
|
|
123
|
-
*
|
|
124
|
-
* This should be called by the consuming application if they want to enable
|
|
125
|
-
* conversion for schemas that don't have built-in JSON Schema support
|
|
67
|
+
* Check if a schema can be converted to JSON Schema
|
|
126
68
|
*/
|
|
127
|
-
export
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
69
|
+
export function canConvertSchema(schema) {
|
|
70
|
+
const result = schemaToJsonSchema(schema);
|
|
71
|
+
return result !== undefined;
|
|
72
|
+
}
|
|
73
|
+
export function isZodSchema(schema) {
|
|
74
|
+
return isZod3Schema(schema) || isZod4Schema(schema);
|
|
75
|
+
}
|
|
76
|
+
function isZod3Schema(schema) {
|
|
77
|
+
return "_def" in schema && "parse" in schema && "parseAsync" in schema && "safeParse" in schema;
|
|
78
|
+
}
|
|
79
|
+
function isZod4Schema(schema) {
|
|
80
|
+
return "_zod" in schema;
|
|
81
|
+
}
|
|
82
|
+
function convertZodSchema(schema, options) {
|
|
83
|
+
if (isZod4Schema(schema)) {
|
|
84
|
+
return convertZod4Schema(schema, options);
|
|
131
85
|
}
|
|
132
|
-
|
|
133
|
-
|
|
86
|
+
if (isZod3Schema(schema)) {
|
|
87
|
+
return convertZod3Schema(schema, options);
|
|
134
88
|
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
function convertZod3Schema(schema, options) {
|
|
92
|
+
const useReferences = options?.useReferences ?? false;
|
|
93
|
+
return zodToJsonSchema(schema, {
|
|
94
|
+
$refStrategy: useReferences ? "root" : "none",
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function convertZod4Schema(schema, options) {
|
|
98
|
+
const useReferences = options?.useReferences ?? false;
|
|
99
|
+
return z4.toJSONSchema(schema, {
|
|
100
|
+
target: "draft-7",
|
|
101
|
+
io: "output",
|
|
102
|
+
reused: useReferences ? "ref" : "inline",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function isYupSchema(schema) {
|
|
106
|
+
return "spec" in schema && "_typeCheck" in schema;
|
|
107
|
+
}
|
|
108
|
+
function convertYupSchema(schema) {
|
|
135
109
|
try {
|
|
136
|
-
|
|
137
|
-
globalThis.__yupToJsonSchema = await import("@sodaru/yup-to-json-schema");
|
|
110
|
+
return convertSchema(schema);
|
|
138
111
|
}
|
|
139
112
|
catch {
|
|
140
|
-
|
|
113
|
+
return undefined;
|
|
141
114
|
}
|
|
115
|
+
}
|
|
116
|
+
function isEffectSchema(schema) {
|
|
117
|
+
return "ast" in schema && typeof schema.ast === "object" && typeof schema.ast._tag === "string";
|
|
118
|
+
}
|
|
119
|
+
function convertEffectSchema(schema) {
|
|
142
120
|
try {
|
|
143
|
-
|
|
144
|
-
let module;
|
|
145
|
-
try {
|
|
146
|
-
module = await import("effect");
|
|
147
|
-
}
|
|
148
|
-
catch { }
|
|
149
|
-
if (module?.JSONSchema) {
|
|
150
|
-
// @ts-ignore
|
|
151
|
-
globalThis.__effectJsonSchema = { JSONSchema: module.JSONSchema };
|
|
152
|
-
}
|
|
121
|
+
return EffectJSONSchema.make(schema);
|
|
153
122
|
}
|
|
154
123
|
catch {
|
|
155
|
-
|
|
124
|
+
return undefined;
|
|
156
125
|
}
|
|
157
126
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Check if a schema can be converted to JSON Schema
|
|
160
|
-
*/
|
|
161
|
-
export function canConvertSchema(schema) {
|
|
162
|
-
const result = schemaToJsonSchema(schema);
|
|
163
|
-
return result !== undefined;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Get the detected schema type
|
|
167
|
-
*/
|
|
168
|
-
export function detectSchemaType(schema) {
|
|
169
|
-
const result = schemaToJsonSchema(schema);
|
|
170
|
-
return result?.schemaType ?? "unknown";
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Check if the conversion libraries are initialized
|
|
174
|
-
*/
|
|
175
|
-
export function areConvertersInitialized() {
|
|
176
|
-
return {
|
|
177
|
-
// @ts-ignore
|
|
178
|
-
zod: typeof globalThis.__zodToJsonSchema !== "undefined",
|
|
179
|
-
// @ts-ignore
|
|
180
|
-
yup: typeof globalThis.__yupToJsonSchema !== "undefined",
|
|
181
|
-
// @ts-ignore
|
|
182
|
-
effect: typeof globalThis.__effectJsonSchema !== "undefined",
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
127
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAsBxD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,OAA2B;IAE3B,MAAM,MAAM,GAAG,MAAa,CAAC;IAE7B,4EAA4E;IAC5E,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QAC9C,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;YAEzC,OAAO;gBACL,UAAU;aACX,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,kDAAkD;QACpD,CAAC;IACH,CAAC;IAED,I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P,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAAW;IACjC,OAAO,KAAK,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC;AAClG,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAW;IACtC,IAAI,CAAC;QACH,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAe,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trigger.dev/schema-to-json",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Convert various schema validation libraries to JSON Schema",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,40 +31,34 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"zod-to-json-schema": "^3.24.
|
|
35
|
-
"@sodaru/yup-to-json-schema": "^2
|
|
36
|
-
"
|
|
34
|
+
"zod-to-json-schema": "^3.24.0",
|
|
35
|
+
"@sodaru/yup-to-json-schema": "^2",
|
|
36
|
+
"zod": "3.25.76",
|
|
37
|
+
"effect": "^3",
|
|
38
|
+
"@trigger.dev/core": "4.0.4"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"arktype": "^2.0.0",
|
|
40
|
-
"effect": "^3.11.11",
|
|
41
42
|
"runtypes": "^6.7.0",
|
|
42
43
|
"superstruct": "^2.0.2",
|
|
43
44
|
"tshy": "^3.0.2",
|
|
44
45
|
"@sinclair/typebox": "^0.34.3",
|
|
45
46
|
"valibot": "^1.1.0",
|
|
46
47
|
"yup": "^1.7.0",
|
|
47
|
-
"zod": "^3.24.1 || ^4.0.0",
|
|
48
48
|
"rimraf": "6.0.1",
|
|
49
49
|
"@arethetypeswrong/cli": "^0.15.4"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"arktype": ">=2.0.0",
|
|
53
|
-
"effect": ">=3.0.0",
|
|
54
53
|
"runtypes": ">=5.0.0",
|
|
55
54
|
"superstruct": ">=0.14.2",
|
|
56
55
|
"@sinclair/typebox": ">=0.34.30",
|
|
57
|
-
"valibot": ">=0.41.0"
|
|
58
|
-
"yup": ">=1.0.0",
|
|
59
|
-
"zod": "^3.24.1 || ^4.0.0"
|
|
56
|
+
"valibot": ">=0.41.0"
|
|
60
57
|
},
|
|
61
58
|
"peerDependenciesMeta": {
|
|
62
59
|
"arktype": {
|
|
63
60
|
"optional": true
|
|
64
61
|
},
|
|
65
|
-
"effect": {
|
|
66
|
-
"optional": true
|
|
67
|
-
},
|
|
68
62
|
"runtypes": {
|
|
69
63
|
"optional": true
|
|
70
64
|
},
|
|
@@ -76,12 +70,6 @@
|
|
|
76
70
|
},
|
|
77
71
|
"valibot": {
|
|
78
72
|
"optional": true
|
|
79
|
-
},
|
|
80
|
-
"yup": {
|
|
81
|
-
"optional": true
|
|
82
|
-
},
|
|
83
|
-
"zod": {
|
|
84
|
-
"optional": true
|
|
85
73
|
}
|
|
86
74
|
},
|
|
87
75
|
"tshy": {
|