>=0.79.0 alters casing of Responses/Data/Error types when case='preserve'
Description
Upgrading from 0.78 to 0.79 (or later versions) introduced a lot of errors in my app due to the renaming of generated *Responses, *Error and *Data types which are now camelCased instead of PascalCased.
This only happens with the setting case: 'preserve' in the Typescript plugin.
There's no mention of this change in the release notes or upgrading guide (switching away from case: 'preserve' fixes this but introduces several other errors obviously).
Simple example for clarity (can't share much more sadly):
If you don't intend to fix this, it would be helpful to know what you would suggest to do moving forward (given that it looks like an accidental change I would gladly avoid a back and forth on this).
Reproducible example or configuration
import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
input: 'http://localhost:9001/openapi.json',
output: {
format: 'biome',
lint: 'biome',
path: 'src/faClientFetch',
},
parser: {
transforms: {
readWrite: {
enabled: false,
},
},
},
plugins: [
{
name: '@hey-api/client-fetch',
baseUrl: false,
throwOnError: true,
},
'@hey-api/schemas',
{
name: '@hey-api/typescript',
case: 'preserve',
},
{
name: '@hey-api/sdk',
},
'@tanstack/react-query',
],
});
OpenAPI specification (optional)
No response
System information (optional)
No response
Hi @Giuzzilla! I'm Dosu and I’m helping the openapi-ts team.
There’s no mention in the migration guide or documentation about a change to camelCase for generated *Responses, *Error, and *Data types when using case: 'preserve' in the TypeScript plugin for versions >=0.79.0. The docs state that PascalCase is the default for these types, and that case: 'preserve' should keep the original casing, not convert to camelCase. The absence of any documentation or release note about this shift suggests it’s likely an unintended side effect or bug, not an intentional change (source, source).
There’s no documented workaround to force PascalCase with case: 'preserve' in >=0.79.0. If switching away from case: 'preserve' isn’t viable, you might consider pinning to 0.78.x for now or using a post-processing script to rename types as a temporary fix.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
A possible workaround I found is setting the following additional options in the Typescript plugin config:
errors: {
case: 'PascalCase',
},
responses: {
case: 'PascalCase',
},
requests: {
case: 'PascalCase',
},
or, more simply, moving case: 'preserve' within the definitions option.
definitions: {
case: 'preserve',
},