Skip to content
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

feat: add extra schemes to url validation #396

Closed

Conversation

humbertogontijo
Copy link

This allows for a more flexible scheme validation

@yozachar
Copy link
Collaborator

yozachar commented Aug 8, 2024

Hi @humbertogontijo, thanks for the PR. Such URLs bAdScHeMa://github.com will be validated if extra_schemes = {'bAdScHeMa',}.

Say a library user provides a domain name, which now suppose is validated against itself, wouldn't that defeat the purpose of domain validation? I think so.

We do plan to support more schemas, see #388.


validators.url method already has a lot of parameters, wouldn't adding more, clutter it? WDYT?

@humbertogontijo
Copy link
Author

humbertogontijo commented Aug 8, 2024

The idea is to just add custom schemes. For my purpose it would be for Telegram https://core.telegram.org/api/links

I do agree that this is more a URI than URL stuff though. But it would workout while uri validation is not available

@yozachar
Copy link
Collaborator

yozachar commented Aug 9, 2024

Yes, it will work, but that is no reason for doing counter-intuitive validation. If a huge number of schemas need to be validated, something like TLD validation can be performed.

Also tg:// links need not follow the classical http URL syntax, which therefore will return ValidationError regardless of the scheme.

So is it worth it, what do you think?

@humbertogontijo
Copy link
Author

Thats ok. Thank you

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.

2 participants