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 pydantic deserialization issues with root obj #854

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions mp_api/client/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def _submit_request_and_process(
data_model(
**{
field: value
for field, value in raw_doc.model_dump().items()
for field, value in dict(raw_doc).items()
if field in set_fields
}
)
Expand Down Expand Up @@ -876,9 +876,8 @@ def _submit_request_and_process(
)

def _generate_returned_model(self, doc):
set_fields = [
field for field, _ in doc if field in doc.model_dump(exclude_unset=True)
]
set_fields = doc.model_fields_set

unset_fields = [field for field in doc.model_fields if field not in set_fields]

data_model = create_model(
Expand Down