uustupid
It looks like a UUID. It can never be one.UUID の見た目。UUID には決してならない。
uustupid()
This is not a UUID. Never use it where a real UUID is expected. It is for jokes, mocks and fixtures.これは UUID ではありません。UUID が必要な場所では使わないでください。用途はジョーク、モック、テストデータです。
All 32 hex digits come from Web Crypto. The two nibbles RFC 9562 reserves are then moved out of its reach and kept there — far enough that no future revision of the spec could turn a value into a UUID after the fact.32 桁はすべて Web Crypto の乱数です。RFC 9562 が予約している 2 桁だけを範囲の外へ出し、そこに留めます — 将来 RFC が改訂されても、後から有効な UUID になってしまわない位置まで。
Out of range, and out of reach範囲の外へ、そして手の届かない場所へ
The version nibble is one of the eight RFC 9562 leaves unassigned, and the variant always has the one bit its 10xx pattern can never have. That is enough today — but 9 through f are unassigned, not unassignable. If the RFC ever gives one of them a meaning, only the variant would still be holding the line, so those versions are paired exclusively with the 0xxx variant space, which NCS backward compatibility already spent. Version 0 needs no such help: the Nil UUID owns it forever.version ニブルは RFC 9562 が割り当てていない 8 通りのいずれか、variant は 10xx が決して持てないビットを常に立てます。今日はこれで十分です — ただし 9〜f は「未割り当て」であって「割り当て不能」ではありません。将来どれかに意味が与えられたら、残るのは variant だけになる。だからそれらの version には、NCS 後方互換が既に使い切った 0xxx の variant だけを組み合わせます。version 0 にはこの手当ては不要です — Nil UUID が永久に押さえているからです。
Neither special UUID can come out, and neither needs a guard: Nil would need a zero byte where the variant bit now sits, and Max would need an f variant, which only version 0 can pair with. Everything else is untouched randomness — all 16 values show up in each of the other 30 digits.2 つの特殊な UUID はどちらも出ませんし、そのためのガードも要りません。Nil は variant のビットがある位置に 0 が必要で、Max は variant が f である必要がありますが、それと組めるのは version 0 だけだからです。それ以外は手つかずの乱数で、他の 30 桁には 16 通りすべてが出ます。
Why this is not a UUIDなぜ UUID ではないのか
Out of 36 characters, RFC 9562 assigns meaning to two. Either one may land on a value the RFC uses — but never both at once, and that is the whole trick.36 文字のうち RFC が意味を決めているのは 2 桁。どちらか片方が RFC の使う値に入ることはあります — ただし両方同時には決して入りません。仕掛けはそれだけです。
57da56b9-d5be-d624-64a2-cd9be7c6c26e
Both out of range, at the same time, every time. That is the whole reason this is not a UUID — a validator only has to read one of them to say no.この 2 つが毎回、同時に範囲外です。UUID でない理由はそれだけ — 検証器はどちらか一方を読むだけで「違う」と言えます。
Highlighted above: the version nibble at index 14 and the variant nibble at index 19. The other 34 characters are ordinary random hex.上で色を付けているのが 14 文字目の version ニブルと 19 文字目の variant ニブルです。残り 34 文字はただの乱数の 16 進数です。
See for yourself検証してみる
Both values below were fed to an RFC 9562 validator embedded in this page. That validator shares no code with the package.このページに埋め込んだ RFC 9562 検証器に食わせた結果です。検証器はパッケージのコードを一切使っていません。
uustupid()57da56b9-d5be-d624-64a2-cd9be7c6c26eNot a UUID無効な UUIDcrypto.randomUUID()0c3e5254-93a1-4baa-8d9a-f550145b20deValid UUID有効な UUIDFresh values on every load. The verdicts never swap around.読み込むたびに新しい値で判定しています。何度試しても結果は入れ替わりません。
What the ecosystem saysエコシステムの判定
Every validator below was given the same 100 uustupids and the same 100 real UUIDs while this page was built. A tick means all 100 answers were the expected ones. A cross means at least one was not, and the number says how many of the 100 were wrong.このページのビルド時に、どの検証器にも同じ 100 個の uustupid と、同じ 100 個の本物の UUID を食わせた結果です。✓ は 100 回すべて想定どおりに判定したこと、✗ は一度でも想定と違う判定をしたことを表し、数字は 100 回中の誤判定の回数です。
Rejected every uustupiduustupid をすべて弾いた検証器
These read the version and variant that RFC 9562 reserves, so not one uustupid got through.RFC 9562 が予約している version と variant を読むので、uustupid を 1 つも通しませんでした。
| Packageパッケージ | Validator検証器 | uustupid() | crypto.randomUUID() | Intended意図された挙動か |
|---|---|---|---|---|
uuid | validate() | Rejected allすべて弾いた | Accepted allすべて通した | — |
validator | isUUID() | Rejected allすべて弾いた | Accepted allすべて通した | — |
is-uuid | anyNonNil() | Rejected allすべて弾いた | Accepted allすべて通した | — |
zod | z.uuid() | Rejected allすべて弾いた | Accepted allすべて通した | — |
yup | string().uuid() | Rejected allすべて弾いた | Accepted allすべて通した | — |
arktype | string.uuid | Rejected allすべて弾いた | Accepted allすべて通した | — |
fastest-validator | uuid | Rejected allすべて弾いた | Accepted allすべて通した | — |
@sapphire/ | s.string().uuid() | Rejected allすべて弾いた | Accepted allすべて通した | — |
effect | Schema.isUUID() | Rejected allすべて弾いた | Accepted allすべて通した | — |
Called a uustupid a UUIDuustupid を UUID と判定した検証器
These accepted at least one uustupid. The last column says whether the library means to.1 つでも uustupid を通したものです。最後の列は、それがライブラリの意図した挙動かどうかです。
| Packageパッケージ | Validator検証器 | uustupid() | crypto.randomUUID() | Intended意図された挙動か |
|---|---|---|---|---|
valibot | v.uuid() | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 Checks only the 8-4-4-4-12 shape and never reads the version or variant.8-4-4-4-12 の形だけを見ていて、version も variant も読んでいません。 |
decoders | uuid | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 Checks only the 8-4-4-4-12 shape and never reads the version or variant.8-4-4-4-12 の形だけを見ていて、version も variant も読んでいません。 |
@nestjs/ | new ParseUUIDPipe() | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 Checks only the 8-4-4-4-12 shape and never reads the version or variant.8-4-4-4-12 の形だけを見ていて、version も variant も読んでいません。 |
io-ts-types | UUID | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 Checks only the 8-4-4-4-12 shape and never reads the version or variant.8-4-4-4-12 の形だけを見ていて、version も variant も読んでいません。 |
@deepkit/ | UUID | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 Checks only the 8-4-4-4-12 shape and never reads the version or variant.8-4-4-4-12 の形だけを見ていて、version も variant も読んでいません。 |
@bufbuild/ | string.uuid | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 Checks only the 8-4-4-4-12 shape and never reads the version or variant.8-4-4-4-12 の形だけを見ていて、version も variant も読んでいません。 |
joi | string().uuid() | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 Accepts GUID-style strings, not only RFC 9562 UUIDs.RFC 9562 の UUID に限らず、GUID 形式の文字列も受け入れる設計です。 |
graphql-scalars | UUID | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 Accepts GUID-style strings, not only RFC 9562 UUIDs.RFC 9562 の UUID に限らず、GUID 形式の文字列も受け入れる設計です。 |
validator | isUUID(value, 'loose') | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 An explicitly loose mode that checks only the shape.形だけを見ると明示された緩いモードです。 |
zod | z.guid() | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 An explicitly loose mode that checks only the shape.形だけを見ると明示された緩いモードです。 |
ajv-formats | format: "uuid" | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
@exodus/ | format: "uuid" | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
@cfworker/ | format: "uuid" | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
jsonschema | format: "uuid" | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
z-schema | format: "uuid" | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
json-schema-library | format: "uuid" | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
typebox | format: "uuid" | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
elysia | t.String({ format: "uuid" }) | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
typia | tags.Format<"uuid"> | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
sury | S.uuid | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 JSON Schema defines format "uuid" as a syntax check, and its official test suite requires an undefined version and variant to pass.JSON Schema は format "uuid" を構文のチェックと定めており、公式テストスイートが未定義の version と variant を有効とするよう要求しています。 |
bson | UUID.isValid() | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 Treats a UUID as any 128-bit value, whatever its version and variant.version や variant に関係なく、UUID を任意の 128 ビット値として扱います。 |
id128 | Uuid.isCanonical() | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 Treats a UUID as any 128-bit value, whatever its version and variant.version や variant に関係なく、UUID を任意の 128 ビット値として扱います。 |
uuidv7 | UUID.parse() | Accepted通した 100/100 | Accepted allすべて通した | Yes.はい。 Treats a UUID as any 128-bit value, whatever its version and variant.version や variant に関係なく、UUID を任意の 128 ビット値として扱います。 |
zod | z.string().uuid() from 'zod/v3' | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 An older major version. The current major reads the version and variant.旧メジャー版です。現行のメジャー版は version と variant を読みます。 |
effect | Schema.UUID | Accepted通した 100/100 | Accepted allすべて通した | No.いいえ。 An older major version. The current major reads the version and variant.旧メジャー版です。現行のメジャー版は version と variant を読みます。 |
Each version shown is the one installed when the page was built. If a library changes its behavior, it simply moves to the other table on the next build: nothing fails. None of these libraries reach your browser.バージョンは、ページのビルド時にインストールされていたものです。ライブラリの挙動が変われば、次のビルドでもう一方の表に移るだけで、何も失敗しません。これらのライブラリがブラウザに届くことはありません。
Generate in bulkまとめて生成
- adac0d37-f35c-f4d6-43db-7ca4d6cc1c6c
- dcd532be-e0c5-0a6d-7df1-88a8784bac75
- e27051bb-a525-9933-5b61-c678c83b3eec
- ce4f74fe-98f2-b0bb-50df-4d651131595e
- 60b42d5c-575d-cd69-7497-587b7a09087d
- f0120317-e3b4-dc01-5c0f-f6505adb4490
- b057f364-b8b5-9607-7f1d-137388fbc60b
- 67e7bd0b-49e3-d915-7cdc-a591c088603d
- 3b606050-c5d7-cbb3-6158-3eb62bb03c67
- b61209ae-30b2-d20a-4037-d16c3a8b8668
- 62b42cc2-5ca2-9d9b-71a1-3d3b8369a86c
- 8cd4ac45-4170-b887-68d3-a50d4e97c154
- 69f00ea0-4e35-948c-6b60-49bd5c6ccbc9
- 7843aef2-9be7-d83b-6029-a8ea792810c8
- 4b74d49c-6eb2-ef22-7461-3a66ab4f45d0
- 4f45ff25-a2e2-ae21-73fe-e95e7f4de2a8
Installインストール
No dependencies, one entry point, under 3 kB. Runs on Node.js 22+, browsers, Cloudflare Workers, Deno and Bun.依存ゼロ、エントリ 1 本、3 kB 未満。Node.js 22+ / ブラウザ / Cloudflare Workers / Deno / Bun で動きます。
npm install uustupidpnpm add uustupidyarn add uustupidbun add uustupidUsage使い方
import { uustupid, isUustupid } from 'uustupid'
uustupid() // => '35c8928b-2e6f-0eb0-446b-b2dd0fec9d0c'
uustupid() // => '2d3dd9e3-3048-9058-5637-710af513cf2e'
isUustupid(uustupid()) // => true
isUustupid(crypto.randomUUID()) // => false