-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Bug
Output of 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.
RFC 8089 says that the hostname is optional. Hence I would expect that AnyUrl would accept that.
xkortex, lucemia and alexo77
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X