Skip to content

Conversation

@ben-walters
Copy link
Contributor

Adds wrapper options to .uuid() function to enable stricter validation rules when validating uuid's.

joi.uuid()                  // retains current functionality

joi.uuid({wrapper: true})   // uuid MUST be wrapped by any of the allowed brackets
joi.uuid({wrapper: false})  // uuid MUST NOT be wrapped in any of the allowed brackets
joi.uuid({wrapper: '{'})    // uuid MUST be wrapped by { }
joi.uuid({wrapper: '['})    // uuid MUST be wrapped by [ ]
joi.uuid({wrapper: '('})    // uuid MUST be wrapped by ( )

closes #3081

Copy link
Collaborator

@Marsup Marsup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, I just have a few questions

@ben-walters
Copy link
Contributor Author

Updated the code as per your comments @Marsup . Thanks for taking the time to review.

@Marsup Marsup added this to the 18.0.0 milestone Aug 3, 2025
@Marsup Marsup self-assigned this Aug 3, 2025
@Marsup Marsup added the feature New functionality or improvement label Aug 3, 2025
Copy link
Collaborator

@Marsup Marsup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll add the types and it's good to go.

@Marsup Marsup force-pushed the feature/fail-bracketed-uuid branch from 6ea9c92 to d8d8434 Compare August 3, 2025 14:16
@Marsup Marsup merged commit 6c9dead into hapijs:master Aug 3, 2025
9 checks passed
@Marsup Marsup mentioned this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New functionality or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toggle brackets when validating UUID's

2 participants