Closed
Description
Description
When I use Uid component to create uuid there are several string versions and Uuid::fromString("4oTFxYQsVAJZgKJBeSCKVb")
accepts any of them and recreates the whole Uuid object.
Symfony\Component\Uid\UuidV6 {#3618 ▼
#uid: "1ec7cfb7-e1a9-6c5a-b08f-3fa102f64a6a"
toBase58: "4oTFxYQsVAJZgKJBeSCKVb"
toBase32: "0YRZ7VFRD9DHDB13SZM41FCJKA"
time: "2022-01-24 09:53:33.595145 UTC"
}
But Uuid()
constraint and Uuid::isValid()
checks only against "rfc4122" format.
Uuid::isValid("4oTFxYQsVAJZgKJBeSCKVb"); // false
Uuid::fromString("4oTFxYQsVAJZgKJBeSCKVb"); //works
When project shares in public (for example in URLs) base58 version, then it possibly need to validate the request against the same format and at the moment only option to do it is try/catching Uuid::fromString.
Would be ok to allow optional "format" variable in the constraint and also in the isValid method? Default can stay rfc4122; but also checks against base58 and base32 would be allowed.
Example
No response