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 @@ -1182,6 +1182,9 @@ def is_valid_type(input_class_simple, valid_classes):
Returns:
bool
"""
if issubclass(input_class_simple, OpenApiModel) and \
valid_classes == (bool, date, datetime, dict, float, int, list, str, none_type,):
return True
valid_type = input_class_simple in valid_classes
if not valid_type and (
issubclass(input_class_simple, OpenApiModel) or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1643,13 +1643,28 @@ components:
properties:
breed:
type: string
legs:
$ref: '#/components/schemas/Legs'
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
declawed:
type: boolean
Legs:
type: object
required:
- legs
properties:
legs:
enum:
- '2'
- '4'
default: '4'
x-enum-as-string: true
name:
type: string
Address:
type: object
additionalProperties:
Expand Down
3 changes: 3 additions & 0 deletions samples/client/petstore/python/petstore_api/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,9 @@ def is_valid_type(input_class_simple, valid_classes):
Returns:
bool
"""
if issubclass(input_class_simple, OpenApiModel) and \
valid_classes == (bool, date, datetime, dict, float, int, list, str, none_type,):
return True
valid_type = input_class_simple in valid_classes
if not valid_type and (
issubclass(input_class_simple, OpenApiModel) or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,9 @@ def is_valid_type(input_class_simple, valid_classes):
Returns:
bool
"""
if issubclass(input_class_simple, OpenApiModel) and \
valid_classes == (bool, date, datetime, dict, float, int, list, str, none_type,):
return True
valid_type = input_class_simple in valid_classes
if not valid_type and (
issubclass(input_class_simple, OpenApiModel) or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,9 @@ def is_valid_type(input_class_simple, valid_classes):
Returns:
bool
"""
if issubclass(input_class_simple, OpenApiModel) and \
valid_classes == (bool, date, datetime, dict, float, int, list, str, none_type,):
return True
valid_type = input_class_simple in valid_classes
if not valid_type and (
issubclass(input_class_simple, OpenApiModel) or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,9 @@ def is_valid_type(input_class_simple, valid_classes):
Returns:
bool
"""
if issubclass(input_class_simple, OpenApiModel) and \
valid_classes == (bool, date, datetime, dict, float, int, list, str, none_type,):
return True
valid_type = input_class_simple in valid_classes
if not valid_type and (
issubclass(input_class_simple, OpenApiModel) or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ docs/IntegerEnum.md
docs/IntegerEnumOneValue.md
docs/IntegerEnumWithDefaultValue.md
docs/IsoscelesTriangle.md
docs/Legs.md
docs/List.md
docs/Mammal.md
docs/MapTest.md
Expand Down Expand Up @@ -170,6 +171,7 @@ petstore_api/model/integer_enum.py
petstore_api/model/integer_enum_one_value.py
petstore_api/model/integer_enum_with_default_value.py
petstore_api/model/isosceles_triangle.py
petstore_api/model/legs.py
petstore_api/model/list.py
petstore_api/model/mammal.py
petstore_api/model/map_test.py
Expand Down
1 change: 1 addition & 0 deletions samples/openapi3/client/petstore/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Class | Method | HTTP request | Description
- [IntegerEnumOneValue](docs/IntegerEnumOneValue.md)
- [IntegerEnumWithDefaultValue](docs/IntegerEnumWithDefaultValue.md)
- [IsoscelesTriangle](docs/IsoscelesTriangle.md)
- [Legs](docs/Legs.md)
- [List](docs/List.md)
- [Mammal](docs/Mammal.md)
- [MapTest](docs/MapTest.md)
Expand Down
1 change: 1 addition & 0 deletions samples/openapi3/client/petstore/python/docs/Dog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**breed** | **str** | | [optional]
**legs** | [**Legs**](Legs.md) | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**tail** | **bool** | | [optional] [readonly] if omitted the server will use the default value of True
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
Expand Down
1 change: 1 addition & 0 deletions samples/openapi3/client/petstore/python/docs/DogAllOf.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **str** | | [optional]
**legs** | [**Legs**](Legs.md) | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
13 changes: 13 additions & 0 deletions samples/openapi3/client/petstore/python/docs/Legs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Legs


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**legs** | **str** | | defaults to "4"
**name** | **str** | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[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 @@ -32,8 +32,10 @@
def lazy_import():
from petstore_api.model.animal import Animal
from petstore_api.model.dog_all_of import DogAllOf
from petstore_api.model.legs import Legs
globals()['Animal'] = Animal
globals()['DogAllOf'] = DogAllOf
globals()['Legs'] = Legs


class Dog(ModelComposed):
Expand Down Expand Up @@ -91,6 +93,7 @@ def openapi_types():
return {
'class_name': (str,), # noqa: E501
'breed': (str,), # noqa: E501
'legs': (Legs,), # noqa: E501
'color': (str,), # noqa: E501
'tail': (bool,), # noqa: E501
}
Expand All @@ -106,6 +109,7 @@ def discriminator():
attribute_map = {
'class_name': 'className', # noqa: E501
'breed': 'breed', # noqa: E501
'legs': 'legs', # noqa: E501
'color': 'color', # noqa: E501
'tail': 'tail', # noqa: E501
}
Expand Down Expand Up @@ -152,6 +156,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
Expand Down Expand Up @@ -255,6 +260,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
from petstore_api.exceptions import ApiAttributeError


def lazy_import():
from petstore_api.model.legs import Legs
globals()['Legs'] = Legs


class DogAllOf(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Expand Down Expand Up @@ -66,6 +70,7 @@ def additional_properties_type():
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501

_nullable = False
Expand All @@ -80,8 +85,10 @@ def openapi_types():
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy_import()
return {
'breed': (str,), # noqa: E501
'legs': (Legs,), # noqa: E501
}

@cached_property
Expand All @@ -91,6 +98,7 @@ def discriminator():

attribute_map = {
'breed': 'breed', # noqa: E501
'legs': 'legs', # noqa: E501
}

read_only_vars = {
Expand Down Expand Up @@ -135,6 +143,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
"""

_check_type = kwargs.pop('_check_type', True)
Expand Down Expand Up @@ -217,6 +226,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
"""

_check_type = kwargs.pop('_check_type', True)
Expand Down
Loading