-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] UID Constraint. #36407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Validator] UID Constraint. #36407
Conversation
This PR proposes a single Uid constraint and allows the user to choose the UID types between ULID, UUID_V1, UUID_V3, UUID_V4, UUID_V5 and UUID_V6 (multiple values possible). According to the feedbacks received so far, it looks like some people would prefer to have not only one single Uid Constraint, but 2 constraints:
It's ok and i will update my code accordingly. But we have to take a few decisions about the Uuid Constraint. Indeed, there is already a Uuid Constraint in Symfony: https://symfony.com/doc/current/reference/constraints/Uuid.html So the purpose would be to update this existing contraint in order to use the new Uid Component. But this existing constraint has a By the way, the existing constraint can valid V2 UUID versions. V2 is not handled in the new Uid Component. Should we juste use the Uuid::isValid() method and check for number 2 at proper position to valid UUID V2 uuids? Should we also accept UUIDs encoded in base 58 and 32? |
I'd vote to create a single constraint for all kinds of Uids. That would be consistent with what we already do in other constraints:
|
IPv4 and IPv6 are both different versions of the IP adres. "UID" is just an abbreviation for a fancy name, it does not define a specific string or format. E.g. That's why I don't think a single constraint makes sense. Also, as said in the comment of @guillbdx, there is already a UUID constraint. So it makes sense to focus this PR on updating the UUID constraint and introducing a ULID one. About loose/strict: We can keep it imho. Loose will validate just the string as it's doing atm, the strict variant will use the UID component. |
Thanks @javiereguiluz and @wouterj I will wait for other feedbacks to see what are the other pro and cons. |
I agree with @wouterj |
@guillbdx Still interested in working on this PR? @wouterj and @nicolas-grekas agree on a way to move forward. |
@fabpot I won't have time to work on it for a while, would be better that someone take it over. |
Thanks for the head up. As there is an associated issue, let’s close here. |
UID constraint.