Skip to content

Support dataclasses as typehints#336

Merged
piercefreeman merged 4 commits intomainfrom
feature/support-dataclasses
Apr 10, 2026
Merged

Support dataclasses as typehints#336
piercefreeman merged 4 commits intomainfrom
feature/support-dataclasses

Conversation

@piercefreeman
Copy link
Copy Markdown
Owner

@piercefreeman piercefreeman commented Apr 10, 2026

We previously only supported Pydantic BaseModels for type coercion into objects. This presented some unexpected runtime behavior where we would typehint our actions with dataclasses, but values would actually be passed through as dictionaries.

We refactor our typing helpers into a more global entrypoint instantiate_typed_model that will handle all the type coercion of different wrapper objects (now basemodels, dataclasses, and fallback to generic classes) and the individual key values. We use the annotations as the ground truth for what they should be.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Coverage Report

Python Coverage

Metric Coverage
Lines 72.0%
Branches 58.0%

Download HTML Report

Rust Coverage

Metric Coverage
Lines 66.0%
Branches N/A

Download HTML Report

Compared to main branch

@piercefreeman piercefreeman merged commit 343c24e into main Apr 10, 2026
15 checks passed
@piercefreeman piercefreeman deleted the feature/support-dataclasses branch April 10, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant