-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[ | ||
{ | ||
"description": "uuid format", | ||
"schema": { | ||
"format": "uuid" | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "all upper-case", | ||
"data": "2EB8AA08-AA98-11EA-B4AA-73B441D16380", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "all lower-case", | ||
"data": "2eb8aa08-aa98-11ea-b4aa-73b441d16380", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "mixed case", | ||
"data": "2eb8aa08-AA98-11ea-B4Aa-73B441D16380", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "all zeroes is valid", | ||
"data": "00000000-0000-0000-0000-000000000000", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "wrong length", | ||
"data": "2eb8aa08-aa98-11ea-b4aa-73b441d1638", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "missing section", | ||
"data": "2eb8aa08-aa98-11ea-73b441d16380", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "bad characters (not hex)", | ||
"data": "2eb8aa08-aa98-11ea-b4ga-73b441d16380", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "no dashes", | ||
"data": "2eb8aa08aa9811eab4aa73b441d16380", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "valid version 4", | ||
"data": "98d80576-482e-427f-8434-7f86890ab222", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "valid version 5", | ||
"data": "99c17cbb-656f-564a-940f-1a4568f03487", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "hypothetical version 6", | ||
"data": "99c17cbb-656f-664a-940f-1a4568f03487", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "hypothetical version 15", | ||
"data": "99c17cbb-656f-f64a-940f-1a4568f03487", | ||
"valid": true | ||
} | ||
] | ||
karenetheridge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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
..so these implementations are being needlessly (and invalidly) too strict. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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)! |
||
] |
Uh oh!
There was an error while loading. Please reload this page.