What version of external packages are you using(@tanstack-query, MSW, React, Vue, ...)
No response
What steps can reproduce the bug?
A enum with a member of null causes a crash. You can see it in action in the playground by pasting in the document below. To be clear, I want null as in the null type, not a string of the text "null".
How often does this bug happen?
Every time
What is the expected behavior?
My understanding is that this is the correct way to model a nullable enum. I know that kubb will make a nullable enum if you set the type to null (eg type: [string, "null"]), but I am also using another OpenAPI tool that works a differently and right now these two tools are fighting each other. It seems like kubb is the right place to fix this since it's not adhering to the spec.
Swagger/OpenAPI file?
openapi: 3.1.0
components:
schemas:
Enum:
enum:
- a
- b
- c
- null
Additional information
Running locally, I get this error:
[8:34:31 PM] ERROR Cannot read properties of null (reading 'toString') (plugin: plugin-zod, hook: buildStart) (plugin: plugin-zod, hook: buildStart)
at EventEmitter.<anonymous> (/home/apps/node_modules/.pnpm/@kubb+core@2.19.5/node_modules/@kubb/core/src/logger.ts:74:19)
at EventEmitter.emit (node:events:518:28)
at EventEmitter.emit (/home/apps/node_modules/.pnpm/@kubb+core@2.19.5/node_modules/@kubb/core/src/utils/EventEmitter.ts:10:19)
at Object.emit (/home/apps/node_modules/.pnpm/@kubb+core@2.19.5/node_modules/@kubb/core/src/logger.ts:89:21)
at PluginManager.catcher_fn (/home/apps/node_modules/.pnpm/@kubb+core@2.19.5/node_modules/@kubb/core/src/PluginManager.ts:620:17)
at /home/apps/node_modules/.pnpm/@kubb+core@2.19.5/node_modules/@kubb/core/src/PluginManager.ts:366:9
at Array.forEach (<anonymous>)
at PluginManager.hookParallel (/home/apps/node_modules/.pnpm/@kubb+core@2.19.5/node_modules/@kubb/core/src/PluginManager.ts:362:13)
at safeBuild (/home/apps/node_modules/.pnpm/@kubb+core@2.19.5/node_modules/@kubb/core/src/build.ts:208:5)
at generate (/home/apps/node_modules/.pnpm/@kubb+cli@2.19.5_typescript@5.4.5/node_modules/@kubb/cli/src/generate.ts:79:36)
What version of
kubb
is running?2.19.5
What platform is your computer?
Mac
What version of external packages are you using(
@tanstack-query
,MSW
,React
,Vue
, ...)No response
What steps can reproduce the bug?
A enum with a member of
null
causes a crash. You can see it in action in the playground by pasting in the document below. To be clear, I want null as in the null type, not a string of the text "null".How often does this bug happen?
Every time
What is the expected behavior?
My understanding is that this is the correct way to model a nullable enum. I know that kubb will make a nullable enum if you set the type to null (eg
type: [string, "null"]
), but I am also using another OpenAPI tool that works a differently and right now these two tools are fighting each other. It seems like kubb is the right place to fix this since it's not adhering to the spec.Swagger/OpenAPI file?
Additional information
Running locally, I get this error: