Closed
Description
I am using toJSONSchema to generate an openapi schema for gemini and it is complaining that "type" is missing when using z.literal() compared to using v3 with zod-to-json-schema, I am not sure if this is intended, an oversight, or google's APIs are very picky. Here is an example of a simple json schema produced in v3 vs the same in v4 using z.toJSONSchema.
V3:
{
"type": "object",
"properties": {
"test": {
"type": "string",
"const": "test"
}
},
"required": [
"test"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
V4:
{
"type": "object",
"properties": {
"test": {
"const": "test"
}
},
"required": [
"test"
]
}
Metadata
Metadata
Assignees
Labels
No labels