From a9186592d632a8967caee7d4f4d940b872681c3f Mon Sep 17 00:00:00 2001 From: Sloane Perrault Date: Thu, 6 Jul 2023 10:22:31 -0400 Subject: [PATCH] add script to update spec, update spec files --- priv/spec/invalid.yml | 9 +++++++-- priv/spec/valid.yml | 7 ++++++- scripts/update_spec.sh | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100755 scripts/update_spec.sh diff --git a/priv/spec/invalid.yml b/priv/spec/invalid.yml index c1470a2..6a2870b 100644 --- a/priv/spec/invalid.yml +++ b/priv/spec/invalid.yml @@ -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" diff --git a/priv/spec/valid.yml b/priv/spec/valid.yml index cf31f0c..8f63250 100644 --- a/priv/spec/valid.yml +++ b/priv/spec/valid.yml @@ -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" diff --git a/scripts/update_spec.sh b/scripts/update_spec.sh new file mode 100755 index 0000000..0a7678c --- /dev/null +++ b/scripts/update_spec.sh @@ -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