Skip to content
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

fix(spm): correctly parse pydantic model results #113

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

nfrasser
Copy link
Member

Use model_validate(data) instead of __init__(**data) when parsing JSON from the API to ensure that special model validators which return a different type have their results interpreted correctly by pydantic. This affects event models.

Use model_validate instead of __init__ when parsing JSON from the API to ensure that special model validators which use a different type have their results intepreted correctly by pydantic
@nfrasser nfrasser requested a review from Puratinamu December 27, 2024 21:55
@nfrasser nfrasser self-assigned this Dec 27, 2024
Copy link

vercel bot commented Dec 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cryosparc-tools ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 27, 2024 9:55pm

@nfrasser nfrasser merged commit d44fbed into spm Dec 30, 2024
11 checks passed
@nfrasser nfrasser deleted the nick/spm/api-model-validate branch December 30, 2024 15:16
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.

2 participants