loopbackio / loopbackio/loopback-next

[@loopback/sequelize] Nested Loopback model types are not supported

Open
#9,766 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug sequelize
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

Describe the bug

If you have existing Loopback model properties set up that are nesting other Loopback models such as this "Address" example: https://github.com/loopbackio/loopback-next/blob/be0c53e30bbe9edf7753c4fcd7ab3199f7cd3b8c/packages/repository-json-schema/src/__tests__/unit/build-schema.unit.ts#L478-L518 it will lead to an error about unsupported types.

Logs
Example error:

Error: Unhandled DataType "class Address extends repository_1.Model {
  }" for column "address" in sequelize extension
Additional information

References:
https://loopback.io/doc/en/lb4/Model.html#json-schema-inference

Reproduction

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked repository-json-schema test covering nested Address models and the LoopBack model JSON-schema inference documentation. Then trace how the Sequelize extension handles the reported unsupported DataType error; done means nested LoopBack model properties are accepted without that error and the relevant behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.