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: fix incorrect use of model_validate_json #1260

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

dbirman
Copy link
Member

@dbirman dbirman commented Feb 4, 2025

This PR fixes a bug where dictionaries were being passed to model_validate_json (which accepts a string) instead of model_validate.

Because some of the core files have model validators that run in "after" mode and depend on the model being an object and not a dictionary, this bug was causing attempts to validate a (valid) file using Metadata.model_validate() to fail. Using the core file directly, i.e. Rig.model_validate() always worked.

The bug was causing user warnings which no longer exist, so I had to remove some test assertions, I checked w/ Helen that these aren't important.

I also added two print statements so that these kinds of errors can be caught by users/developers. It was very confusing to debug this because the errors were being hidden.

@dbirman dbirman requested a review from jtyoung84 February 4, 2025 22:54
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.

validate_core_fields broken, should use model_validate not model_validate_json
2 participants