-
-
Notifications
You must be signed in to change notification settings - Fork 219
tests for the "uuid" format #401
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
Conversation
"valid": false | ||
}, | ||
{ | ||
"description": "bad characters", |
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.
Maybe "non-hex" is a bit clearer if that's what this one is trying to test, seems so?
"valid": false | ||
} | ||
] | ||
} |
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.
Also also probably good to have a UUID 6 (i.e. by inserting 6 where the version goes) and assert it's invalid?
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.
good call. I've seen some regexes that are tighter and only accept the current versions, but indeed the RFC says
Apart from determining whether the timestamp portion of the UUID is in the future and therefore not yet assignable, there is no mechanism for determining whether a UUID is 'valid'.
..so these implementations are being needlessly (and invalidly) too strict.
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.
invalid, or valid? IMO we should accept future versions as well.
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.
fwiw I just tried a "future version" uuid in PostgreSQL against its uuid data type and it accepted version 6 and version 15 (f).
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.
Cool, yep good catch (I didn't go read the RFC first, so yeah seems valid is the right behavior)!
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.
LGTM well done
tests for the "uuid" format
No description provided.