add script to update spec, update spec files

This commit is contained in:
Sloane Perrault 2023-07-06 10:22:31 -04:00
parent 5bf8b50e2d
commit a9186592d6
No known key found for this signature in database
3 changed files with 17 additions and 3 deletions

View file

@ -4,7 +4,7 @@
# Each example contains an invalid TypeID string. Implementations are expected
# to throw an error when attempting to parse/validate these strings.
#
# Last updated: 2023-06-29
# Last updated: 2023-07-05
- name: prefix-uppercase
typeid: "PREFIX_00000000000000000000000000"
@ -31,7 +31,7 @@
description: "The prefix can't have any spaces"
- name: prefix-64-chars
# 123456789 123456789 123456789 123456789 123456789 123456789 1234
# 123456789 123456789 123456789 123456789 123456789 123456789 1234
typeid: "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl_00000000000000000000000000"
description: "The prefix can't be 64 characters, it needs to be 63 characters or less"
@ -81,3 +81,8 @@
# This example would be valid if we were using the crockford hyphenation rules
typeid: "prefix_123456789-0123456789-0123456"
description: "The suffix can't ignore hyphens as in the crockford encoding"
- name: suffix-overflow
# This is the first suffix that overflows into 129 bits
typeid: "prefix_8zzzzzzzzzzzzzzzzzzzzzzzzz"
description: "The should encode at most 128-bits"

View file

@ -23,7 +23,7 @@
# note that not all of them are UUIDv7s. When *generating* new random typeids,
# implementations should always use UUIDv7s.
#
# Last updated: 2023-06-29
# Last updated: 2023-07-05
- name: nil
typeid: "00000000000000000000000000"
@ -50,6 +50,11 @@
prefix: ""
uuid: "00000000-0000-0000-0000-000000000020"
- name: max-valid
typeid: "7zzzzzzzzzzzzzzzzzzzzzzzzz"
prefix: ""
uuid: "ffffffff-ffff-ffff-ffff-ffffffffffff"
- name: valid-alphabet
typeid: "prefix_0123456789abcdefghjkmnpqrs"
prefix: "prefix"

4
scripts/update_spec.sh Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash -ex
wget https://raw.githubusercontent.com/jetpack-io/typeid/main/spec/invalid.yml -O priv/spec/invalid.yml
wget https://raw.githubusercontent.com/jetpack-io/typeid/main/spec/valid.yml -O priv/spec/valid.yml