-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f84ea7
commit 6a0c998
Showing
41 changed files
with
1,518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
samples/openapi3/client/petstore/python-aiohttp/docs/InputAllOf.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# InputAllOf | ||
|
||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**some_data** | [**Dict[str, Tag]**](Tag.md) | | [optional] | ||
|
||
## Example | ||
|
||
```python | ||
from petstore_api.models.input_all_of import InputAllOf | ||
|
||
# TODO update the JSON string below | ||
json = "{}" | ||
# create an instance of InputAllOf from a JSON string | ||
input_all_of_instance = InputAllOf.from_json(json) | ||
# print the JSON string representation of the object | ||
print InputAllOf.to_json() | ||
|
||
# convert the object into a dict | ||
input_all_of_dict = input_all_of_instance.to_dict() | ||
# create an instance of InputAllOf from a dict | ||
input_all_of_form_dict = input_all_of.from_dict(input_all_of_dict) | ||
``` | ||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
29 changes: 29 additions & 0 deletions
29
samples/openapi3/client/petstore/python-aiohttp/docs/PropertyMap.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# PropertyMap | ||
|
||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**some_data** | [**Dict[str, Tag]**](Tag.md) | | [optional] | ||
|
||
## Example | ||
|
||
```python | ||
from petstore_api.models.property_map import PropertyMap | ||
|
||
# TODO update the JSON string below | ||
json = "{}" | ||
# create an instance of PropertyMap from a JSON string | ||
property_map_instance = PropertyMap.from_json(json) | ||
# print the JSON string representation of the object | ||
print PropertyMap.to_json() | ||
|
||
# convert the object into a dict | ||
property_map_dict = property_map_instance.to_dict() | ||
# create an instance of PropertyMap from a dict | ||
property_map_form_dict = property_map.from_dict(property_map_dict) | ||
``` | ||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/input_all_of.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
OpenAPI Petstore | ||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
The version of the OpenAPI document: 1.0.0 | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
Do not edit the class manually. | ||
""" # noqa: E501 | ||
|
||
|
||
from __future__ import annotations | ||
import pprint | ||
import re # noqa: F401 | ||
import json | ||
|
||
from pydantic import BaseModel | ||
from typing import Any, ClassVar, Dict, List, Optional | ||
from petstore_api.models.tag import Tag | ||
from typing import Optional, Set | ||
from typing_extensions import Self | ||
|
||
class InputAllOf(BaseModel): | ||
""" | ||
InputAllOf | ||
""" # noqa: E501 | ||
some_data: Optional[Dict[str, Tag]] = None | ||
__properties: ClassVar[List[str]] = ["some_data"] | ||
|
||
model_config = { | ||
"populate_by_name": True, | ||
"validate_assignment": True, | ||
"protected_namespaces": (), | ||
} | ||
|
||
|
||
def to_str(self) -> str: | ||
"""Returns the string representation of the model using alias""" | ||
return pprint.pformat(self.model_dump(by_alias=True)) | ||
|
||
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()) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of InputAllOf from a JSON string""" | ||
return cls.from_dict(json.loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias. | ||
This has the following differences from calling pydantic's | ||
`self.model_dump(by_alias=True)`: | ||
* `None` is only added to the output dict for nullable fields that | ||
were set at model initialization. Other fields with value `None` | ||
are ignored. | ||
""" | ||
excluded_fields: Set[str] = set([ | ||
]) | ||
|
||
_dict = self.model_dump( | ||
by_alias=True, | ||
exclude=excluded_fields, | ||
exclude_none=True, | ||
) | ||
# override the default output from pydantic by calling `to_dict()` of each value in some_data (dict) | ||
_field_dict = {} | ||
if self.some_data: | ||
for _key in self.some_data: | ||
if self.some_data[_key]: | ||
_field_dict[_key] = self.some_data[_key].to_dict() | ||
_dict['some_data'] = _field_dict | ||
return _dict | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of InputAllOf from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
_obj = cls.model_validate({ | ||
"some_data": dict( | ||
(_k, Tag.from_dict(_v)) | ||
for _k, _v in obj["some_data"].items() | ||
) | ||
if obj.get("some_data") is not None | ||
else None | ||
}) | ||
return _obj | ||
|
||
|
100 changes: 100 additions & 0 deletions
100
samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_map.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
OpenAPI Petstore | ||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
The version of the OpenAPI document: 1.0.0 | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
Do not edit the class manually. | ||
""" # noqa: E501 | ||
|
||
|
||
from __future__ import annotations | ||
import pprint | ||
import re # noqa: F401 | ||
import json | ||
|
||
from pydantic import BaseModel | ||
from typing import Any, ClassVar, Dict, List, Optional | ||
from petstore_api.models.tag import Tag | ||
from typing import Optional, Set | ||
from typing_extensions import Self | ||
|
||
class PropertyMap(BaseModel): | ||
""" | ||
PropertyMap | ||
""" # noqa: E501 | ||
some_data: Optional[Dict[str, Tag]] = None | ||
__properties: ClassVar[List[str]] = ["some_data"] | ||
|
||
model_config = { | ||
"populate_by_name": True, | ||
"validate_assignment": True, | ||
"protected_namespaces": (), | ||
} | ||
|
||
|
||
def to_str(self) -> str: | ||
"""Returns the string representation of the model using alias""" | ||
return pprint.pformat(self.model_dump(by_alias=True)) | ||
|
||
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()) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of PropertyMap from a JSON string""" | ||
return cls.from_dict(json.loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias. | ||
This has the following differences from calling pydantic's | ||
`self.model_dump(by_alias=True)`: | ||
* `None` is only added to the output dict for nullable fields that | ||
were set at model initialization. Other fields with value `None` | ||
are ignored. | ||
""" | ||
excluded_fields: Set[str] = set([ | ||
]) | ||
|
||
_dict = self.model_dump( | ||
by_alias=True, | ||
exclude=excluded_fields, | ||
exclude_none=True, | ||
) | ||
# override the default output from pydantic by calling `to_dict()` of each value in some_data (dict) | ||
_field_dict = {} | ||
if self.some_data: | ||
for _key in self.some_data: | ||
if self.some_data[_key]: | ||
_field_dict[_key] = self.some_data[_key].to_dict() | ||
_dict['some_data'] = _field_dict | ||
return _dict | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of PropertyMap from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
_obj = cls.model_validate({ | ||
"some_data": dict( | ||
(_k, Tag.from_dict(_v)) | ||
for _k, _v in obj["some_data"].items() | ||
) | ||
if obj.get("some_data") is not None | ||
else None | ||
}) | ||
return _obj | ||
|
||
|
Oops, something went wrong.