Add url to validation#2874
Merged
fabaff merged 3 commits intohome-assistant:devfrom Aug 19, 2016
fabaff:url
Merged
Conversation
Contributor
|
I assume this came out of the |
| weekdays = vol.All(ensure_list, [vol.In(WEEKDAYS)]) | ||
|
|
||
|
|
||
| def url(value: Any) -> str: |
Member
There was a problem hiding this comment.
Let's not call it url, as a url can contain any protocol. Let's call it http_url
Member
There was a problem hiding this comment.
hmm, although it can obviously also be https…
Contributor
There was a problem hiding this comment.
I think it's fine as url. The definition of URL is that it is a universal resource locator, not something specifically made for HTTP(S) only. And it keeps our existing syntax of cv.string, cv.bool, etc.
Member
|
Good to merge when linting passes 👍 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Shortcut for the validation of URLs.
voluptuousis usingurllib.parseto validate an URL but I think that we should be more restrictive and only allowhttp/httpsashtpwill definitely not lead to a success.Schemas for REST/aREST could benefit from this.
Related issue (if applicable): fixes #2800
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#
Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass