go-playground / validator

:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
MIT License
16.07k stars 1.29k forks source link

Make `url` and `http_url` work with url.URL. #1231

Open bfabio opened 4 months ago

bfabio commented 4 months ago

Fixes Or Enhances

This makes the url and http_url validations work with url.URL or any newtype that implements the Stringer interface. I'm not familiar with the codebase so it's kind of a PoC PR to see if you think this can be useful.

Make sure that you've checked the boxes below before you submit PR:

But they don't pass, if this is a feature we want and it's the right approach I can investigate deeper. I suspect the reflection magic isn't working as I expected.

@go-playground/validator-maintainers