Skip to content

Data validation support for job arguments #53

Description

@jidey43

Hello,

I'm working with @PaulM5406 and we’ve been using Chancy in production for a few weeks, it has been working quite well so far.
The only problem we ran into was that on one job the arguments passed via Job.with_kwargs() turned out to be incompatible with the target job’s expected types — in our case, a simple programming error.

We attempted to prevent this kind of issue with a mypy-based solution, but without success.

To improve type safety and reliability, I’d like to propose adding Pydantic support for Chancy task scheduling.
The idea would be to encapsulate job arguments in a validated Pydantic model, have them automatically serialized/deserialized, and then passed to the coroutine bound to the job.

What are your thoughts on this approach? Would you be open to a PR implementing it?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions