Skip to content

Conversation

@issy
Copy link
Contributor

@issy issy commented Jan 2, 2026

Currently, @rtk-query/codegen-openapi converts operation IDs to camelCase before generating API code. This is due to an implementation detail in oazapfts (see oazapfts/oazapfts#591). For example, if your operation ID is fetchMyJWTPlease it will be renamed to fetchMyJwtPlease.
Although this is documented behaviour, it is not always desired behaviour for library consumers. I think it would be good to offer users an escape hatch from that behaviour. In this PR I am introducing the config property exactOperationIds?: boolean. When enabled, it will not transform any operation IDs. This comes with some additional checks to ensure that there are no missing/duplicate operation IDs, but I think it's acceptable with such an escape hatch that users should be expected to validate these things.

I have added a small section to the docs to reflect this:
image

I believe this should resolve the following issues:
#4322
#2181
#2675

Ideally this would be implemented in oazapfts. There are plans on the roadmap for a plugin system and a hook for naming/renaming operations. This would be ideal for a future refactor, but will have to wait until that work is completed on their side.

@codesandbox
Copy link

codesandbox bot commented Jan 2, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 2, 2026

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 561ce40:

Sandbox Source
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

@netlify
Copy link

netlify bot commented Jan 2, 2026

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit 561ce40
🔍 Latest deploy log https://app.netlify.com/projects/redux-starter-kit-docs/deploys/6957d212f4986800089f212b
😎 Deploy Preview https://deploy-preview-5174--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +11 to +12
export async function generateEndpoints(options: GenerationOptions & { outputFile: string }): Promise<void>;
export async function generateEndpoints(options: GenerationOptions & { outputFile?: never }): Promise<string>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also including this slightly off-topic change here. This allows the return type of the function (string or void) to be inferred based on whether outputFile is passed. Without this, I have to do await generateEndpoints(...) as string in my codegen setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant