@standard-community/standard-json 0.3.0-rc.5 → 0.3.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.
package/README.md CHANGED
@@ -33,3 +33,45 @@ const schema = {
33
33
  // Convert it to JSON Schema
34
34
  const jsonSchema = await toJsonSchema(schema);
35
35
  ```
36
+
37
+ ### Sync Usage
38
+
39
+ This is useful for -
40
+
41
+ #### Adding support for Unsupported validation libs
42
+
43
+ ```ts
44
+ import { toJsonSchema, loadVendor } from "@standard-community/standard-json";
45
+ import { convertSchemaToJson } from "your-validation-lib";
46
+
47
+ // The lib should support Standard Schema, like Sury
48
+ // as we use 'schema["~standard"].vendor' to get the vendor name
49
+ // Eg. loadVendor(zod["~standard"].vendor, convertorFunction)
50
+ loadVendor("validation-lib-name", convertSchemaToJson)
51
+
52
+ // Define your validation schema
53
+ const schema = {
54
+ // ...
55
+ };
56
+
57
+ // Convert it to JSON Schema
58
+ const jsonSchema = toJsonSchema(schema);
59
+ ```
60
+
61
+ #### Customize the toJSONFunction of a supported lib
62
+
63
+ ```ts
64
+ import { toJsonSchema, loadVendor } from "@standard-community/standard-json";
65
+ import zodHandler from "@standard-community/standard-json/zod";
66
+
67
+ // Or pass a custom implmentation
68
+ loadVendor("zod", zodHandler())
69
+
70
+ // Define your validation schema
71
+ const schema = {
72
+ // ...
73
+ };
74
+
75
+ // Convert it to JSON Schema
76
+ const jsonSchema = await toJsonSchema(schema);
77
+ ```
package/dist/index.cjs CHANGED
@@ -1,7 +1,59 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CeYTpXSN.cjs');
3
+ var quansync = require('quansync');
4
+ var utils = require('./utils-D7AosoZA.cjs');
4
5
 
6
+ function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
5
7
 
8
+ const getToJsonSchemaFn = async (vendor) => {
9
+ const cached = utils.validationMapper.get(vendor);
10
+ if (cached) {
11
+ return cached;
12
+ }
13
+ let vendorFnPromise;
14
+ switch (vendor) {
15
+ case "arktype":
16
+ vendorFnPromise = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./vendors/arktype.cjs')); })).default();
17
+ break;
18
+ case "effect":
19
+ vendorFnPromise = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./vendors/effect.cjs')); })).default();
20
+ break;
21
+ case "valibot":
22
+ vendorFnPromise = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./vendors/valibot.cjs')); })).default();
23
+ break;
24
+ case "zod":
25
+ vendorFnPromise = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./vendors/zod.cjs')); })).default();
26
+ break;
27
+ default:
28
+ throw new Error(
29
+ utils.errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
30
+ );
31
+ }
32
+ const vendorFn = await vendorFnPromise;
33
+ utils.validationMapper.set(vendor, vendorFn);
34
+ return vendorFn;
35
+ };
6
36
 
7
- exports.toJsonSchema = index.toJsonSchema;
37
+ const toJsonSchema = quansync.quansync({
38
+ sync: (schema, options) => {
39
+ const fn = utils.validationMapper.get(schema["~standard"].vendor);
40
+ if (!fn) {
41
+ throw new Error(
42
+ utils.errorMessageWrapper(
43
+ `Unsupported schema vendor "${schema["~standard"].vendor}".`
44
+ )
45
+ );
46
+ }
47
+ return fn(schema, options);
48
+ },
49
+ async: async (schema, options) => {
50
+ const fn = await getToJsonSchemaFn(schema["~standard"].vendor);
51
+ return fn(schema, options);
52
+ }
53
+ });
54
+ function loadVendor(vendor, fn) {
55
+ utils.validationMapper.set(vendor, fn);
56
+ }
57
+
58
+ exports.loadVendor = loadVendor;
59
+ exports.toJsonSchema = toJsonSchema;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,12 @@
1
+ import * as quansync from 'quansync';
2
+ import * as json_schema from 'json-schema';
1
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
2
- import { JSONSchema7 } from 'json-schema';
4
+ import { T as ToJsonSchemaFn } from './utils-1JaZ8JC_.js';
3
5
 
4
6
  /**
5
7
  * Converts a Standard Schema to a JSON schema.
6
8
  */
7
- declare const toJsonSchema: (schema: StandardSchemaV1, options?: Record<string, unknown>) => Promise<JSONSchema7>;
9
+ declare const toJsonSchema: quansync.QuansyncFn<json_schema.JSONSchema7 | Promise<json_schema.JSONSchema7>, [schema: StandardSchemaV1<unknown, unknown>, options?: Record<string, unknown> | undefined]>;
10
+ declare function loadVendor(vendor: string, fn: ToJsonSchemaFn): void;
8
11
 
9
- export { toJsonSchema };
12
+ export { ToJsonSchemaFn, loadVendor, toJsonSchema };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,12 @@
1
+ import * as quansync from 'quansync';
2
+ import * as json_schema from 'json-schema';
1
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
2
- import { JSONSchema7 } from 'json-schema';
4
+ import { T as ToJsonSchemaFn } from './utils-1JaZ8JC_.js';
3
5
 
4
6
  /**
5
7
  * Converts a Standard Schema to a JSON schema.
6
8
  */
7
- declare const toJsonSchema: (schema: StandardSchemaV1, options?: Record<string, unknown>) => Promise<JSONSchema7>;
9
+ declare const toJsonSchema: quansync.QuansyncFn<json_schema.JSONSchema7 | Promise<json_schema.JSONSchema7>, [schema: StandardSchemaV1<unknown, unknown>, options?: Record<string, unknown> | undefined]>;
10
+ declare function loadVendor(vendor: string, fn: ToJsonSchemaFn): void;
8
11
 
9
- export { toJsonSchema };
12
+ export { ToJsonSchemaFn, loadVendor, toJsonSchema };
package/dist/index.js CHANGED
@@ -1 +1,54 @@
1
- export { t as toJsonSchema } from './index-TV3as6RE.js';
1
+ import { quansync } from 'quansync';
2
+ import { v as validationMapper, e as errorMessageWrapper } from './utils-BOYKSG8-.js';
3
+
4
+ const getToJsonSchemaFn = async (vendor) => {
5
+ const cached = validationMapper.get(vendor);
6
+ if (cached) {
7
+ return cached;
8
+ }
9
+ let vendorFnPromise;
10
+ switch (vendor) {
11
+ case "arktype":
12
+ vendorFnPromise = (await import('./vendors/arktype.js')).default();
13
+ break;
14
+ case "effect":
15
+ vendorFnPromise = (await import('./vendors/effect.js')).default();
16
+ break;
17
+ case "valibot":
18
+ vendorFnPromise = (await import('./vendors/valibot.js')).default();
19
+ break;
20
+ case "zod":
21
+ vendorFnPromise = (await import('./vendors/zod.js')).default();
22
+ break;
23
+ default:
24
+ throw new Error(
25
+ errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
26
+ );
27
+ }
28
+ const vendorFn = await vendorFnPromise;
29
+ validationMapper.set(vendor, vendorFn);
30
+ return vendorFn;
31
+ };
32
+
33
+ const toJsonSchema = quansync({
34
+ sync: (schema, options) => {
35
+ const fn = validationMapper.get(schema["~standard"].vendor);
36
+ if (!fn) {
37
+ throw new Error(
38
+ errorMessageWrapper(
39
+ `Unsupported schema vendor "${schema["~standard"].vendor}".`
40
+ )
41
+ );
42
+ }
43
+ return fn(schema, options);
44
+ },
45
+ async: async (schema, options) => {
46
+ const fn = await getToJsonSchemaFn(schema["~standard"].vendor);
47
+ return fn(schema, options);
48
+ }
49
+ });
50
+ function loadVendor(vendor, fn) {
51
+ validationMapper.set(vendor, fn);
52
+ }
53
+
54
+ export { loadVendor, toJsonSchema };
@@ -0,0 +1,5 @@
1
+ import { JSONSchema7 } from 'json-schema';
2
+
3
+ type ToJsonSchemaFn = (schema: unknown, options?: Record<string, unknown>) => JSONSchema7 | Promise<JSONSchema7>;
4
+
5
+ export type { ToJsonSchemaFn as T };
@@ -0,0 +1,4 @@
1
+ const errorMessageWrapper = (message) => `standard-json: ${message}`;
2
+ const validationMapper = /* @__PURE__ */ new Map();
3
+
4
+ export { errorMessageWrapper as e, validationMapper as v };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ const errorMessageWrapper = (message) => `standard-json: ${message}`;
4
+ const validationMapper = /* @__PURE__ */ new Map();
5
+
6
+ exports.errorMessageWrapper = errorMessageWrapper;
7
+ exports.validationMapper = validationMapper;
@@ -4,4 +4,4 @@ async function getToJsonSchemaFn() {
4
4
  return (schema, options) => schema.toJsonSchema(options);
5
5
  }
6
6
 
7
- exports.default = getToJsonSchemaFn;
7
+ module.exports = getToJsonSchemaFn;
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CeYTpXSN.cjs');
3
+ var utils = require('../utils-D7AosoZA.cjs');
4
4
 
5
5
  async function getToJsonSchemaFn() {
6
6
  try {
7
7
  const { JSONSchema } = await import('effect');
8
8
  return (schema) => JSONSchema.make(schema);
9
9
  } catch {
10
- throw new Error(index.errorMessageWrapper('Missing dependencies "effect".'));
10
+ throw new Error(utils.errorMessageWrapper('Missing dependencies "effect".'));
11
11
  }
12
12
  }
13
13
 
14
- exports.default = getToJsonSchemaFn;
14
+ module.exports = getToJsonSchemaFn;
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -1,4 +1,4 @@
1
- import { e as errorMessageWrapper } from './index-TV3as6RE.js';
1
+ import { e as errorMessageWrapper } from '../utils-BOYKSG8-.js';
2
2
 
3
3
  async function getToJsonSchemaFn() {
4
4
  try {
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../utils-D7AosoZA.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ try {
7
+ const { toJsonSchema } = await import('@valibot/to-json-schema');
8
+ return toJsonSchema;
9
+ } catch {
10
+ throw new Error(
11
+ utils.errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".')
12
+ );
13
+ }
14
+ }
15
+
16
+ module.exports = getToJsonSchemaFn;
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -1,11 +1,13 @@
1
- import { e as errorMessageWrapper } from './index-TV3as6RE.js';
1
+ import { e as errorMessageWrapper } from '../utils-BOYKSG8-.js';
2
2
 
3
3
  async function getToJsonSchemaFn() {
4
4
  try {
5
5
  const { toJsonSchema } = await import('@valibot/to-json-schema');
6
6
  return toJsonSchema;
7
7
  } catch {
8
- throw new Error(errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".'));
8
+ throw new Error(
9
+ errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".')
10
+ );
9
11
  }
10
12
  }
11
13
 
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../utils-D7AosoZA.cjs');
4
+
5
+ async function getToJsonSchemaFn() {
6
+ return async (schema, options) => {
7
+ let handler;
8
+ if ("_zod" in schema) {
9
+ try {
10
+ handler = await import('zod/v4/core').then(
11
+ (mod) => mod.toJSONSchema
12
+ );
13
+ } catch {
14
+ throw new Error(utils.errorMessageWrapper('Missing dependencies "zod v4".'));
15
+ }
16
+ } else {
17
+ try {
18
+ handler = await import('zod-to-json-schema').then(
19
+ (mod) => mod.zodToJsonSchema
20
+ );
21
+ } catch {
22
+ throw new Error(
23
+ utils.errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
24
+ );
25
+ }
26
+ }
27
+ return handler(schema, options);
28
+ };
29
+ }
30
+
31
+ module.exports = getToJsonSchemaFn;
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,6 @@
1
+ import { T as ToJsonSchemaFn } from '../utils-1JaZ8JC_.js';
2
+ import 'json-schema';
3
+
4
+ declare function getToJsonSchemaFn(): Promise<ToJsonSchemaFn>;
5
+
6
+ export { getToJsonSchemaFn as default };
@@ -0,0 +1,29 @@
1
+ import { e as errorMessageWrapper } from '../utils-BOYKSG8-.js';
2
+
3
+ async function getToJsonSchemaFn() {
4
+ return async (schema, options) => {
5
+ let handler;
6
+ if ("_zod" in schema) {
7
+ try {
8
+ handler = await import('zod/v4/core').then(
9
+ (mod) => mod.toJSONSchema
10
+ );
11
+ } catch {
12
+ throw new Error(errorMessageWrapper('Missing dependencies "zod v4".'));
13
+ }
14
+ } else {
15
+ try {
16
+ handler = await import('zod-to-json-schema').then(
17
+ (mod) => mod.zodToJsonSchema
18
+ );
19
+ } catch {
20
+ throw new Error(
21
+ errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
22
+ );
23
+ }
24
+ }
25
+ return handler(schema, options);
26
+ };
27
+ }
28
+
29
+ export { getToJsonSchemaFn as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standard-community/standard-json",
3
- "version": "0.3.0-rc.5",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs",
@@ -22,20 +22,61 @@
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "git+https://github.com/standard-community/standard-json.git",
26
- "directory": "packages/core"
25
+ "url": "git+https://github.com/standard-community/standard-json.git"
27
26
  },
28
27
  "bugs": {
29
28
  "url": "https://github.com/standard-community/standard-json/issues"
30
29
  },
31
30
  "exports": {
32
- "import": {
33
- "types": "./dist/index.d.ts",
34
- "default": "./dist/index.js"
31
+ ".": {
32
+ "import": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "require": {
37
+ "types": "./dist/index.d.cts",
38
+ "default": "./dist/index.cjs"
39
+ }
35
40
  },
36
- "require": {
37
- "types": "./dist/index.d.cts",
38
- "default": "./dist/index.cjs"
41
+ "./arktype": {
42
+ "import": {
43
+ "types": "./dist/vendors/arktype.d.ts",
44
+ "default": "./dist/vendors/arktype.js"
45
+ },
46
+ "require": {
47
+ "types": "./dist/vendors/arktype.d.cts",
48
+ "default": "./dist/vendors/arktype.cjs"
49
+ }
50
+ },
51
+ "./effect": {
52
+ "import": {
53
+ "types": "./dist/vendors/effect.d.ts",
54
+ "default": "./dist/vendors/effect.js"
55
+ },
56
+ "require": {
57
+ "types": "./dist/vendors/effect.d.cts",
58
+ "default": "./dist/vendors/effect.cjs"
59
+ }
60
+ },
61
+ "./valibot": {
62
+ "import": {
63
+ "types": "./dist/vendors/valibot.d.ts",
64
+ "default": "./dist/vendors/valibot.js"
65
+ },
66
+ "require": {
67
+ "types": "./dist/vendors/valibot.d.cts",
68
+ "default": "./dist/vendors/valibot.cjs"
69
+ }
70
+ },
71
+ "./zod": {
72
+ "import": {
73
+ "types": "./dist/vendors/zod.d.ts",
74
+ "default": "./dist/vendors/zod.js"
75
+ },
76
+ "require": {
77
+ "types": "./dist/vendors/zod.d.cts",
78
+ "default": "./dist/vendors/zod.cjs"
79
+ }
39
80
  }
40
81
  },
41
82
  "peerDependencies": {
@@ -44,6 +85,7 @@
44
85
  "@valibot/to-json-schema": "^1.3.0",
45
86
  "arktype": "^2.1.20",
46
87
  "effect": "^3.16.8",
88
+ "quansync": "^0.2.11",
47
89
  "valibot": "^1.1.0",
48
90
  "zod": "^3.25.0 || ^4.0.0",
49
91
  "zod-to-json-schema": "^3.24.5"
@@ -70,6 +112,7 @@
70
112
  },
71
113
  "devDependencies": {
72
114
  "@biomejs/biome": "^2.0.4",
115
+ "@types/node": "^24.3.1",
73
116
  "pkgroll": "^2.13.1",
74
117
  "typescript": "^5.8.3",
75
118
  "vitest": "^3.2.4"
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- const errorMessageWrapper = (message) => `standard-json: ${message}`;
4
-
5
- const getToJsonSchemaFn = async (vendor) => {
6
- switch (vendor) {
7
- case "arktype":
8
- return (await Promise.resolve().then(function () { return require('./arktype-BCitmcgd.cjs'); })).default();
9
- case "effect":
10
- return (await Promise.resolve().then(function () { return require('./effect-BdLFlbKK.cjs'); })).default();
11
- case "valibot":
12
- return (await Promise.resolve().then(function () { return require('./valibot-DW5hlWjk.cjs'); })).default();
13
- case "zod":
14
- return (await Promise.resolve().then(function () { return require('./zod-CTiow-o0.cjs'); })).default();
15
- default:
16
- throw new Error(
17
- errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
18
- );
19
- }
20
- };
21
-
22
- const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].vendor).then(
23
- (toJsonSchema2) => toJsonSchema2(schema, options)
24
- );
25
-
26
- exports.errorMessageWrapper = errorMessageWrapper;
27
- exports.toJsonSchema = toJsonSchema;
@@ -1,24 +0,0 @@
1
- const errorMessageWrapper = (message) => `standard-json: ${message}`;
2
-
3
- const getToJsonSchemaFn = async (vendor) => {
4
- switch (vendor) {
5
- case "arktype":
6
- return (await import('./arktype-DUDu5yUt.js')).default();
7
- case "effect":
8
- return (await import('./effect-upmsZks7.js')).default();
9
- case "valibot":
10
- return (await import('./valibot-f_9pHZHS.js')).default();
11
- case "zod":
12
- return (await import('./zod-CQLI5Nm9.js')).default();
13
- default:
14
- throw new Error(
15
- errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
16
- );
17
- }
18
- };
19
-
20
- const toJsonSchema = (schema, options) => getToJsonSchemaFn(schema["~standard"].vendor).then(
21
- (toJsonSchema2) => toJsonSchema2(schema, options)
22
- );
23
-
24
- export { errorMessageWrapper as e, toJsonSchema as t };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-CeYTpXSN.cjs');
4
-
5
- async function getToJsonSchemaFn() {
6
- try {
7
- const { toJsonSchema } = await import('@valibot/to-json-schema');
8
- return toJsonSchema;
9
- } catch {
10
- throw new Error(index.errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".'));
11
- }
12
- }
13
-
14
- exports.default = getToJsonSchemaFn;
@@ -1,23 +0,0 @@
1
- import { e as errorMessageWrapper } from './index-TV3as6RE.js';
2
-
3
- async function getToJsonSchemaFn() {
4
- return async (schema, options) => {
5
- let handler;
6
- if ("_zod" in schema) {
7
- try {
8
- handler = await import('zod/v4/core').then((mod) => mod.toJSONSchema);
9
- } catch {
10
- throw new Error(errorMessageWrapper('Missing dependencies "zod v4".'));
11
- }
12
- } else {
13
- try {
14
- handler = await import('zod-to-json-schema').then((mod) => mod.zodToJsonSchema);
15
- } catch {
16
- throw new Error(errorMessageWrapper('Missing dependencies "zod-to-json-schema".'));
17
- }
18
- }
19
- return handler(schema, options);
20
- };
21
- }
22
-
23
- export { getToJsonSchemaFn as default };
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-CeYTpXSN.cjs');
4
-
5
- async function getToJsonSchemaFn() {
6
- return async (schema, options) => {
7
- let handler;
8
- if ("_zod" in schema) {
9
- try {
10
- handler = await import('zod/v4/core').then((mod) => mod.toJSONSchema);
11
- } catch {
12
- throw new Error(index.errorMessageWrapper('Missing dependencies "zod v4".'));
13
- }
14
- } else {
15
- try {
16
- handler = await import('zod-to-json-schema').then((mod) => mod.zodToJsonSchema);
17
- } catch {
18
- throw new Error(index.errorMessageWrapper('Missing dependencies "zod-to-json-schema".'));
19
- }
20
- }
21
- return handler(schema, options);
22
- };
23
- }
24
-
25
- exports.default = getToJsonSchemaFn;