FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: allow custom URL scheme validation by e3krisztian · Pull Request #409 · python-validators/validators · GitHub

Repository navigation

feat: allow custom URL scheme validation - #409

Merged
nandgator merged 1 commit into
python-validators:masterfrom
e3krisztian:relax-url-scheme-check
Mar 28, 2025
Merged

nandgator merged 1 commit into
python-validators:masterfrom
e3krisztian:relax-url-scheme-check

Conversation

Copy link
Copy Markdown
Contributor

Enhances validators.url to allow

  • restricting the allowed schemes (e.g. to accept only https, and nothing else)
  • relaxing the allowed schemes to also accept less known schemes (e.g. ws, wss, ldap, ...)

This backward compatible change let's library users resolve the problematic cases requested/discussed in

nandgator self-requested a review November 30, 2024 06:09

nandgator commented Nov 30, 2024 •
edited
Loading

Copy link
Copy Markdown
Collaborator

The only issue I see is that I could pass something as dumb as:

url('httpx://crazy.example', validate_scheme=lambda x: True)

This then resolves to: #396 (comment)

nandgator added waiting Issue/PR: Wating for reply maintenance PR: Alters existing source code labels Nov 30, 2024

Copy link
Copy Markdown
Contributor Author

The only issue I see is that I could pass something as dumb as:

url('httpx://crazy.example', validate_scheme=lambda x: True)

This then resolves to: #396 (comment)

I do not understand what is the issue mentioned above, and what part of the linked comment is relevant.

Users want to have control over the accepted url schemes, because their problems define the schemes to work with which are not universal (e.g. only svn+ssh://... URLs makes sense in their problem domain).

Now some potential users can not use the functionality in the library, because the scheme check is too strict for them.
The example always succeeding the scheme check is something, that these people may love to have. Having the remaining checks might be valuable enough for them to implement custom scheme validation if needed.

In the end, doing something dumb is the users responsibility - maybe what they end up with is a novel, but valid use :)

Copy link
Copy Markdown
Contributor Author

@yozachar is there anything else I could do to get it merged and released?

Enhances `validators.url` to allow
- restricting the allowed schemes (e.g. to accept only https,
                                   and nothing else)
- relaxing the allowed schemes to also accept less known schemes
  (e.g. ws, wss, ldap, ...)
nandgator force-pushed the relax-url-scheme-check branch from 9b8d48c to 6e7beeb Compare March 28, 2025 20:33

Copy link
Copy Markdown
Collaborator

Apologies for the delay, thank you for the PR.

nandgator merged commit 9dac863 into python-validators:master Mar 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance PR: Alters existing source code waiting Issue/PR: Wating for reply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL