Open grimurd opened 4 years ago
Hi, we use validator.js internally and they seem to have a isIPRange()
validator but it haven't been imported to class-validator yet. Feel free to open a PR
It only support ipv4 so you would also have to open an issue there to ask a feature request for IPv6 range
Description
Currently the IP validation fails when a IP subnet using CIDR notation is given.
Example values
Proposed solution
Add an additional argument to the IsIP validator specifying whether CIDR notation is required, optional or forbidden. Default the argument to forbidden to maintain backwards compatibility.
Optionally the CIDR prefix could be validated. It can only have value 0-32 for IPv4 or 0-128 for IPv6