-
Notifications
You must be signed in to change notification settings - Fork 362
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
updateAttributes on model calls validation for other fields #759
Comments
I experience the same. I had to create (or better extend) a dirty workaround:
Note that there are actually two workarounds. There seems to be another scary bug that the validation isn't triggered at all for (some?) updates (#771). I am not sure if that workaround is necessary for this bug. Maybe it helps someone. |
Yes this is a bug; closing in favour of #771 |
Hello, |
I thinks certainly a bug too |
I think this is a separate but related issue considering #771. Here we are concerned that we always need to send a valid object to the API even if we want to update a single field. Over there, the validation not being triggered is the problem. There is any updates related to this? I'm trying to update an user record, but it is asking me to send its password because it is a required field when creating the user. |
This is still an issue in my opinion, partial updates cause all kinds of validation errors on fields we aren't even changing. I've tested it with the latest versions of loopback v3 but i'm still running into this problem. |
@bajtos Still an issue. Repopen suggested. Why is this being ignored? Seems a design problem. |
Is this still happening in 3.x, or is it 2.x that's having the issue? |
yes, 3.3.0. |
const user = await userModel.findById(<id>);
user.updateAttributes({ status: 1 }); This operation triggers the following error
Is this behavior really intended or is it a bug? |
Same problem here with version 3.x, any update on this problem? |
running into the same problem as @michaelfreund in version |
@bajtos , any ideas? |
I have two comments:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the |
+1 |
Essentially, we need to run a partial validation that will validate only properties affected by I am going to lock this issue down, in order to move the discussion to loopbackio/loopback-next#1872. |
Hello,
we have noticed a problem, that when we use the update of specific fields and before that we queried data with "fields:{...}" it is throwing validation errors for other fields, that are out of the update scope. For example:
Required: title, description
Query: fields{title:true}
Update: title: "aaa"
Error: description is required
This should be fixed to validate only the attributes, that are the part of update scope?
The text was updated successfully, but these errors were encountered: