json-schema-to-zod
Advanced tools
Comparing version 0.1.2 to 0.1.3
#!/usr/bin/env node | ||
export {}; |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
import { jsonSchemaToZod, jsonSchemaToZodDereffed } from "./jsonSchemaToZod"; | ||
export { jsonSchemaToZod, jsonSchemaToZodDereffed }; | ||
export default jsonSchemaToZod; |
@@ -0,0 +0,0 @@ "use strict"; |
import { JSONSchema7 } from "json-schema"; | ||
export declare const jsonSchemaToZodDereffed: (schema: JSONSchema7, name?: string | undefined, module?: boolean) => Promise<string>; | ||
export declare const jsonSchemaToZod: (schema: JSONSchema7, name?: string | undefined, module?: boolean) => string; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "json-schema-to-zod", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Converts JSON schema objects or files into Zod schemas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7Definition } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7Definition } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7 } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7 } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7Type } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
import { JSONSchema7 } from "json-schema"; | ||
export declare const parseDefault: (schema: JSONSchema7) => string; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7Type } from "json-schema"; |
@@ -6,5 +6,7 @@ "use strict"; | ||
return Array.isArray(schema.enum) | ||
? `z.enum([${schema.enum.map((x) => JSON.stringify(x))}])` | ||
? schema.enum.every((x) => typeof x === "string") | ||
? `z.enum([${schema.enum.map((x) => JSON.stringify(x))}])` | ||
: `z.union([${schema.enum.map((x) => `z.literal(${JSON.stringify(x)})`)}])` | ||
: `z.literal(${JSON.stringify(schema.enum)})`; | ||
}; | ||
exports.parseEnum = parseEnum; |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7Definition } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7TypeName } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7Definition } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7 } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7 } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7 } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7, JSONSchema7Definition } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
import { JSONSchema7 } from "json-schema"; | ||
export declare const parseSchema: (schema: JSONSchema7 | boolean) => string; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { JSONSchema7 } from "json-schema"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ # Json-Schema-to-Zod |
export declare const format: (source: string) => string; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const half: <T>(arr: T[]) => [T[], T[]]; |
@@ -0,0 +0,0 @@ "use strict"; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24248
564