Skip to content

refactor(tanstack): unify operation naming using SDK serviceFunctionIdentifier #2312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamkasper
Copy link

@adamkasper adamkasper commented Jul 15, 2025

Closes #2301

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Jul 15, 2025

⚠️ No Changeset found

Latest commit: 23512e0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jul 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hey-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 9:57am

@adamkasper adamkasper changed the title refactor(query): use serviceFunctionIdentifier for operation IDs refactor(tanstack): unify operation naming using SDK serviceFunctionIdentifier Jul 15, 2025
@adamkasper adamkasper marked this pull request as ready for review July 15, 2025 10:06
Copy link

pkg-pr-new bot commented Jul 15, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2312
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2312
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2312

commit: 23512e0

Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 12.50000% with 28 lines in your changes missing coverage. Please review.

Project coverage is 23.90%. Comparing base (d687cdd) to head (23512e0).

Files with missing lines Patch % Lines
...pi-ts/src/plugins/@tanstack/query-core/queryKey.ts 11.11% 8 Missing ⚠️
...ugins/@tanstack/query-core/infiniteQueryOptions.ts 12.50% 7 Missing ⚠️
...s/src/plugins/@tanstack/query-core/queryOptions.ts 12.50% 7 Missing ⚠️
...rc/plugins/@tanstack/query-core/mutationOptions.ts 14.28% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2312      +/-   ##
==========================================
- Coverage   23.90%   23.90%   -0.01%     
==========================================
  Files         317      317              
  Lines       29334    29358      +24     
  Branches     1230     1230              
==========================================
+ Hits         7013     7017       +4     
- Misses      22312    22332      +20     
  Partials        9        9              
Flag Coverage Δ
unittests 23.90% <12.50%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrlubos
Copy link
Member

mrlubos commented Jul 21, 2025

@adamkasper seeing this change and tests passing makes me feel uneasy 😂

Help me understand: we already offer naming and casing customization options https://heyapi.dev/openapi-ts/plugins/tanstack-query

So you could do mutationOptions.name: '{{name}}Custom' and it should work. What's the impact of this pull request? Since it's not changing anything in tests, it must be changing something on your end

@adamkasper
Copy link
Author

adamkasper commented Jul 21, 2025

@mrlubos I should have written it in the description… 😄 It's the issue I mentioned in the email. When I use methodNameBuilder in @hey-api/sdk to create a custom name, it's completely ignored here. Instead, it still uses the original operation.id from the OpenAPI spec. I need the {{name}} to use the already customized name from @hey-api/sdk.

So in the end, this change doesn’t actually change anything directly. The difference comes when you customize methodNameBuilder in @hey-api/sdk — then it will also apply here inside {{name}}.

@mrlubos
Copy link
Member

mrlubos commented Jul 21, 2025

Thoughts on this thread? #2218

Another reason I don't like this change is it pulls stuff from the legacy plugin implementation. Overall a lot of red flags!

@adamkasper
Copy link
Author

adamkasper commented Jul 21, 2025

@mrlubos I’ve looked into it, but I’m a bit limited because in queryOptions.name() I only have access to id, which is just the operation.id. What I really need is access to the operation.method and operation.path as well. I'm still thinking about the best way to solve it. 🙁

@adamkasper
Copy link
Author

adamkasper commented Jul 21, 2025

And changing the type from string to IROperationObject in queryOptions.name() feels like too big of a change, especially since it looks like not many people actually need it here.

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.

Check name customization options for TanStack plugins
2 participants