Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2246,3 +2246,30 @@ components:
description: Property
type: boolean
default: false
Creature:
type: object
required:
- info
- type
properties:
info:
$ref: "#/components/schemas/CreatureInfo"
type:
type: string
discriminator:
propertyName: type
CreatureInfo:
type: object
required:
- name
properties:
name:
type: string
Tiger:
allOf:
- $ref: "#/components/schemas/Tiger"
- type: object
properties:
skill:
type: string

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ docs/CircularReferenceModel.md
docs/ClassModel.md
docs/Client.md
docs/Color.md
docs/Creature.md
docs/CreatureInfo.md
docs/DanishPig.md
docs/DefaultApi.md
docs/DeprecatedObject.md
Expand Down Expand Up @@ -79,6 +81,7 @@ docs/SpecialModelName.md
docs/SpecialName.md
docs/StoreApi.md
docs/Tag.md
docs/Tiger.md
docs/User.md
docs/UserApi.md
docs/WithNestedOneOf.md
Expand Down Expand Up @@ -115,6 +118,8 @@ petstore_api/models/circular_reference_model.py
petstore_api/models/class_model.py
petstore_api/models/client.py
petstore_api/models/color.py
petstore_api/models/creature.py
petstore_api/models/creature_info.py
petstore_api/models/danish_pig.py
petstore_api/models/deprecated_object.py
petstore_api/models/dog.py
Expand Down Expand Up @@ -167,6 +172,7 @@ petstore_api/models/special_character_enum.py
petstore_api/models/special_model_name.py
petstore_api/models/special_name.py
petstore_api/models/tag.py
petstore_api/models/tiger.py
petstore_api/models/user.py
petstore_api/models/with_nested_one_of.py
petstore_api/py.typed
Expand Down
3 changes: 3 additions & 0 deletions samples/openapi3/client/petstore/python-aiohttp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ Class | Method | HTTP request | Description
- [ClassModel](docs/ClassModel.md)
- [Client](docs/Client.md)
- [Color](docs/Color.md)
- [Creature](docs/Creature.md)
- [CreatureInfo](docs/CreatureInfo.md)
- [DanishPig](docs/DanishPig.md)
- [DeprecatedObject](docs/DeprecatedObject.md)
- [Dog](docs/Dog.md)
Expand Down Expand Up @@ -202,6 +204,7 @@ Class | Method | HTTP request | Description
- [SpecialModelName](docs/SpecialModelName.md)
- [SpecialName](docs/SpecialName.md)
- [Tag](docs/Tag.md)
- [Tiger](docs/Tiger.md)
- [User](docs/User.md)
- [WithNestedOneOf](docs/WithNestedOneOf.md)

Expand Down
29 changes: 29 additions & 0 deletions samples/openapi3/client/petstore/python-aiohttp/docs/Creature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Creature


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**info** | [**CreatureInfo**](CreatureInfo.md) | |
**type** | **str** | |

## Example

```python
from petstore_api.models.creature import Creature

# TODO update the JSON string below
json = "{}"
# create an instance of Creature from a JSON string
creature_instance = Creature.from_json(json)
# print the JSON string representation of the object
print Creature.to_json()

# convert the object into a dict
creature_dict = creature_instance.to_dict()
# create an instance of Creature from a dict
creature_form_dict = creature.from_dict(creature_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)


Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# CreatureInfo


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | |

## Example

```python
from petstore_api.models.creature_info import CreatureInfo

# TODO update the JSON string below
json = "{}"
# create an instance of CreatureInfo from a JSON string
creature_info_instance = CreatureInfo.from_json(json)
# print the JSON string representation of the object
print CreatureInfo.to_json()

# convert the object into a dict
creature_info_dict = creature_info_instance.to_dict()
# create an instance of CreatureInfo from a dict
creature_info_form_dict = creature_info.from_dict(creature_info_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)


28 changes: 28 additions & 0 deletions samples/openapi3/client/petstore/python-aiohttp/docs/Tiger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Tiger


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**skill** | **str** | | [optional]

## Example

```python
from petstore_api.models.tiger import Tiger

# TODO update the JSON string below
json = "{}"
# create an instance of Tiger from a JSON string
tiger_instance = Tiger.from_json(json)
# print the JSON string representation of the object
print Tiger.to_json()

# convert the object into a dict
tiger_dict = tiger_instance.to_dict()
# create an instance of Tiger from a dict
tiger_form_dict = tiger.from_dict(tiger_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)


Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
from petstore_api.models.class_model import ClassModel
from petstore_api.models.client import Client
from petstore_api.models.color import Color
from petstore_api.models.creature import Creature
from petstore_api.models.creature_info import CreatureInfo
from petstore_api.models.danish_pig import DanishPig
from petstore_api.models.deprecated_object import DeprecatedObject
from petstore_api.models.dog import Dog
Expand Down Expand Up @@ -108,5 +110,6 @@
from petstore_api.models.special_model_name import SpecialModelName
from petstore_api.models.special_name import SpecialName
from petstore_api.models.tag import Tag
from petstore_api.models.tiger import Tiger
from petstore_api.models.user import User
from petstore_api.models.with_nested_one_of import WithNestedOneOf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
from petstore_api.models.class_model import ClassModel
from petstore_api.models.client import Client
from petstore_api.models.color import Color
from petstore_api.models.creature import Creature
from petstore_api.models.creature_info import CreatureInfo
from petstore_api.models.danish_pig import DanishPig
from petstore_api.models.deprecated_object import DeprecatedObject
from petstore_api.models.dog import Dog
Expand Down Expand Up @@ -84,5 +86,6 @@
from petstore_api.models.special_model_name import SpecialModelName
from petstore_api.models.special_name import SpecialName
from petstore_api.models.tag import Tag
from petstore_api.models.tiger import Tiger
from petstore_api.models.user import User
from petstore_api.models.with_nested_one_of import WithNestedOneOf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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: \" \\ # noqa: E501

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re # noqa: F401
import json



from pydantic import BaseModel, Field, StrictStr
from petstore_api.models.creature_info import CreatureInfo

class Creature(BaseModel):
"""
Creature
"""
info: CreatureInfo = Field(...)
type: StrictStr = Field(...)
__properties = ["info", "type"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> Creature:
"""Create an instance of Creature from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
},
exclude_none=True)
# override the default output from pydantic by calling `to_dict()` of info
if self.info:
_dict['info'] = self.info.to_dict()
return _dict

@classmethod
def from_dict(cls, obj: dict) -> Creature:
"""Create an instance of Creature from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return Creature.parse_obj(obj)

_obj = Creature.parse_obj({
"info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None,
"type": obj.get("type")
})
return _obj


Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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: \" \\ # noqa: E501

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re # noqa: F401
import json



from pydantic import BaseModel, Field, StrictStr

class CreatureInfo(BaseModel):
"""
CreatureInfo
"""
name: StrictStr = Field(...)
__properties = ["name"]

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> CreatureInfo:
"""Create an instance of CreatureInfo from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
},
exclude_none=True)
return _dict

@classmethod
def from_dict(cls, obj: dict) -> CreatureInfo:
"""Create an instance of CreatureInfo from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return CreatureInfo.parse_obj(obj)

_obj = CreatureInfo.parse_obj({
"name": obj.get("name")
})
return _obj


Loading