We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
pydantic version: 1.5.1 pydantic compiled: True install path: /shared/conda/envs/ubide-mastr/lib/python3.6/site-packages/pydantic python version: 3.6.10 |Anaconda, Inc.| (default, May 8 2020, 02:54:21) [GCC 7.3.0] platform: Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid optional deps. installed: []
import pydantic class MyModel(pydantic.BaseModel): url: pydantic.AnyUrl MyModel(url='file:///foo/bar')
raises:
ValidationError: 1 validation error for MyModel url URL host invalid (type=value_error.url.host)
However, MyModel(url='file://hostname/foo/bar'), i.e. a URL with an explicit hostname, works.
MyModel(url='file://hostname/foo/bar')
RFC 8089 says that the hostname is optional. Hence I would expect that AnyUrl would accept that.
AnyUrl
The text was updated successfully, but these errors were encountered:
I guess we could add host_required like user_required, then make it true for most of the descendant types.
host_required
user_required
Sorry, something went wrong.
FileUrl
file://
anyurl doesn't work for JDBC connection URL either "jdbc:mysql://localhost/test" invalid or missing URL scheme (type=value_error.url.scheme)
I have made Optional[HttpUrl] = None, still not working
Successfully merging a pull request may close this issue.
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:raises:
However,
MyModel(url='file://hostname/foo/bar')
, i.e. a URL with an explicit hostname, works.RFC 8089 says that the hostname is optional. Hence I would expect that
AnyUrl
would accept that.The text was updated successfully, but these errors were encountered: