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

AnyUrl & HttpUrl validation error #571

Closed
rglKali opened this issue Oct 21, 2023 · 0 comments · Fixed by #603
Closed

AnyUrl & HttpUrl validation error #571

rglKali opened this issue Oct 21, 2023 · 0 comments · Fixed by #603

Comments

@rglKali
Copy link

rglKali commented Oct 21, 2023

OS: Ubuntu 22.04.3 LTS (WSL2)

Python: 3.11.6

Redis: 7.2.2

Code sample:

from pydantic import HttpUrl, BaseModel
from redis_om import JsonModel


class Crush(BaseModel):
    http: HttpUrl

class Test(JsonModel):
    http: HttpUrl

Shell test:

kali@rglKali:~/$ python
Python 3.11.6 (main, Oct 17 2023, 16:29:19) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from test import Crush, Test
>>> Crush(http='https://avatars.githubusercontent.com/u/1529926?s=48&v=4')
Crush(http=Url('https://avatars.githubusercontent.com/u/1529926?s=48&v=4'))
>>> Test(http='https://avatars.githubusercontent.com/u/1529926?s=48&v=4')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kali/venv/lib/python3.11/site-packages/redis_om/model/model.py", line 1683, in __init__
    super().__init__(*args, **kwargs)
  File "/home/kali/venv/lib/python3.11/site-packages/redis_om/model/model.py", line 1295, in __init__
    super().__init__(**data)
  File "/home/kali/venv/lib/python3.11/site-packages/pydantic/v1/main.py", line 341, in __init__
    raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for Test
http
  instance of Url expected (type=type_error.arbitrary_type; expected_arbitrary_type=Url)
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 a pull request may close this issue.

1 participant