Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-schema-to-zod

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-to-zod - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

0

cli.d.ts
#!/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";

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc