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

[Bug] pydantic_encoder -> jsonable_encoder #136

Closed
rakesh-163 opened this issue Aug 21, 2024 · 4 comments
Closed

[Bug] pydantic_encoder -> jsonable_encoder #136

rakesh-163 opened this issue Aug 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@rakesh-163
Copy link

rakesh-163 commented Aug 21, 2024

What are you really trying to do?

I was trying to use the encoder example here:

https://github.com/temporalio/samples-python/tree/a0b2cdf4b0eef905776fba9b1a2805357b8b473e/pydantic_converter

Describe the bug

In the new versions, the converter was not working as advertised.

I had to modify the import of pydantic_encoder:

from pydantic.json import pydantic_encoder

to

from fastapi.encoders import jsonable_encoder

As show here:

https://fastapi.tiangolo.com/tutorial/encoder/#using-the-jsonable_encoder

--

I think it is a bug. But I am not a 100% to be honest if there is something else going on that I am not aware of.

@rakesh-163 rakesh-163 added the bug Something isn't working label Aug 21, 2024
@cretz
Copy link
Member

cretz commented Aug 21, 2024

In the new versions

Can you clarify, new versions of pydantic or new versions of the Python SDK? Specifically, can you confirm the sample does not work out of the box right now? If so, this may be a bug.

@rakesh-163
Copy link
Author

The same did not work out of the box with following versions of the SDK and Pydantic:

pydantic==2.8.2
temporalio==1.6.0

It worked when I made the one line change above.

@cretz
Copy link
Member

cretz commented Aug 21, 2024

The pydantic converter sample is meant for pydantic v1:

[tool.poetry.group.pydantic]
optional = true
dependencies = { pydantic = "^1.10.4" }

#97 is the open issue for v2.

@rakesh-163
Copy link
Author

In that case, this seems redundant. Thanks.

@cretz cretz closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants