-
-
Notifications
You must be signed in to change notification settings - Fork 130
Open
Labels
Description
Environment
orpc@1.13.5
Reproduction
ZodToJsonSchemaConverter result for the following does not include string type:
z.enum(["bug", "feedback"])Describe the bug
With Stoplight rendering my spec, I see a lot of these:
I worked around it in my project like so:
const openApiGenerator = new OpenAPIGenerator({
schemaConverters: [
new ZodToJsonSchemaConverter({
interceptors: [
(options) => {
// Workaround to make orpc correctly specify zod string
// enums as strings in the OpenAPI spec (instead of "any")
const [required, schema] = options.next();
if (schema && "enum" in schema && !("type" in schema)) {
return [required, { ...schema, type: "string" }];
}
return [required, schema];
},
],
}),
],
});Additional context
No response
Logs
Reactions are currently unavailable