Skip to content

Commit

Permalink
try model_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Nov 25, 2024
1 parent c16c1eb commit d526bc6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions mp_api/client/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,14 +1071,16 @@ def _generate_returned_model(self, doc):
__base__=self.document_model, # type: ignore
)

data_model.model_fields = {
**{
name: description
for name, description in data_model.model_fields.items()
if name in set_fields
},
"fields_not_requested": data_model.model_fields["fields_not_requested"],
}
data_model = data_model.model_copy(
update={
**{
name: description
for name, description in data_model.model_fields.items()
if name in set_fields
},
"fields_not_requested": data_model.model_fields["fields_not_requested"],
}
)

def new_repr(self) -> str:
extra = ",\n".join(
Expand Down

0 comments on commit d526bc6

Please sign in to comment.