Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bfabio
Copy link
Contributor

@bfabio bfabio commented Feb 14, 2024

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:

  • Tests exist or have been written that cover this particular change.

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

@bfabio bfabio requested a review from a team as a code owner February 14, 2024 13:03
@nodivbyzero
Copy link
Contributor

I've added a few comments suggesting readability improvements.
I recommend keeping the original test functions unchanged and adding new ones for the Stringer type. Also, ensure the GitHub Actions checks pass.

Support the url and http_url validations with url.URL or any
newtype that implements the Stringer interface.
@coveralls
Copy link

Coverage Status

coverage: 73.663% (-0.01%) from 73.677%
when pulling e7c250a on bfabio:urls
into bc77d03 on go-playground:master.

@bfabio
Copy link
Contributor Author

bfabio commented Jul 2, 2025

I rebased to include #1444 and tweaked it a bit.

@nodivbyzero @go-playground/validator-maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants