-
Notifications
You must be signed in to change notification settings - Fork 580
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
Add UUID as a well-known string type #217
Conversation
0b725ba
to
f8040f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good to me. There are a few conflicts that need resolving.
Signed-off-by: Joel Griffith <[email protected]>
@rmichela Thanks! I resolved the conflicts, so this should be ready for another review now 🔍 |
Awesome! Thanks for the work here :D |
What about the simple format that basically saves 4 bytes? Also, what is the general policy regarding performance? Regular expressions — especially in Java — are extremely slow compared to a custom tailored and hard coded state machine. I didn’t want to create a dedicated issue for either of these questions because how to proceed is basically depending too much on the answers and it seems fitting to ask here. |
PGV uses the Google RE2J regex library instead of
|
That's true for Go (because that's the implementation in the standard library), but the C++ code doesn't implement regexes and needs #22 to get resolved before implementation. I'm personally on board with using RE2 everywhere but want more buy-in. As for regexes for parsing by hand, my experience has been that switching from RE2 to hand-written parsing makes for a 4-10x performance improvement, at least in C++. For fixed patterns like for UUIDs, it would make sense to implement the same logic by hand. |
I created a new issue so we don't lose track of the work. |
I did see the mention of the simple format without hyphens in the original issue and was going to support it, but the grammar for how to represent a UUID in string form in RFC 4122 does seem to require the hyphens: https://tools.ietf.org/html/rfc4122#section-3 With that said, the decision to strictly adhere to RFC 4122 was my own and this project may prefer to support more representations, but I wanted to give context for why I left it out in this PR. |
I’m with @akonradi here and happy to provide a benchmark for Java. There are objects being created in the background and they get persisted throughout the lifetime of the whole program. @nichegriffy yeah it does and I guess that most people will also prefer to use it with hyphens because it’s the best way to distinguish it from some random hex string but I thought I’d ask to gauge whether there’s interest or not. 😉 |
See #222 |
This should resolve #61
As the title states, this PR adds
uuid
as a well-known string type that verifies it looks like a UUID per RFC 4122.I decided to add one
uuid
validator rather than version-specific validators because I figured the most common use case would be verifying that the string looks like a UUID rather than a particular version, as well as to be able to support the special nil UUID.