From b04c768046c2641890fbce9077639b74f38dbd05 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:11:15 +0000 Subject: [PATCH 1/2] refactor: update to_json across all Pydantic models to use Pydantic v2's model_dump_json Co-authored-by: MingfengHong <76680753+MingfengHong@users.noreply.github.com> --- paperseek_core/client/models.py | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/paperseek_core/client/models.py b/paperseek_core/client/models.py index fea871d..bd142c1 100644 --- a/paperseek_core/client/models.py +++ b/paperseek_core/client/models.py @@ -29,8 +29,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -95,8 +94,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -164,8 +162,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -232,8 +229,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -298,8 +294,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -376,8 +371,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -545,8 +539,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -619,8 +612,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -695,8 +687,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -761,8 +752,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: @@ -844,8 +834,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return self.model_dump_json(by_alias=True, exclude_unset=True) @classmethod def from_json(cls, json_str: str) -> Self: From d62be90ab3577e4014d98129bd9132bcfcc3f678 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 10:09:47 +0000 Subject: [PATCH 2/2] refactor: update to_json across all Pydantic models to use Pydantic v2's model_dump_json Co-authored-by: MingfengHong <76680753+MingfengHong@users.noreply.github.com>