Skip to content

The .uuid property does not give the right UUID according to spec/valid.yml #15

@jamt9000

Description

@jamt9000

According to the spec, the typeid 00000000000000000000000000 should become an all-zero uuid:

Implementations SHOULD allow encoding/decoding of other UUID variants when the bits are provided by end users. This makes it possible for applications to encode other UUID variants like UUIDv1 or UUIDv4 at their discretion.

https://github.com/jetify-com/typeid/blob/3c625fbca835217be361e6ff16d3d4ec255470e6/spec/valid.yml#L28-L31

- name: nil
  typeid: "00000000000000000000000000"
  prefix: ""
  uuid: "00000000-0000-0000-0000-000000000000"

However, this implementation seems to be converting it to a uuid7 00000000-0000-7000-8000-000000000000

In [1]: from typeid import TypeID

In [2]: TypeID(suffix="00000000000000000000000000")
Out[2]: TypeID('00000000000000000000000000')

In [3]: TypeID(suffix="00000000000000000000000000").uuid
Out[3]: UUID('00000000-0000-7000-8000-000000000000')

Which means it is not roundtrip-safe when converting back to a typeid:

In [4]: TypeID.from_uuid(TypeID(suffix="00000000000000000000000000").uuid)
Out[4]: TypeID('0000000000e008000000000000')

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcore

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions