kubb-labs / kubb

The ultimate toolkit for working with APIs.
https://kubb.dev
MIT License
738 stars 67 forks source link

Fix check for blob should check for a file instead of a string #1400

Closed ekaradon closed 5 days ago

ekaradon commented 1 week ago

I've continued working with zod and got an error when using it to parse a response from the backend service where it tries to match a blob with a string. I suppose that z.instanceOf(File) would be the best approach here?

KUBB-70 Zod generation is considering blob as a string https://github.com/kubb-labs/kubb/issues/1399

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: ecba81c6785a5d0b2c9c7383ec6eeb10e5766d38

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages | Name | Type | | ------------------------- | ----- | | @kubb/plugin-zod | Minor | | @kubb/plugin-client | Minor | | @kubb/plugin-react-query | Minor | | @kubb/plugin-solid-query | Minor | | @kubb/plugin-svelte-query | Minor | | @kubb/plugin-swr | Minor | | @kubb/plugin-vue-query | Minor | | @kubb/cli | Minor | | @kubb/config-biome | Minor | | @kubb/config-ts | Minor | | @kubb/config-tsup | Minor | | @kubb/core | Minor | | @kubb/fs | Minor | | @kubb/oas | Minor | | @kubb/parser-ts | Minor | | @kubb/plugin-faker | Minor | | @kubb/plugin-msw | Minor | | @kubb/plugin-oas | Minor | | @kubb/plugin-redoc | Minor | | @kubb/plugin-ts | Minor | | @kubb/react | Minor | | @kubb/types | Minor | | kubb | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

stijnvanhulle commented 1 week ago

@all-contributors please add @ekaradon for code

allcontributors[bot] commented 1 week ago

@stijnvanhulle

I've put up a pull request to add @ekaradon! :tada:

stijnvanhulle commented 1 week ago

@ekaradon hmm I was not aware off that could use z.instance so seems more than logical to use z.instanceOf(File) here. Not sure if that would have an impact on people using strings for Blobs.

ekaradon commented 6 days ago

I'm not used to workspace, so I may have missed a step but when I try to run tests after installing with pnpm I get this error message:

Error: Failed to resolve entry for package "@kubb/fs". The package may have incorrect main/module/exports specified in its package.json.
  Plugin: vite:import-analysis
  File: ~/projects/kubb/packages/core/src/utils/parser.ts

Not sure what I should do to get it working?