loopbackio / loopbackio/loopback-next

lb4 relation doesn't find models

Open
#9,653 5 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

### Describe the bug

I have a project with a lot of models. I organized the models in "sub directories" inside "models" directory.
The "export" is working properly and all the project is working.
What is not working is the possibility to add repositories, relations or anything else
"lb4 relation" stops with an error "Generation is aborted: Error: No models found in ".../src/models"."
I expect the script to be capable to look for models also inside according to what is available in "index.ts" from "models" directory.

### Logs

_No response_

### Additional information

_No response_

### Reproduction

https://github.com/danysz/demo-lb4-cli-model-not-found

Contributor guide

Open the contributing guide

Research direction

Start with the `lb4 relation` command and the reproduction project linked in the issue, then inspect how it scans `src/models` and uses that directory's `index.ts`. The work is done when models organized in subdirectories are discovered for relation or repository generation instead of producing “No models found.”

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.