turkerdev / fastify-type-provider-zod

MIT License
337 stars 21 forks source link

Response validation failing with 'safeParse' is not a function #3

Closed alxarch closed 2 years ago

alxarch commented 2 years ago

Seems to require jsonShorthand: false option on the server to work as expected. Somehow getSchemaAnyway is called and unless jsonShorthand is set to false it wraps the schema into

{
  "type": "object",
  "properties": [ZodSchema]
}

instead of the expected bare schema

turkerdev commented 2 years ago

Can you create a reproduction, please? https://stackblitz.com

alxarch commented 2 years ago

https://stackblitz.com/edit/json-server-cyu7wd?file=index.js

shmarts commented 2 years ago

Having the same problem

kibertoad commented 2 years ago

Fix PR is up