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
When I use this library to validate an update request message, the client can set only some fields on the message and specify via an updateMask which fields they are. However, the protovalidate checks the whole message and reports validation errors for missing fields, that were omitted intentionally. How to approach this scenario?
One way is to iterate over all validation error violations and filter out violations on unaffected fields, i.e., those not in the updateMask.
Another way might be to hook into the Validate logic with a predicate function that would allow conditionally skip validation of certain fields. I was looking into the code and even if I would create a new instance of the Validate function for the update request purpose, there is no option that would allow me to hook into the validation process like I want, or is there?
Anyway, using updateMask for partial update request messages should be common. Is there a paved way to deal with such a case?
The text was updated successfully, but these errors were encountered:
Hey, @czabaj! Moved this to the main protovalidate repo since it's a global concern and not specific to the Go implementation. There's been some previous discussion on this topic if you'd like to comment on that existing issue.
When I use this library to validate an update request message, the client can set only some fields on the message and specify via an
updateMask
which fields they are. However, the protovalidate checks the whole message and reports validation errors for missing fields, that were omitted intentionally. How to approach this scenario?One way is to iterate over all validation error violations and filter out violations on unaffected fields, i.e., those not in the
updateMask
.Another way might be to hook into the
Validate
logic with a predicate function that would allow conditionally skip validation of certain fields. I was looking into the code and even if I would create a new instance of theValidate
function for the update request purpose, there is no option that would allow me to hook into the validation process like I want, or is there?Anyway, using
updateMask
for partial update request messages should be common. Is there a paved way to deal with such a case?The text was updated successfully, but these errors were encountered: