Giter Club home page Giter Club logo

Comments (6)

afram avatar afram commented on September 28, 2024

Hi, I'm not so sure those examples are valid UUIDs, and the regex you are using doesn't appear to be the same valid one from the example.

The RFC 4122 spec denotes that the version number should be set as the 4 most significant bits of the time-high-and-version block (first number of the 3rd block), and the variant is a variable number of most significant bits in the clock-seq-and-reserved (first number of 4th block for our use case).

Valid versions are [1 - 5] and valid variants are [89ab].

In your examples it is specifying version 7, which as far as I'm aware isn't a valid version number.

from is-uuid.

barbalex avatar barbalex commented on September 28, 2024

the regex you are using doesn't appear to be the same valid one from the example

Yeah: I actually copied this example in the answer below the one mentioned: https://stackoverflow.com/a/7905992/712005 which on first sight seemed same but actually is different. Sorry for the confusion.

I updated the sandbox to show testing with both regexes.

In your examples it is specifying version 7, which as far as I'm aware isn't a valid version number

To be honest: I am not able to follow your arguments. Because I understand nothing of uuid's besides hoping that they may never collide. So I assume you are right and obviously version 7 does not exist. Weird that validator says they are correct though.

from is-uuid.

barbalex avatar barbalex commented on September 28, 2024

I checked and found out that these two UUID's were entered manually into our database. So that was probably just a simple error from someone like me who did not know what he was doing :-(

Thanks for this great tool.

Closing.

from is-uuid.

afram avatar afram commented on September 28, 2024

The reason validator is giving you a false positive is because their regex is wrong.
https://github.com/validatorjs/validator.js/blob/c26558103efd228430f8437f68ee46c78ef8aceb/lib/isUUID.js#L16

I've raised a ticket with them
validatorjs/validator.js#1088

from is-uuid.

barbalex avatar barbalex commented on September 28, 2024

I've raised a ticket with them

Me too (closed again). Long live open source ;-)

from is-uuid.

afram avatar afram commented on September 28, 2024

\0/

Thanks for taking the time to put together comprehensive examples and test cases :-)

from is-uuid.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.