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
What version of external packages are you using(@tanstack-query, MSW, React, Vue, ...)
See linked repo below
What steps can reproduce the bug?
When upgrading to the latest versions of the various kubb packages we use, i stumbled into an issue which turned out to be something changing how the generated enum const and types were named. I narrowed it down to a change in @kubb/plugin-ts v3.4.5 , 3.4.4 works
Basically in 3.4.4 the output is:
export const aiTypeEnum = {
foo: 'foo',
bar: 'bar',
} as const
export type AiTypeEnum = (typeof aiTypeEnum)[keyof typeof aiTypeEnum]
and in 3.4.5 its
export const AITypeEnum = {
foo: 'foo',
bar: 'bar',
} as const
export type AITypeEnum = (typeof AITypeEnum)[keyof typeof AITypeEnum]
Note the lower case 'ai' in the first example. In 3.4.5, both the const and type are named with the same casing which is causing issues for us. Is this a bug or is there something in the config that can be set to get the old behaviour back?
For repro, clone repo linked below and npm ci and npm run generate, upgrade @kubb/plugin-ts to v3.4.5 to see the breaking output
@burt202 The reason why is that AI is set as capital letters in the Swagger/OpenAPI file which means that we keep capital letters inside of the defined string. What you can do is updating your Swagger file to use Ai instead of AI.
Thanks for the reply, its much appreciated. I guess its still a breaking change on a patch update though. Would you expect the enumType: 'asConst' setting to keep the const enum as aiTypeEnum because that is not working either.
What version of
kubb
is running?See below
What kind of platform do you use?
Linux
How does your
kubb.config.ts
config look likeSwagger/OpenAPI file?
What version of external packages are you using(
@tanstack-query
,MSW
,React
,Vue
, ...)See linked repo below
What steps can reproduce the bug?
When upgrading to the latest versions of the various kubb packages we use, i stumbled into an issue which turned out to be something changing how the generated enum const and types were named. I narrowed it down to a change in
@kubb/plugin-ts v3.4.5
, 3.4.4 worksBasically in 3.4.4 the output is:
and in 3.4.5 its
Note the lower case 'ai' in the first example. In 3.4.5, both the const and type are named with the same casing which is causing issues for us. Is this a bug or is there something in the config that can be set to get the old behaviour back?
For repro, clone repo linked below and npm ci and npm run generate, upgrade @kubb/plugin-ts to v3.4.5 to see the breaking output
https://github.com/burt202/kubb-test
Cheers
How often does this bug happen?
Every time
What is the expected behavior?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: