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

Mocks: Is there a way to have a single export for mocks in tags-split mode? #512

Open
la55u opened this issue Jul 26, 2022 · 2 comments · May be fixed by #1803
Open

Mocks: Is there a way to have a single export for mocks in tags-split mode? #512

la55u opened this issue Jul 26, 2022 · 2 comments · May be fixed by #1803
Labels
enhancement New feature or request mock Related to mock generation

Comments

@la55u
Copy link

la55u commented Jul 26, 2022

Generating everything in one file with the single mode results in a 20k line file which is obviously not ideal, makes my IDE freeze and file operations take extremely long time to finish. So I naturally choose the tags-split mode in orval, but when I tried to set up mocks according to the examples, I faced the following issue.
I couldn't find a way to have a single function that exports all the mock functions. I figured it should be something like export const handlers = getMyApiMSW() in handlers.js but currently I can only do that in 'split' mode as it generates a separate .msw file for mocks.

Question is, can we have an index.mocks.ts file or similar generated that exports only the mock functions but all of them?
(Using react-query client if it makes a difference.)

Thank you, awesome tool btw!

Edit: related to #347

@anymaniax
Copy link
Collaborator

anymaniax commented Jul 30, 2022

Hello @la55u at the moment it's not possible. It's on my todo list to be added as a feature. Also thanks for the support!

@anymaniax anymaniax added the enhancement New feature or request label Jul 30, 2022
@melloware melloware changed the title Is there a way to have a single export for mocks in tags-split mode? Mocks: Is there a way to have a single export for mocks in tags-split mode? Nov 13, 2023
@melloware
Copy link
Collaborator

cc @Will-Mann-16

@melloware melloware added the mock Related to mock generation label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mock Related to mock generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants