You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
@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.
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})
togetModelSchemaRef(Order)
inorder.controllers.ts
. Runnpm t
again, test will pass now.Apparent Cause
The actual schema of
NewUserRequest
model is being overwritten by its parent modelUser
, hence the request body becomes unprocessable as theUser
model does not have a password property.Acceptance Criteia
npm t
on https://github.com/strongloop/loopback4-example-shopping/tree/bug/include-relations should pass with the updated package.The text was updated successfully, but these errors were encountered: