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
{{ message }}
Repository navigation
Validation rules are applied in not required properties #1588
And I define custom validation rules for this property like these:
Guide.validatesLengthOf('languages', {min: 1, message: 'You need to add 1 language at least'});
Guide.validate('languages', validatesLanguages, {message: 'Languages are not in supported languages'});
Loopback always try to check these rules even when I try to post a new guide without "languages" property, I remember "languages" is not required then whenever I try to create a guide without "languages" I think Loopback should not validate the non-exist property and should only do it when the property exists.
changed the title [-]Validation rules are applied in not requires properties[/-][+]Validation rules are applied in not required properties[/+]on Aug 13, 2015
Try to create a new guide without languages property. POST an empty object in /guides endpoint.
As you can appreciate the validation rules have effect on "languages" property and the server rejects the request although I don't require this property to create a guide. I think that the validation rules should have effect just whenever you add the property to the payload.
I'm having the same issue, my users can sign up using his email either phone number, I want add uniqueness and format validations to both properties but only if they are in the payload
Activity
[-]Validation rules are applied in not requires properties[/-][+]Validation rules are applied in not required properties[/+]superkhau commentedon Aug 13, 2015
Can you provide a link to a test project on Github? See https://github.com/strongloop/loopback/wiki/Issues#bug-report
agregoris commentedon Aug 14, 2015
I create the repository, the URL is: https://github.com/onnoll/loopback-sandbox
STP:
As you can appreciate the validation rules have effect on "languages" property and the server rejects the request although I don't require this property to create a guide. I think that the validation rules should have effect just whenever you add the property to the payload.
superkhau commentedon Sep 2, 2015
I think this is a dupe of #1485. Can you confirm and close if that is the case?
rkmax commentedon Sep 11, 2015
I'm having the same issue, my users can sign up using his email either phone number, I want add uniqueness and format validations to both properties but only if they are in the payload
superkhau commentedon Sep 21, 2015
Closing, dupe of #1485.