Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

UUID matcher throws error for NIL uuid #203

Closed
knyk opened this issue Mar 23, 2020 · 8 comments
Closed

UUID matcher throws error for NIL uuid #203

knyk opened this issue Mar 23, 2020 · 8 comments

Comments

@knyk
Copy link

knyk commented Mar 23, 2020

for uuid 00000000-0000-0000-0000-000000000000 it is throwing an error

@norberttech
Copy link
Member

hmm because it's not valid uuid? Can you be more precise and tell me what kind of error and what is the behavior that you expect?

@knyk
Copy link
Author

knyk commented Mar 23, 2020

it is valid uuid for sure. look at RFC https://tools.ietf.org/html/rfc4122#section-4.1.7

@norberttech
Copy link
Member

No, it's not valid uuid because you can't generate it - it's special type of uuid and I would like to understand the use case in which matcher should support if you expect from me to fix it.

@knyk
Copy link
Author

knyk commented Mar 23, 2020

I really can't find the place in RFC where it is written that NIL uuid is not valid uuid to be honest.
The use case is It is very easy to use uuid just by using constant Ramsey\Uuid::NIL. You can use It for example in doctrine fixtures and then in easy cases You don't need to think and check what was the uuid i've used in that fixture - just use const from Ramsey

No, it's not valid uuid because you can't generate it

Ramsey\Uuid::isValid return true for It and I'am pretty sure that symfony uuid constraint too

@norberttech
Copy link
Member

I would recommend you to not use NIL uuid and just generate one instead because like I said, it's not type of UUID that can be generated (you won't get it from any api).
However if you really need support for NIL uuid then feel free to open PR

@knyk
Copy link
Author

knyk commented Mar 23, 2020

I'am using NILs for a long time for for testing purposes without any false positives and so on.
Trust me, there are many types of APIs, not all of them implements uuid the right way.

For now case is not crucial for me. Maybe later when I would have some free time

@norberttech
Copy link
Member

Trust me, there are many types of APIs, not all of them implements uuid the right way.

maybe but it's not a valid scenario that would make me to invest my private time to fix "bug" that affects only wrong usages of the UUID.
I'm closing this issue for now, feel free to open a PR whenever you find time, thanks!

@emodric
Copy link

emodric commented Apr 8, 2021

Hi. This just bit me when matching some data in my JSON documents. We use a NIL UUID as a perfectly valid UUID which denotes a root of a tree of some data and PHP Matcher cannot work with it when using @uuid@ matcher.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants