Deepwalker / trafaret

Ultimate transformation library that supports validation, contexts and aiohttp.
http://trafaret.readthedocs.org/en/latest/
BSD 2-Clause "Simplified" License
177 stars 31 forks source link

Hex and URLSafe validators #106

Closed Dreamsorcerer closed 4 years ago

Dreamsorcerer commented 4 years ago

Would be nice to have a couple more String validators that validated the string as e.g. hex or url safe. Matching for example, the output you'd get from secrets.token_hex() and secrets.token_urlsafe().

Deepwalker commented 4 years ago

In this case it is better to create PR with validations that you want to add, because I, personally, do not really understand what do you want to add and its use cases.

Dreamsorcerer commented 4 years ago

Well, use case is validating that a string matches the format from one of those functions. In particular, the urlsafe one could be used to check that a string is safe to be output into a URL.

I'll definetely have a go at creating these myself though, and I'll send a PR then.