json-schema-to-zod
Advanced tools
Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "json-schema-to-zod", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Converts JSON schema objects or files into Zod schemas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (schema.default !== undefined) { | ||
parsed += `.default(${JSON.stringify(schema.default)} )`; | ||
parsed += `.default(${JSON.stringify(schema.default)})`; | ||
} | ||
@@ -98,5 +98,5 @@ return parsed; | ||
array: (x) => x.type === "array", | ||
anyOf: (x) => !!x.anyOf, | ||
allOf: (x) => !!x.allOf, | ||
enum: (x) => !!x.enum, | ||
anyOf: (x) => x.anyOf !== undefined, | ||
allOf: (x) => x.allOf !== undefined, | ||
enum: (x) => x.enum !== undefined, | ||
}, | ||
@@ -106,8 +106,8 @@ a: { | ||
multipleType: (x) => Array.isArray(x.type), | ||
not: (x) => !!x.not, | ||
const: (x) => !!x.const, | ||
not: (x) => x.not !== undefined, | ||
const: (x) => x.const !== undefined, | ||
primitive: (x, p) => x.type === p, | ||
conditional: (x) => Boolean(x.if && x.then && x.else), | ||
oneOf: (x) => !!x.oneOf, | ||
oneOf: (x) => x.oneOf !== undefined, | ||
}, | ||
}; |
32808