Hi!
Is there a way to somehow modify generated enum keys except doing it in openapi schema?
I want to convert enum keys from snake_case to camelCase. Original enum values are snake_case, so I need to convert only keys.
I have an openapi v3 schema, it looks like this:
#...
components:
schemas:
someSchemaName:
enum:
- enable_2fa
- export_settings
// #...
#...
And generated enum looks like this:
export const someSchemaName = {
enable_2fa: 'enable_2fa',
export_settings: 'export_settings', // but i want exportSettings: 'export_settings'
} as const;
I see that I can set enum names manually orval docs in openapi file, but openapi file is generated too, so editing it is not an option.
It looks like getEnumNames doesn't support any enum keys modification configs, but maybe there is a workaround for this?.. 🤔
Btw I'm struggling to configure a flow to convert snake_case'd openapi source file to camelCase'd generated files, and it feels like pain. I use openapi-format as a workaround to change casings, but it still feels so complicated to work with it.
Maybe there are some easier ways to convert casings in orval?...
Hi!
Is there a way to somehow modify generated enum keys except doing it in openapi schema?
I want to convert enum keys from snake_case to camelCase. Original enum values are snake_case, so I need to convert only keys.
I have an openapi v3 schema, it looks like this:
And generated enum looks like this:
I see that I can set enum names manually orval docs in openapi file, but openapi file is generated too, so editing it is not an option.
It looks like getEnumNames doesn't support any enum keys modification configs, but maybe there is a workaround for this?.. 🤔
Btw I'm struggling to configure a flow to convert
snake_case'd openapi source file tocamelCase'd generated files, and it feels like pain. I use openapi-format as a workaround to change casings, but it still feels so complicated to work with it.Maybe there are some easier ways to convert casings in orval?...