Skip to content

feat!: accept only canonical UUIDs and drop Normalize - #12

Merged
enilsen16 merged 2 commits into
mainfrom
feat/strict-uuid
Oct 22, 2026
Merged

enilsen16 merged 2 commits into
mainfrom
feat/strict-uuid

Conversation

@enilsen16

@enilsen16 enilsen16 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • ValidateUUID accepts only the canonical form: 36 characters, lowercase and hyphenated. It rejects upper case, URN, brace and unhyphenated forms. One UUID can then never be two different IDs, which is the TypeID spec rule.
  • Definition.Normalize and NormalizeUUID are removed. The Elixir package has no matching option: its cast returns parse/1 unchanged, and validate: :uuid keeps the value as given. Validate is again the only hook, the same name as in Elixir.

This is a breaking change before v1. Callers that receive other UUID forms convert them before New, for example with uuid.Parse(s) and then .String(). The matching Elixir change is to make validate: :uuid accept only the canonical form too.

#11 needs to merge first, so this releases as 0.3.0 and not 1.0.0.

Tests

TestValidateUUID covers the canonical form and each rejected form. The existing decoder tests already check that Parse, FromStorage, Scan and JSON return ErrInvalidUUID. The Normalize tests and example are removed.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Signed-off-by: Erik Nilsen <enilsen16@live.com>
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 40405faa-60e2-4377-9ddb-61e1e473e1b4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@enilsen16
enilsen16 marked this pull request as ready for review October 22, 2026 14:51
Signed-off-by: Erik Nilsen <enilsen16@live.com>
@enilsen16
enilsen16 merged commit 1e35add into main Oct 22, 2026
3 checks passed
@enilsen16
enilsen16 deleted the feat/strict-uuid branch October 22, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant