Skip to content

Commit 245f4b3

Browse files
committed
refactor: update to_json methods to use model_dump_json for JSON serialization
refactor: update to_json methods to use model_dump_json for JSON serialization
1 parent bf18aeb commit 245f4b3

File tree

25 files changed

+24
-86
lines changed

25 files changed

+24
-86
lines changed

libs/admin-api-lib/src/admin_api_lib/extractor_api_client/openapi_client/models/confluence_parameters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ def to_str(self) -> str:
6565

6666
def to_json(self) -> str:
6767
"""Returns the JSON representation of the model using alias"""
68-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69-
return json.dumps(self.to_dict())
68+
return self.model_dump_json(by_alias=True, exclude_unset=True)
7069

7170
@classmethod
7271
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/extractor_api_client/openapi_client/models/extraction_request.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def to_str(self) -> str:
4141

4242
def to_json(self) -> str:
4343
"""Returns the JSON representation of the model using alias"""
44-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
45-
return json.dumps(self.to_dict())
44+
return self.model_dump_json(by_alias=True, exclude_unset=True)
4645

4746
@classmethod
4847
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/extractor_api_client/openapi_client/models/information_piece.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def to_str(self) -> str:
5252

5353
def to_json(self) -> str:
5454
"""Returns the JSON representation of the model using alias"""
55-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56-
return json.dumps(self.to_dict())
55+
return self.model_dump_json(by_alias=True, exclude_unset=True)
5756

5857
@classmethod
5958
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/extractor_api_client/openapi_client/models/key_value_pair.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def to_str(self) -> str:
4242

4343
def to_json(self) -> str:
4444
"""Returns the JSON representation of the model using alias"""
45-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46-
return json.dumps(self.to_dict())
45+
return self.model_dump_json(by_alias=True, exclude_unset=True)
4746

4847
@classmethod
4948
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/models/document_status.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def to_str(self) -> str:
4848

4949
def to_json(self) -> str:
5050
"""Returns the JSON representation of the model using alias"""
51-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52-
return json.dumps(self.to_dict())
51+
return self.model_dump_json(by_alias=True, exclude_unset=True)
5352

5453
@classmethod
5554
def from_json(cls, json_str: str) -> Self:

libs/admin-api-lib/src/admin_api_lib/rag_backend_client/openapi_client/models/chat_history.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def to_str(self) -> str:
4545

4646
def to_json(self) -> str:
4747
"""Returns the JSON representation of the model using alias"""
48-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49-
return json.dumps(self.to_dict())
48+
return self.model_dump_json(by_alias=True, exclude_unset=True)
5049

5150
@classmethod
5251
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/rag_backend_client/openapi_client/models/chat_history_message.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def to_str(self) -> str:
4444

4545
def to_json(self) -> str:
4646
"""Returns the JSON representation of the model using alias"""
47-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48-
return json.dumps(self.to_dict())
47+
return self.model_dump_json(by_alias=True, exclude_unset=True)
4948

5049
@classmethod
5150
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/rag_backend_client/openapi_client/models/chat_request.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def to_str(self) -> str:
4646

4747
def to_json(self) -> str:
4848
"""Returns the JSON representation of the model using alias"""
49-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50-
return json.dumps(self.to_dict())
49+
return self.model_dump_json(by_alias=True, exclude_unset=True)
5150

5251
@classmethod
5352
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/rag_backend_client/openapi_client/models/chat_response.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def to_str(self) -> str:
4747

4848
def to_json(self) -> str:
4949
"""Returns the JSON representation of the model using alias"""
50-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51-
return json.dumps(self.to_dict())
50+
return self.model_dump_json(by_alias=True, exclude_unset=True)
5251

5352
@classmethod
5453
def from_json(cls, json_str: str) -> Optional[Self]:

libs/admin-api-lib/src/admin_api_lib/rag_backend_client/openapi_client/models/delete_request.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def to_str(self) -> str:
4545

4646
def to_json(self) -> str:
4747
"""Returns the JSON representation of the model using alias"""
48-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49-
return json.dumps(self.to_dict())
48+
return self.model_dump_json(by_alias=True, exclude_unset=True)
5049

5150
@classmethod
5251
def from_json(cls, json_str: str) -> Optional[Self]:

0 commit comments

Comments
 (0)