Skip to content

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

Closed
wants to merge 2 commits into from
Closed

Conversation

karenetheridge
Copy link
Member

No description provided.

@karenetheridge karenetheridge requested a review from a team June 11, 2020 15:06
"valid": false
},
{
"description": "bad characters",
Copy link
Member

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
}
]
}
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member Author

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).

Copy link
Member

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)!

Copy link
Member

@Julian Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM well done

karenetheridge added a commit that referenced this pull request Jun 15, 2020
@karenetheridge karenetheridge deleted the ether/format-uuid branch June 15, 2020 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants