fix(isUUID)!: fully support rfc9562 by broofa · Pull Request #2421 · validatorjs/validator.js

PR for #2419.

Note that this will be a BREAKING CHANGE for the following reasons:

  • isUUID(str, version) will now return false if str does not have a valid variant field. (Previously only versions 4, 5, and 7 enforced this field.)
  • isUUID(str, 'all') now only allows RFC9562 UUIDS. Previously it would accept any string that looked UUID-ish ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), regardless of what values were in the version or variant fields.

provide some (credible) references showing the structure of the data to be validated, if applicable

New UUID values were generated with the uuid utility. E.g. npx uuid v6. Also, I maintain the uuid module so... 🤷

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)