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

includeRelations bug #4547

Closed
3 tasks
hacksparrow opened this issue Jan 31, 2020 · 3 comments
Closed
3 tasks

includeRelations bug #4547

hacksparrow opened this issue Jan 31, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@hacksparrow
Copy link
Contributor

hacksparrow commented Jan 31, 2020

Steps to reproduce

Checkout https://github.com/strongloop/loopback4-example-shopping/tree/bug/include-relations.

Run npm t, it will fail with: Error: expected 200 "OK", got 422 "Unprocessable Entity".

Now, change getModelSchemaRef(Order, {includeRelations: true}) to getModelSchemaRef(Order) in order.controllers.ts. Run npm t again, test will pass now.

Apparent Cause

The actual schema of NewUserRequest model is being overwritten by its parent model User, hence the request body becomes unprocessable as the User model does not have a password property.

Acceptance Criteia

@dhmlau
Copy link
Member

dhmlau commented Feb 7, 2020

cc @jannyHou - I think you were investigating it at some point.

@hacksparrow
Copy link
Contributor Author

Checked with the latest dependencies, it is working fine now. Maybe something in the later version of @loopback/repository fixed it? Since the version used in the buggy app is one major version lower, it is hard to check what was causing it.

@jannyHou any idea? I remember you had mentioned of a probable cause.

@jannyHou
Copy link
Contributor

@hacksparrow There are some PR related to the title inheritance months ago(searching it : p), it might fix this issue as well. If you confirmed the bug is fixed, then feel free to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants