Closed heindrickdumdum0217 closed 3 months ago
Could you please share your model, which cause the problem? Becase I have test for a model with HttpUrl and it works.
Class User(ESModel):
avatar_image_url: HttpUrl
class Comment(ESModel):
id: unsigned_long
url: HttpUrl
user: User
I think the error happens in User
model.
I've just tested:
async def test():
import esorm
from pydantic import HttpUrl
from esorm.fields import unsigned_long
class User(esorm.ESModel):
avatar_image_url: HttpUrl
class Comment(esorm.ESModel):
id: unsigned_long
url: HttpUrl
user: User
await esorm.setup_mappings()
doc = Comment(id=1, url='http://example.com',
user=User(avatar_image_url='https://xxx.yyy.com/images/thumbnails/114496'))
doc_id = await doc.save()
assert doc_id is not None
This just works.
Are you sure you using v0.5.0?
Can I close this issue?
It still throws bugs, but I'm not sure it's Pydantic
bug or esorm
issue.
As my brief checking, it happens when receive encoded urls.
Ok, I close this for now, as I think it is fixed in the new version according to my tests. I used exactly your model, and it works.
Environment
Got the following error.