class-validator icon indicating copy to clipboard operation
class-validator copied to clipboard

feature: 🔍 Add support for UUID v7 in `IsUUID` validator

Open maltyxx opened this issue 10 months ago • 3 comments

Description

Currently, the IsUUID validator in class-validator only supports UUID versions 3, 4, and 5, but does not support UUID v7.

UUID v7 is gaining adoption due to its chronological ordering and improved indexing performance, making it a preferred choice for databases and APIs. Many modern applications are switching to UUID v7, and its absence in class-validator makes validation inconsistent with newer standards.


Proposed solution

It would be great if class-validator could add support for UUID v7 in the IsUUID validator.

Since UUID v7 is already supported by validator.js, it should be possible to extend the existing validation to include it.


Additional context

  • validator.js (which class-validator relies on) already supports UUID v7, so it would be great to make use of this.
  • UUID v7 is designed for better performance and scalability, especially in databases that require efficient indexing.
  • Adding UUID v7 support would ensure class-validator remains compatible with modern UUID standards.

Would love to know if this is planned!
Thanks for all the great work on class-validator 🚀

maltyxx avatar Feb 13 '25 23:02 maltyxx