Skip to content

Commit

Permalink
[create-pull-request] automated change
Browse files Browse the repository at this point in the history
  • Loading branch information
broothie authored Apr 10, 2024
1 parent 30b899b commit 3c706b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 154 deletions.
93 changes: 5 additions & 88 deletions spec/invalid.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,5 @@
# This file contains test data that should be treated as *invalid* TypeIDs by
# conforming implementations.
#
# Each example contains an invalid TypeID string. Implementations are expected
# to throw an error when attempting to parse/validate these strings.
#
# Last updated: 2023-07-05

- name: prefix-uppercase
typeid: "PREFIX_00000000000000000000000000"
description: "The prefix should be lowercase with no uppercase letters"

- name: prefix-numeric
typeid: "12345_00000000000000000000000000"
description: "The prefix can't have numbers, it needs to be alphabetic"

- name: prefix-period
typeid: "pre.fix_00000000000000000000000000"
description: "The prefix can't have symbols, it needs to be alphabetic"

- name: prefix-underscore
typeid: "pre_fix_00000000000000000000000000"
description: "The prefix can't have symbols, it needs to be alphabetic"

- name: prefix-non-ascii
typeid: "préfix_00000000000000000000000000"
description: "The prefix can only have ascii letters"

- name: prefix-spaces
typeid: " prefix_00000000000000000000000000"
description: "The prefix can't have any spaces"

- name: prefix-64-chars
# 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"

- name: separator-empty-prefix
typeid: "_00000000000000000000000000"
description: "If the prefix is empty, the separator should not be there"

- name: separator-empty
typeid: "_"
description: "A separator by itself should not be treated as the empty string"

- name: suffix-short
typeid: "prefix_1234567890123456789012345"
description: "The suffix can't be 25 characters, it needs to be exactly 26 characters"

- name: suffix-long
typeid: "prefix_123456789012345678901234567"
description: "The suffix can't be 27 characters, it needs to be exactly 26 characters"

- name: suffix-spaces
# This example has the right length, so that the failure is caused by the space
# and not the suffix length
typeid: "prefix_1234567890123456789012345 "
description: "The suffix can't have any spaces"

- name: suffix-uppercase
# This example is picked because it would be valid in lowercase
typeid: "prefix_0123456789ABCDEFGHJKMNPQRS"
description: "The suffix should be lowercase with no uppercase letters"

- name: suffix-hyphens
# This example has the right length, so that the failure is caused by the hyphens
# and not the suffix length
typeid: "prefix_123456789-123456789-123456"
description: "The suffix should be lowercase with no uppercase letters"

- name: suffix-wrong-alphabet
typeid: "prefix_ooooooiiiiiiuuuuuuulllllll"
description: "The suffix should only have letters from the spec's alphabet"

- name: suffix-ambiguous-crockford
# This example would be valid if we were using the crockford disambiguation rules
typeid: "prefix_i23456789ol23456789oi23456"
description: "The suffix should not have any ambiguous characters from the crockford encoding"

- name: suffix-hyphens-crockford
# 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 suffix should encode at most 128-bits"
{
"message": "Moved Permanently",
"url": "https://api.github.com/repositories/650811309/contents/spec/invalid.yml",
"documentation_url": "https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api#follow-redirects"
}
71 changes: 5 additions & 66 deletions spec/valid.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,5 @@
# This file contains test data that should parse as valid TypeIDs by conforming
# implementations.
#
# Each example contains:
# - The TypeID in its canonical string representation.
# - The prefix
# - The decoded UUID as a hex string
#
# Implementations should verify that they can encode/decode the data
# in both directions:
# 1. If the TypeID is decoded, it should result in the given prefix and UUID.
# 2. If the UUID is encoded as a TypeID with the given prefix, it should
# result in the given TypeID.
#
# In addition to using these examples, it's recommended that implementations
# generate a thousands of random ids during testing, and verify that after
# decoding and re-encoding the id, the result is the same as the original.
#
# In other words, the following property should always hold:
# random_typeid == encode(decode(random_typeid))
#
# Finally, while implementations should be able to decode the values below,
# note that not all of them are UUIDv7s. When *generating* new random typeids,
# implementations should always use UUIDv7s.
#
# Last updated: 2023-07-05

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

- name: one
typeid: "00000000000000000000000001"
prefix: ""
uuid: "00000000-0000-0000-0000-000000000001"

- name: ten
typeid: "0000000000000000000000000a"
prefix: ""
uuid: "00000000-0000-0000-0000-00000000000a"

- name: sixteen
typeid: "0000000000000000000000000g"
prefix: ""
uuid: "00000000-0000-0000-0000-000000000010"

- name: thirty-two
typeid: "00000000000000000000000010"
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"
uuid: "0110c853-1d09-52d8-d73e-1194e95b5f19"

- name: valid-uuidv7
typeid: "prefix_01h455vb4pex5vsknk084sn02q"
prefix: "prefix"
uuid: "01890a5d-ac96-774b-bcce-b302099a8057"
{
"message": "Moved Permanently",
"url": "https://api.github.com/repositories/650811309/contents/spec/valid.yml",
"documentation_url": "https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api#follow-redirects"
}

0 comments on commit 3c706b4

Please sign in to comment.