File tree Expand file tree Collapse file tree
samples/openapi3/client/petstore
python-aiohttp/petstore_api/models
python-httpx/petstore_api/models
python-lazyImports/petstore_api/models
python/petstore_api/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222from petstore_api .models .tag import Tag
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class ArrayOfMapModel (BaseModel ):
2728 """
@@ -44,8 +45,7 @@ def to_str(self) -> str:
4445
4546 def to_json (self ) -> str :
4647 """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 ())
48+ return json .dumps (to_jsonable_python (self .to_dict ()))
4949
5050 @classmethod
5151 def from_json (cls , json_str : str ) -> Optional [Self ]:
Original file line number Diff line number Diff line change 2222from uuid import UUID
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class UuidWithPattern (BaseModel ):
2728 """
@@ -54,8 +55,7 @@ def to_str(self) -> str:
5455
5556 def to_json (self ) -> str :
5657 """Returns the JSON representation of the model using alias"""
57- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58- return json .dumps (self .to_dict ())
58+ return json .dumps (to_jsonable_python (self .to_dict ()))
5959
6060 @classmethod
6161 def from_json (cls , json_str : str ) -> Optional [Self ]:
Original file line number Diff line number Diff line change 2222from petstore_api .models .tag import Tag
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class ArrayOfMapModel (BaseModel ):
2728 """
@@ -44,8 +45,7 @@ def to_str(self) -> str:
4445
4546 def to_json (self ) -> str :
4647 """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 ())
48+ return json .dumps (to_jsonable_python (self .to_dict ()))
4949
5050 @classmethod
5151 def from_json (cls , json_str : str ) -> Optional [Self ]:
Original file line number Diff line number Diff line change 2222from uuid import UUID
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class UuidWithPattern (BaseModel ):
2728 """
@@ -54,8 +55,7 @@ def to_str(self) -> str:
5455
5556 def to_json (self ) -> str :
5657 """Returns the JSON representation of the model using alias"""
57- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58- return json .dumps (self .to_dict ())
58+ return json .dumps (to_jsonable_python (self .to_dict ()))
5959
6060 @classmethod
6161 def from_json (cls , json_str : str ) -> Optional [Self ]:
Original file line number Diff line number Diff line change 2222from petstore_api .models .tag import Tag
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class ArrayOfMapModel (BaseModel ):
2728 """
@@ -45,8 +46,7 @@ def to_str(self) -> str:
4546
4647 def to_json (self ) -> str :
4748 """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 ())
49+ return json .dumps (to_jsonable_python (self .to_dict ()))
5050
5151 @classmethod
5252 def from_json (cls , json_str : str ) -> Optional [Self ]:
Original file line number Diff line number Diff line change 2222from uuid import UUID
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class UuidWithPattern (BaseModel ):
2728 """
@@ -55,8 +56,7 @@ def to_str(self) -> str:
5556
5657 def to_json (self ) -> str :
5758 """Returns the JSON representation of the model using alias"""
58- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59- return json .dumps (self .to_dict ())
59+ return json .dumps (to_jsonable_python (self .to_dict ()))
6060
6161 @classmethod
6262 def from_json (cls , json_str : str ) -> Optional [Self ]:
Original file line number Diff line number Diff line change 2222from petstore_api .models .tag import Tag
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class ArrayOfMapModel (BaseModel ):
2728 """
@@ -45,8 +46,7 @@ def to_str(self) -> str:
4546
4647 def to_json (self ) -> str :
4748 """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 ())
49+ return json .dumps (to_jsonable_python (self .to_dict ()))
5050
5151 @classmethod
5252 def from_json (cls , json_str : str ) -> Optional [Self ]:
Original file line number Diff line number Diff line change 2222from uuid import UUID
2323from typing import Optional , Set
2424from typing_extensions import Self
25+ from pydantic_core import to_jsonable_python
2526
2627class UuidWithPattern (BaseModel ):
2728 """
@@ -55,8 +56,7 @@ def to_str(self) -> str:
5556
5657 def to_json (self ) -> str :
5758 """Returns the JSON representation of the model using alias"""
58- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59- return json .dumps (self .to_dict ())
59+ return json .dumps (to_jsonable_python (self .to_dict ()))
6060
6161 @classmethod
6262 def from_json (cls , json_str : str ) -> Optional [Self ]:
You can’t perform that action at this time.
0 commit comments