Skip to content
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

Allow disabling group.exportAs from @kubb/swagger-tanstack-query #1111

Open
g-otn opened this issue Aug 5, 2024 · 1 comment
Open

Allow disabling group.exportAs from @kubb/swagger-tanstack-query #1111

g-otn opened this issue Aug 5, 2024 · 1 comment
Labels
enhancement New feature or request @kubb/plugin-react-query v3 Kubb v3
Milestone

Comments

@g-otn
Copy link

g-otn commented Aug 5, 2024

What is the problem this feature would solve?

First, thank you all for the great work in this project, this toolkit is great!

When generating queries/mutations with @kubb/swagger-tanstack-query, using the group options is nice due to the file structure.

However, I couldn't find a way to disable the group.exportAs feature, which creates named exports for each group:

export * as {{tag}}Hooks from './{{tag}}'

This makes it verbose to use the hooks, especially if the tag is long:

myLongTagNameForUserHooks.useMyLongTagNameForUserGetById()

This might also probably break some bundle optimizations since the hooks are now object properties, loading all JS referenced in that object when importing.

External documents/projects?

No response

What is the feature you are proposing to solve the problem?

Add an option to disable the named export by group feature in the pluginTanstackQuery options, such as group.exportAs: false, while still keeping the group file structure and respecting output.exportType.

What alternatives have you considered?

For now, I'm simply omitting group options so the main index.ts file from this plugin doesn't have the named exports.

@g-otn g-otn added the enhancement New feature or request label Aug 5, 2024
@stijnvanhulle stijnvanhulle added the v3 Kubb v3 label Aug 11, 2024
@stijnvanhulle stijnvanhulle added this to the 3.0.0 milestone Aug 27, 2024
@stijnvanhulle
Copy link
Collaborator

@g-otn In v3 of Kubb will group.exportAs be removed as a generic option for grouping. The plugin-client will still use grouping so controllers can be created that contain get, post, put, ... for operation x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request @kubb/plugin-react-query v3 Kubb v3
Projects
None yet
Development

No branches or pull requests

2 participants