Skip to content

Should we add checks for valid variant (and version)? #198

@kohenkatz

Description

@kohenkatz

Related, but minor, the tests above, ironically don't set the UUIDv7 variant bits correctly. (the relevant hex character should probably be a b for the max UUIDv7 and an 8 for the min UUDv7)

Originally posted by @nathanmcgarvey-modopayments in #195


Looking through our tests, we have a number of places where a text-format UUID ends with ffff-ffffffffffff, even though these should be bfff-ffffffffffff to indicate the correct variant.

Should we have a validation in UUID.Parse that makes sure the variant is valid? What about making sure the version is valid? Right now, we don't do any checking for this, and we don't have a method for the user to check validity either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions