Skip to content

[Feature Request] Create official Pydantic contrib module #621

Closed
@cretz

Description

@cretz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions