-
-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Labels
Description
First of all, thank you for creating the module!
I started using your zod-to-json-schema
and json-schema-to-zod
. While the code looks to be working, my VSCode displays errors.
"json-schema-to-zod": "^2.0.14",
"typescript": "^5.3.3",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.22.4"
import { jsonSchemaToZod } from "json-schema-to-zod";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
const testSchema = z.object({
name: z.string(),
age: z.number().optional(),
});
const jsonSchema = zodToJsonSchema(testSchema);
const zodSchema = jsonSchemaToZod(jsonSchema); // <-- 1st type error with "jsonSchema"
console.log({
jsonSchema,
zodSchema,
properties: jsonSchema.properties, // <-- 2nd type error with "properties"
});

The result of the console.log
is below:
The variable jsonSchema
has properties that JsonSchemaObject
type expects in json-schema-to-zod
.
doteric