pydantic-extra-types
pydantic-extra-types copied to clipboard
Feature request: RFC 1123 and RFC 1035
The RFCs are defined here: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
This looks like a string type with a re.fullmatch Validator. For example, I think the regex string for an RFC 1035 label should be:
[a-z][0-9a-z-]{0,61}[0-9a-z]|[a-z]
The part before the | matches cases with 2 to 63 letters total, while the final [a-z] supplies the single-letter case. Similarly, an RFC 1123 Label would be
[0-9a-z][0-9a-z-]{0,61}[0-9a-z]|[0-9a-z]
I've entered these into https://regex101.com/ and it LGTM.