Skip to content
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

feature: Add support for v1 and v2 UUIDs to isUUID() #1497

Closed
rjschineller opened this issue Jan 17, 2022 · 2 comments
Closed

feature: Add support for v1 and v2 UUIDs to isUUID() #1497

rjschineller opened this issue Jan 17, 2022 · 2 comments
Labels
status: done/released Issue has been completed, no further action is needed. type: feature Issues related to new features.

Comments

@rjschineller
Copy link

rjschineller commented Jan 17, 2022

Description

A project I'm working with makes heavy use of this package, and we are starting to use v1 UUIDs in certain areas where we need to glean certain time info from the UUID. I would love to be able to use this package to validate v1 and v2 UUIDs as well.

Luckily validator.js has already expanded this functionality to accept type 1 and 2 UUIDS in ver 13.7.0. And the functionality just needs to be expanded here.

Proposed solution

This should be an easy drop in replacement in src/decorator/string/IsUUID.ts

Original:

export type UUIDVersion = '3' | '4' | '5' | 'all' | 3 | 4 | 5;

Modified:

export type UUIDVersion = '1' | '2' | '3' | '4' | '5' | 'all' | 1 | 2 | 3 | 4 | 5;
@rjschineller rjschineller added flag: needs discussion Issues which needs discussion before implementation. type: feature Issues related to new features. labels Jan 17, 2022
@NoNameProvided NoNameProvided added status: done/released Issue has been completed, no further action is needed. and removed flag: needs discussion Issues which needs discussion before implementation. labels Dec 9, 2022
@NoNameProvided
Copy link
Member

NoNameProvided commented Dec 9, 2022

I have switched to using the official type from validator in the @IsUUID decorator. However, the typing is not updated yet, once it is you will be able to use 1 and 2 as versions.

If you want to take the updating of things into your own hand, you can do so here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0039ca2aaaf3b372e9664fd2e765a1eba3ca5a46/types/validator/index.d.ts#L1105 (permalink)

I am closing this as done because there is no action to take on our side.

@github-actions
Copy link

github-actions bot commented Jan 9, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: done/released Issue has been completed, no further action is needed. type: feature Issues related to new features.
Development

No branches or pull requests

2 participants