You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{extendZodWithOpenApi}from'@asteasolutions/zod-to-openapi'import{coerce,object,z}from'zod'extendZodWithOpenApi(z)constid=id: coerce.number().openapi({param: {name: 'id',in: 'path'},example: '1'})// in another file which is imported after the previous code, the endpoint is defined and I include here the `id`
responses: {200: {content: 'application/json': {schema: object({ id })}}}
Which triggers this error
"type": "TypeError",
"message": "zodSchema.isOptional is not a function",
"stack":
TypeError: zodSchema.isOptional is not a function
at Metadata.isOptionalSchema (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:465:26)
at /node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:650:49
at Array.filter (<anonymous>)
at ObjectTransformer.requiredKeysOf (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:650:14)
at ObjectTransformer.transform (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:613:31)
at OpenApiTransformer.transform (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:786:43)
at OpenAPIGenerator.toOpenAPISchema (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:1223:40)
at OpenAPIGenerator.generateSchemaWithMetadata (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:1051:20)
at OpenAPIGenerator.generateSimpleSchema (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:1078:25)
at OpenAPIGenerator.generateSchemaWithRef (/node_modules/.pnpm/@asteasolutions+zod-to-openapi@7.3.0_zod@3.24.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs:1112:29)
The text was updated successfully, but these errors were encountered:
I basically have this code
Which triggers this error
The text was updated successfully, but these errors were encountered: