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

[Feature Request] Support Non-Default Namespace for Model Type Export #28

Closed
NaoyaMiyagawa opened this issue May 18, 2024 · 2 comments · Fixed by #29
Closed

[Feature Request] Support Non-Default Namespace for Model Type Export #28

NaoyaMiyagawa opened this issue May 18, 2024 · 2 comments · Fixed by #29
Assignees

Comments

@NaoyaMiyagawa
Copy link
Collaborator

NaoyaMiyagawa commented May 18, 2024

Issue

Currently, it gives Failed to generate {Model}. Skipping... error message when running typegen for models with non-default namespace, meaning not App\Models, as shown below:

sail pnpm typegen --model-path "app-modules/post/src/Models" --output "app-modules/post/resources/js/types"

> @ typegen /var/www/html
> laravel-typegen "--model-path" "app-modules/post/src/Models" "--output" "app-modules/post/resources/js/types" "--form-request"

Generating types...
Failed to generate Comment. Skipping...
Failed to generate Post. Skipping...
Types generated successfully!!

This becomes an issue when the repository uses an architecture such as modular monolith. Namespace under module can be like App/{Module}/Models or Custom/{Module}/Models, etc.

Expected Behavior

Types of models under non-default namespace can be exported as models under default.

Remarks

This change should not affect types of models under default namespace.

@NaoyaMiyagawa
Copy link
Collaborator Author

I'll give it a try to make a PR for this!

@7nohe
Copy link
Owner

7nohe commented May 18, 2024

That would be great! Thank you for your help.

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 a pull request may close this issue.

2 participants