Skip to content

Avoid double-serialization roundtrip when passing Pydantic Request objects across FFI boundary #11

@janbuchar

Description

@janbuchar

The Python RQ wrapper converts Request objects to dicts via json.loads(request.model_dump_json()) — serializing to a JSON string and immediately parsing it back — because model_dump() can produce non-JSON-primitive types (datetimes, enums) that the PyO3 py_to_value helper can't handle. Either py_to_value could be taught to handle datetime objects and enum-like types, or the Rust side could accept a raw JSON string for request operations, letting Python pass model_dump_json() directly without the re-parse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions