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

Missing import for enum with MSW mock generation #1455

Closed
dteske25 opened this issue Jun 14, 2024 · 0 comments · Fixed by #1456
Closed

Missing import for enum with MSW mock generation #1455

dteske25 opened this issue Jun 14, 2024 · 0 comments · Fixed by #1456
Assignees
Labels
mock Related to mock generation
Milestone

Comments

@dteske25
Copy link
Contributor

dteske25 commented Jun 14, 2024

What are the steps to reproduce this issue?

When generating MSW mocks on the latest version, it looks like enums are not getting imported.

Here's a minimal example:
https://stackblitz.com/edit/vitejs-vite-in1htj?file=src%2Fhandlers%2Fgenerated%2Fsample.ts

Can run generate-code to trigger orval

What happens?

Because the imports are missing, typescript fails to compile the code
20240614_092310

What were you expecting to happen?

Imports should be automatically added for any referenced types

Any other comments?

I haven't contributed to the repo yet, but I'd be happy to help resolve this.

Poking around, I'm wondering if this might be the cause - maybe missed propagating the imports that were set on L128?
https://github.com/anymaniax/orval/blame/da1f78998b0a00e849f1315accadf5b10ac2efea/packages/mock/src/faker/getters/scalar.ts#L145C9-L145C21

What versions are you using?

Operating System: Windows 10, with powershell
Package Version: 6.30.2
Browser Version: N/A

@melloware melloware added the mock Related to mock generation label Jun 14, 2024
@melloware melloware added this to the 6.31.0 milestone Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mock Related to mock generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants