Closed
Description
Describe the solution you'd like
Pydantic is popular/common enough and people are struggling with https://github.com/temporalio/samples-python/tree/main/pydantic_converter enough (or just that we haven't shown V2 yet: temporalio/samples-python#97), that we should just make a temporalio.contrib.pydantic
module as a pydantic
extra similar to what we have done with opentelemetry
.
It should contain:
- A JSON encoding payload converter that works with Pydantic models to/from JSON
- A default payload converter that puts Pydantic converter just above the default JSON encoding payload converter in the list
- A default data converter using that default payload converter
- Some way to solve the datetime issue mentioned in the sample's README (maybe just a built-in Pydantic-safe worker runner that customizes the sandbox for them if there's no better way)
- We might also want the converter to warn if it can when it sees a Pydantic datetime and the fix is not enabled in the sandbox and there's no better way to fix the issue