Comments (4)
Hey @oxisto, great to hear from you and hope protovalidate is working out in your project.
Since you're bumping the
bufbuild/protovalidate-go
dependency fromv0.5.0
->v0.6.0
, there were some changes to the output, namely the snippet below (added inbufbuild/protovalidate
v0.5.5
)I suggest the following:
- search/replace
value must be a valid UUID
withvalue is empty, which is not a valid UUID
(19 occurrences)- run the tests, and fix the failing tests where you do actually have an invalid uuid with
value must be a valid UUID
(3 occurrences)Happy to help out if you'd like an upstream contribution.
Thanks for the details on this! I was wondering where the exact messages were coming from. And thanks for the support, I managed to fix all the failing tests now.
from protovalidate-go.
For a given message, you should see a deterministic result based on this logic:
- The error
value is empty, which is not a valid UUID
should happen if the value is the empty string. - The error
value must be a valid UUID
should happen if the value is a non-empty string that doesn't match the UUID regex.
I assume you are seeing both errors in your tests because you have test cases that exercise both kinds of validation failures. You should be able to just update your test cases to expect the more precise error messages for each case.
If you are actually seeing non-determinism, or if the behavior doesn't match what I described above, then please share a reproducible example.
from protovalidate-go.
Hey @oxisto, great to hear from you and hope protovalidate is working out in your project.
Since you're bumping the bufbuild/protovalidate-go
dependency from v0.5.0
-> v0.6.0
, there were some changes to the output, namely the snippet below (added in bufbuild/protovalidate
v0.5.5
)
I suggest the following:
- search/replace
value must be a valid UUID
withvalue is empty, which is not a valid UUID
(19 occurrences) - run the tests, and fix the failing tests where you do actually have an invalid uuid with
value must be a valid UUID
(3 occurrences)
Happy to help out if you'd like an upstream contribution.
from protovalidate-go.
For a given message, you should see a deterministic result based on this logic:
- The error
value is empty, which is not a valid UUID
should happen if the value is the empty string.- The error
value must be a valid UUID
should happen if the value is a non-empty string that doesn't match the UUID regex.I assume you are seeing both errors in your tests because you have test cases that exercise both kinds of validation failures. You should be able to just update your test cases to expect the more precise error messages for each case.
If you are actually seeing non-determinism, or if the behavior doesn't match what I described above, then please share a reproducible example.
You are completely right. It seems that we had two validation rules one in the "outer" and one in the "inner" message and both were triggered.
from protovalidate-go.
Related Issues (20)
- gen proto issue HOT 1
- The validate returns an error object. How do I get the correct field name and the corresponding check message HOT 1
- [BUG] Some red wavy line about importing when VSCode/Goland displaying generated code HOT 3
- Vulnerability GO-2024-2609 HOT 1
- [BUG] resolveDeprecatedIndex() isn't functioning. HOT 3
- field mask validation at message level is not working HOT 1
- [BUG] Enum-related validation error messages contain numbers instead of value names HOT 1
- Un-typedef errors.ValidationError to buf.validate.Violations
- StandardConstraintResolver interface needs to return errors
- [BUG] undefined: atomic.Pointer v0.3.3 HOT 1
- Part of the validation code is not generated HOT 2
- [Question] How to use protovalidate-go in github-actions HOT 2
- Document recommendation for instantiating/managing validator instances HOT 2
- [Feature Request] Allow extending default cel.Env created by protovalidate.New HOT 4
- Fails to validate a simple message HOT 2
- [BUG] error evaluating repeated.unique: internal error: runtime error: invalid memory address or nil pointer dereference HOT 1
- [BUG] Cannot build with Bzlmod HOT 13
- [Question] What's the correct way to write cel expressions for validating a single item in a repeated field? HOT 1
- [BUG] *.pb.validate.go Validate AND ValidateAll cannot use. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protovalidate-go.