Skip to content

Use DefaultSerde in more places #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 25, 2025

Conversation

igalshilman
Copy link
Contributor

@igalshilman igalshilman commented Mar 25, 2025

This PR adds more places to use the DefaultSerde and in addtion adds an optional type_hint argument in various ctx methods, that allows to use a more specific serializer.
For now we only support Pydantic and plain python objects via json.dumps/loads

class State(BaseModel):
   foo ...
   bar ...

res = await ctx.get("state", type_hint=State)

print(res.foo)

@igalshilman igalshilman merged commit d006698 into restatedev:main Mar 25, 2025
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant