kubb-labs / kubb

OpenAPI to TypeScript, React-Query, Zod, Zodios, Faker.js, MSW and Axios.
https://kubb.dev
MIT License
568 stars 40 forks source link

Mark enum as nullable for null enum members #1034

Closed aburgel closed 1 month ago

aburgel commented 1 month ago

Fixes #1030

According to the 3.0 docs and this FAQ, an enum is nullable when both it's type is nullable and when null is a member of the enum. Currently kubb will crash with a null member, so this PR fixes this case.

I added a couple of test cases as well, but let me know if there are more ways I should test this.

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 61ad74ebd96f8ee10dfcc34d7e5f40cfa9dd0400

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-oas | Patch | | @kubb/cli | Patch | | @kubb/plugin-redoc | Patch | | @kubb/swagger-client | Patch | | @kubb/swagger-faker | Patch | | @kubb/swagger-msw | Patch | | @kubb/swagger-swr | Patch | | @kubb/swagger-tanstack-query | Patch | | @kubb/swagger-ts | Patch | | @kubb/swagger-zod | Patch | | @kubb/swagger-zodios | Patch | | @kubb/swagger | Patch | | @kubb/config-biome | Patch | | @kubb/config-ts | Patch | | @kubb/config-tsup | Patch | | @kubb/core | Patch | | @kubb/fs | Patch | | @kubb/oas | Patch | | @kubb/parser-ts | Patch | | @kubb/react | Patch | | @kubb/types | Patch | | kubb | Patch | | unplugin-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 month ago

@all-contributors add @aburgel for code

allcontributors[bot] commented 1 month ago

@stijnvanhulle

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