Python exp sample component renaming + additions (#6917)

* Stops converting primitive models into object models, adds ComposedSchemas with mixed type

* Reverts java and mustache changes

* Reverts mroe files

* Samples regen

* Fixes remaining tests
This commit is contained in:
Justin Black
2020-07-13 10:22:03 -07:00
committed by GitHub
parent 29183e0280
commit dad931a25a
60 changed files with 2976 additions and 1606 deletions

View File

@@ -843,91 +843,108 @@ paths:
responses:
'400':
description: Someting wrong
/fake/outer/number:
/fake/refs/number:
post:
tags:
- fake
description: Test serialization of outer number types
operationId: fakeOuterNumberSerialize
operationId: NumberWithValidations
parameters:
- name: body
in: body
description: Input number as post body
schema:
$ref: '#/definitions/OuterNumber'
$ref: '#/definitions/NumberWithValidations'
responses:
'200':
description: Output number
schema:
$ref: '#/definitions/OuterNumber'
/fake/outer/string:
$ref: '#/definitions/NumberWithValidations'
/fake/refs/string:
post:
tags:
- fake
description: Test serialization of outer string types
operationId: fakeOuterStringSerialize
operationId: String
parameters:
- name: body
in: body
description: Input string as post body
schema:
$ref: '#/definitions/OuterString'
$ref: '#/definitions/String'
responses:
'200':
description: Output string
schema:
$ref: '#/definitions/OuterString'
/fake/outer/boolean:
$ref: '#/definitions/String'
/fake/refs/boolean:
post:
tags:
- fake
description: Test serialization of outer boolean types
operationId: fakeOuterBooleanSerialize
operationId: Boolean
parameters:
- name: body
in: body
description: Input boolean as post body
schema:
$ref: '#/definitions/OuterBoolean'
$ref: '#/definitions/Boolean'
responses:
'200':
description: Output boolean
schema:
$ref: '#/definitions/OuterBoolean'
/fake/outer/composite:
$ref: '#/definitions/Boolean'
/fake/refs/arraymodel:
post:
tags:
- fake
description: Test serialization of object with outer number type
operationId: fakeOuterCompositeSerialize
description: Test serialization of ArrayModel
operationId: ArrayModel
parameters:
- name: body
in: body
description: Input composite as post body
description: Input model
schema:
$ref: '#/definitions/OuterComposite'
$ref: '#/definitions/AnimalFarm'
responses:
'200':
description: Output composite
description: Output model
schema:
$ref: '#/definitions/OuterComposite'
/fake/outer/enum:
$ref: '#/definitions/AnimalFarm'
/fake/refs/object_model_with_ref_props:
post:
tags:
- fake
description: Test serialization of object with $refed properties
operationId: ObjectModelWithRefProps
parameters:
- name: body
in: body
description: Input model
schema:
$ref: '#/definitions/ObjectModelWithRefProps'
responses:
'200':
description: Output model
schema:
$ref: '#/definitions/ObjectModelWithRefProps'
/fake/refs/enum:
post:
tags:
- fake
description: Test serialization of outer enum
operationId: fakeOuterEnumSerialize
operationId: StringEnum
parameters:
- name: body
in: body
description: Input enum as post body
description: Input enum
schema:
$ref: '#/definitions/OuterEnum'
$ref: '#/definitions/StringEnum'
responses:
'200':
description: Output enum
schema:
$ref: '#/definitions/OuterEnum'
$ref: '#/definitions/StringEnum'
/fake/jsonFormData:
get:
tags:
@@ -1475,8 +1492,8 @@ definitions:
enum:
- 1.1
- -1.2
outerEnum:
$ref: '#/definitions/OuterEnum'
stringEnum:
$ref: '#/definitions/StringEnum'
AdditionalPropertiesClass:
type: object
properties:
@@ -1743,28 +1760,29 @@ definitions:
# enum:
# - Cat
# - Dog
OuterEnum:
StringEnum:
type: string
enum:
- "placed"
- "approved"
- "delivered"
OuterComposite:
ObjectModelWithRefProps:
description: a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations
type: object
properties:
my_number:
$ref: '#/definitions/OuterNumber'
$ref: '#/definitions/NumberWithValidations'
my_string:
$ref: '#/definitions/OuterString'
$ref: '#/definitions/String'
my_boolean:
$ref: '#/definitions/OuterBoolean'
OuterNumber:
$ref: '#/definitions/Boolean'
NumberWithValidations:
type: number
minimum: 10
maximum: 20
OuterString:
String:
type: string
OuterBoolean:
Boolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
StringBooleanMap:

View File

@@ -822,82 +822,171 @@ paths:
responses:
'400':
description: Someting wrong
/fake/outer/number:
/fake/refs/number:
post:
tags:
- fake
description: Test serialization of outer number types
operationId: fakeOuterNumberSerialize
operationId: NumberWithValidations
requestBody:
description: Input number as post body
content:
application/json:
schema:
$ref: '#/components/schemas/NumberWithValidations'
required: false
responses:
'200':
description: Output number
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterNumber'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OuterNumber'
description: Input number as post body
/fake/outer/string:
$ref: '#/components/schemas/NumberWithValidations'
/fake/refs/string:
post:
tags:
- fake
description: Test serialization of outer string types
operationId: fakeOuterStringSerialize
operationId: String
requestBody:
description: Input string as post body
content:
application/json:
schema:
$ref: '#/components/schemas/String'
required: false
responses:
'200':
description: Output string
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterString'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OuterString'
description: Input string as post body
/fake/outer/boolean:
$ref: '#/components/schemas/String'
x-codegen-request-body-name: body
/fake/refs/boolean:
post:
tags:
- fake
description: Test serialization of outer boolean types
operationId: fakeOuterBooleanSerialize
operationId: Boolean
requestBody:
description: Input boolean as post body
content:
application/json:
schema:
$ref: '#/components/schemas/Boolean'
required: false
responses:
'200':
description: Output boolean
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterBoolean'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OuterBoolean'
description: Input boolean as post body
/fake/outer/composite:
$ref: '#/components/schemas/Boolean'
x-codegen-request-body-name: body
/fake/refs/arraymodel:
post:
tags:
- fake
description: Test serialization of object with outer number type
operationId: fakeOuterCompositeSerialize
responses:
'200':
description: Output composite
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterComposite'
description: Test serialization of ArrayModel
operationId: ArrayModel
requestBody:
description: Input model
content:
application/json:
schema:
$ref: '#/components/schemas/OuterComposite'
description: Input composite as post body
$ref: '#/components/schemas/AnimalFarm'
required: false
responses:
'200':
description: Output model
content:
application/json:
schema:
$ref: '#/components/schemas/AnimalFarm'
x-codegen-request-body-name: body
/fake/refs/object_model_with_ref_props:
post:
tags:
- fake
description: Test serialization of object with $refed properties
operationId: ObjectModelWithRefProps
requestBody:
description: Input model
content:
application/json:
schema:
$ref: '#/components/schemas/ObjectModelWithRefProps'
required: false
responses:
'200':
description: Output model
content:
application/json:
schema:
$ref: '#/components/schemas/ObjectModelWithRefProps'
x-codegen-request-body-name: body
/fake/refs/enum:
post:
tags:
- fake
description: Test serialization of outer enum
operationId: StringEnum
requestBody:
description: Input enum
content:
application/json:
schema:
$ref: '#/components/schemas/StringEnum'
required: false
responses:
'200':
description: Output enum
content:
application/json:
schema:
$ref: '#/components/schemas/StringEnum'
x-codegen-request-body-name: body
/fake/refs/array-of-enums:
post:
tags:
- fake
summary: Array of Enums
operationId: ArrayOfEnums
requestBody:
description: Input enum
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfEnums'
required: false
responses:
200:
description: Got named array of enums
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfEnums'
/fake/additional-properties-with-array-of-enums:
get:
tags:
- fake
summary: Additional Properties with Array of Enums
operationId: AdditionalPropertiesWithArrayOfEnums
requestBody:
description: Input enum
content:
application/json:
schema:
$ref: '#/components/schemas/AdditionalPropertiesWithArrayOfEnums'
required: false
responses:
200:
description: Got object with additional properties with array of enums
content:
application/json:
schema:
$ref: '#/components/schemas/AdditionalPropertiesWithArrayOfEnums'
/fake/jsonFormData:
get:
tags:
@@ -1099,32 +1188,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HealthCheckResult'
/fake/array-of-enums:
get:
tags:
- fake
summary: Array of Enums
operationId: getArrayOfEnums
responses:
200:
description: Got named array of enums
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfEnums'
/fake/additional-properties-with-array-of-enums:
get:
tags:
- fake
summary: Additional Properties with Array of Enums
operationId: getAdditionalPropertiesWithArrayOfEnums
responses:
200:
description: Got object with additional properties with array of enums
content:
application/json:
schema:
$ref: '#/components/schemas/AdditionalPropertiesWithArrayOfEnums'
servers:
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
@@ -1553,14 +1616,16 @@ components:
enum:
- 1.1
- -1.2
outerEnum:
$ref: '#/components/schemas/OuterEnum'
outerEnumInteger:
$ref: '#/components/schemas/OuterEnumInteger'
outerEnumDefaultValue:
$ref: '#/components/schemas/OuterEnumDefaultValue'
outerEnumIntegerDefaultValue:
$ref: '#/components/schemas/OuterEnumIntegerDefaultValue'
stringEnum:
$ref: '#/components/schemas/StringEnum'
IntegerEnum:
$ref: '#/components/schemas/IntegerEnum'
StringEnumWithDefaultValue:
$ref: '#/components/schemas/StringEnumWithDefaultValue'
IntegerEnumWithDefaultValue:
$ref: '#/components/schemas/IntegerEnumWithDefaultValue'
IntegerEnumOneValue:
$ref: '#/components/schemas/IntegerEnumOneValue'
AdditionalPropertiesClass:
type: object
properties:
@@ -1727,47 +1792,56 @@ components:
enum:
- fish
- crab
OuterEnum:
StringEnum:
nullable: true
type: string
enum:
- placed
- approved
- delivered
OuterEnumInteger:
- "placed"
- "approved"
- "delivered"
IntegerEnum:
type: integer
enum:
- 0
- 1
- 2
OuterEnumDefaultValue:
StringEnumWithDefaultValue:
type: string
enum:
- placed
- approved
- delivered
default: placed
OuterEnumIntegerDefaultValue:
IntegerEnumWithDefaultValue:
type: integer
enum:
- 0
- 1
- 2
default: 0
OuterComposite:
IntegerEnumOneValue:
type: integer
enum:
- 0
ObjectModelWithRefProps:
description: a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations
type: object
properties:
my_number:
$ref: '#/components/schemas/OuterNumber'
$ref: '#/definitions/NumberWithValidations'
my_string:
$ref: '#/components/schemas/OuterString'
$ref: '#/definitions/String'
my_boolean:
$ref: '#/components/schemas/OuterBoolean'
OuterNumber:
$ref: '#/definitions/Boolean'
NumberWithValidations:
type: number
OuterString:
minimum: 10
maximum: 20
Number:
type: number
String:
type: string
OuterBoolean:
Boolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
StringBooleanMap:
@@ -2103,7 +2177,7 @@ components:
ArrayOfEnums:
type: array
items:
$ref: '#/components/schemas/OuterEnum'
$ref: '#/components/schemas/StringEnum'
AdditionalPropertiesWithArrayOfEnums:
type: object
additionalProperties:

View File

@@ -51,10 +51,9 @@ docs/Model200Response.md
docs/ModelReturn.md
docs/Name.md
docs/NumberOnly.md
docs/NumberWithValidations.md
docs/ObjectModelWithRefProps.md
docs/Order.md
docs/OuterComposite.md
docs/OuterEnum.md
docs/OuterNumber.md
docs/Parent.md
docs/ParentAllOf.md
docs/ParentPet.md
@@ -65,6 +64,7 @@ docs/ReadOnlyFirst.md
docs/SpecialModelName.md
docs/StoreApi.md
docs/StringBooleanMap.md
docs/StringEnum.md
docs/Tag.md
docs/TypeHolderDefault.md
docs/TypeHolderExample.md
@@ -131,10 +131,9 @@ petstore_api/model/model200_response.py
petstore_api/model/model_return.py
petstore_api/model/name.py
petstore_api/model/number_only.py
petstore_api/model/number_with_validations.py
petstore_api/model/object_model_with_ref_props.py
petstore_api/model/order.py
petstore_api/model/outer_composite.py
petstore_api/model/outer_enum.py
petstore_api/model/outer_number.py
petstore_api/model/parent.py
petstore_api/model/parent_all_of.py
petstore_api/model/parent_pet.py
@@ -143,6 +142,7 @@ petstore_api/model/player.py
petstore_api/model/read_only_first.py
petstore_api/model/special_model_name.py
petstore_api/model/string_boolean_map.py
petstore_api/model/string_enum.py
petstore_api/model/tag.py
petstore_api/model/type_holder_default.py
petstore_api/model/type_holder_example.py

View File

@@ -81,12 +81,13 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*FakeApi* | [**array_model**](docs/FakeApi.md#array_model) | **POST** /fake/refs/arraymodel |
*FakeApi* | [**boolean**](docs/FakeApi.md#boolean) | **POST** /fake/refs/boolean |
*FakeApi* | [**create_xml_item**](docs/FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fake_outer_enum_serialize**](docs/FakeApi.md#fake_outer_enum_serialize) | **POST** /fake/outer/enum |
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*FakeApi* | [**number_with_validations**](docs/FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
*FakeApi* | [**object_model_with_ref_props**](docs/FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
*FakeApi* | [**string**](docs/FakeApi.md#string) | **POST** /fake/refs/string |
*FakeApi* | [**string_enum**](docs/FakeApi.md#string_enum) | **POST** /fake/refs/enum |
*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
@@ -168,10 +169,9 @@ Class | Method | HTTP request | Description
- [model_return.ModelReturn](docs/ModelReturn.md)
- [name.Name](docs/Name.md)
- [number_only.NumberOnly](docs/NumberOnly.md)
- [number_with_validations.NumberWithValidations](docs/NumberWithValidations.md)
- [object_model_with_ref_props.ObjectModelWithRefProps](docs/ObjectModelWithRefProps.md)
- [order.Order](docs/Order.md)
- [outer_composite.OuterComposite](docs/OuterComposite.md)
- [outer_enum.OuterEnum](docs/OuterEnum.md)
- [outer_number.OuterNumber](docs/OuterNumber.md)
- [parent.Parent](docs/Parent.md)
- [parent_all_of.ParentAllOf](docs/ParentAllOf.md)
- [parent_pet.ParentPet](docs/ParentPet.md)
@@ -180,6 +180,7 @@ Class | Method | HTTP request | Description
- [read_only_first.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [special_model_name.SpecialModelName](docs/SpecialModelName.md)
- [string_boolean_map.StringBooleanMap](docs/StringBooleanMap.md)
- [string_enum.StringEnum](docs/StringEnum.md)
- [tag.Tag](docs/Tag.md)
- [type_holder_default.TypeHolderDefault](docs/TypeHolderDefault.md)
- [type_holder_example.TypeHolderExample](docs/TypeHolderExample.md)

View File

@@ -7,7 +7,7 @@ Name | Type | Description | Notes
**enum_string** | **str** | | [optional]
**enum_integer** | **int** | | [optional]
**enum_number** | **float** | | [optional]
**outer_enum** | [**outer_enum.OuterEnum**](OuterEnum.md) | | [optional]
**string_enum** | [**string_enum.StringEnum**](StringEnum.md) | | [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)

View File

@@ -4,12 +4,13 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**array_model**](FakeApi.md#array_model) | **POST** /fake/refs/arraymodel |
[**boolean**](FakeApi.md#boolean) | **POST** /fake/refs/boolean |
[**create_xml_item**](FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
[**fake_outer_enum_serialize**](FakeApi.md#fake_outer_enum_serialize) | **POST** /fake/outer/enum |
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
[**number_with_validations**](FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
[**object_model_with_ref_props**](FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
[**string**](FakeApi.md#string) | **POST** /fake/refs/string |
[**string_enum**](FakeApi.md#string_enum) | **POST** /fake/refs/enum |
[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
@@ -21,6 +22,133 @@ Method | HTTP request | Description
[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
# **array_model**
> animal_farm.AnimalFarm array_model()
Test serialization of ArrayModel
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import animal_farm
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = animal_farm.AnimalFarm() # animal_farm.AnimalFarm | Input model (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.array_model(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->array_model: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**animal_farm.AnimalFarm**](AnimalFarm.md)| Input model | [optional]
### Return type
[**animal_farm.AnimalFarm**](AnimalFarm.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output model | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **boolean**
> bool boolean()
Test serialization of outer boolean types
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = True # bool | Input boolean as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.boolean(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->boolean: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **bool**| Input boolean as post body | [optional]
### Return type
**bool**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output boolean | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **create_xml_item**
> create_xml_item(xml_item)
@@ -84,199 +212,8 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_boolean_serialize**
> bool fake_outer_boolean_serialize()
Test serialization of outer boolean types
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = True # bool | Input boolean as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_boolean_serialize(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **bool**| Input boolean as post body | [optional]
### Return type
**bool**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output boolean | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_composite_serialize**
> outer_composite.OuterComposite fake_outer_composite_serialize()
Test serialization of object with outer number type
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import outer_composite
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = outer_composite.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_composite_serialize(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**outer_composite.OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
### Return type
[**outer_composite.OuterComposite**](OuterComposite.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output composite | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_enum_serialize**
> outer_enum.OuterEnum fake_outer_enum_serialize()
Test serialization of outer enum
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import outer_enum
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = outer_enum.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_enum_serialize(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_enum_serialize: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**outer_enum.OuterEnum**](OuterEnum.md)| Input enum as post body | [optional]
### Return type
[**outer_enum.OuterEnum**](OuterEnum.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output enum | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_number_serialize**
> outer_number.OuterNumber fake_outer_number_serialize()
# **number_with_validations**
> number_with_validations.NumberWithValidations number_with_validations()
@@ -289,7 +226,7 @@ from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import outer_number
from petstore_api.model import number_with_validations
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
@@ -302,26 +239,26 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = outer_number.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional)
body = number_with_validations.NumberWithValidations(3.4) # number_with_validations.NumberWithValidations | Input number as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_number_serialize(body=body)
api_response = api_instance.number_with_validations(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
print("Exception when calling FakeApi->number_with_validations: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**outer_number.OuterNumber**](OuterNumber.md)| Input number as post body | [optional]
**body** | [**number_with_validations.NumberWithValidations**](NumberWithValidations.md)| Input number as post body | [optional]
### Return type
[**outer_number.OuterNumber**](OuterNumber.md)
[**number_with_validations.NumberWithValidations**](NumberWithValidations.md)
### Authorization
@@ -339,8 +276,72 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_string_serialize**
> str fake_outer_string_serialize()
# **object_model_with_ref_props**
> object_model_with_ref_props.ObjectModelWithRefProps object_model_with_ref_props()
Test serialization of object with $refed properties
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import object_model_with_ref_props
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = object_model_with_ref_props.ObjectModelWithRefProps() # object_model_with_ref_props.ObjectModelWithRefProps | Input model (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.object_model_with_ref_props(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->object_model_with_ref_props: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**object_model_with_ref_props.ObjectModelWithRefProps**](ObjectModelWithRefProps.md)| Input model | [optional]
### Return type
[**object_model_with_ref_props.ObjectModelWithRefProps**](ObjectModelWithRefProps.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output model | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **string**
> str string()
@@ -370,10 +371,10 @@ with petstore_api.ApiClient() as api_client:
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_string_serialize(body=body)
api_response = api_instance.string(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
print("Exception when calling FakeApi->string: %s\n" % e)
```
### Parameters
@@ -402,6 +403,70 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **string_enum**
> string_enum.StringEnum string_enum()
Test serialization of outer enum
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import string_enum
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = string_enum.StringEnum("placed") # string_enum.StringEnum | Input enum (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.string_enum(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->string_enum: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**string_enum.StringEnum**](StringEnum.md)| Input enum | [optional]
### Return type
[**string_enum.StringEnum**](StringEnum.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output enum | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_body_with_file_schema**
> test_body_with_file_schema(body)

View File

@@ -1,4 +1,4 @@
# outer_number.OuterNumber
# number_with_validations.NumberWithValidations
## Properties
Name | Type | Description | Notes

View File

@@ -1,9 +1,10 @@
# outer_composite.OuterComposite
# object_model_with_ref_props.ObjectModelWithRefProps
a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**my_number** | [**outer_number.OuterNumber**](OuterNumber.md) | | [optional]
**my_number** | [**number_with_validations.NumberWithValidations**](NumberWithValidations.md) | | [optional]
**my_string** | **str** | | [optional]
**my_boolean** | **bool** | | [optional]

View File

@@ -1,4 +1,4 @@
# outer_enum.OuterEnum
# string_enum.StringEnum
## Properties
Name | Type | Description | Notes

View File

@@ -30,10 +30,11 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_and_convert_types
)
from petstore_api.model import animal_farm
from petstore_api.model import xml_item
from petstore_api.model import outer_composite
from petstore_api.model import outer_enum
from petstore_api.model import outer_number
from petstore_api.model import number_with_validations
from petstore_api.model import object_model_with_ref_props
from petstore_api.model import string_enum
from petstore_api.model import file_schema_test_class
from petstore_api.model import user
from petstore_api.model import client
@@ -51,6 +52,226 @@ class FakeApi(object):
api_client = ApiClient()
self.api_client = api_client
def __array_model(
self,
**kwargs
):
"""array_model # noqa: E501
Test serialization of ArrayModel # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.array_model(async_req=True)
>>> result = thread.get()
Keyword Args:
body (animal_farm.AnimalFarm): Input model. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
animal_farm.AnimalFarm
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.array_model = Endpoint(
settings={
'response_type': (animal_farm.AnimalFarm,),
'auth': [],
'endpoint_path': '/fake/refs/arraymodel',
'operation_id': 'array_model',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'body',
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body':
(animal_farm.AnimalFarm,),
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'*/*'
],
'content_type': [],
},
api_client=api_client,
callable=__array_model
)
def __boolean(
self,
**kwargs
):
"""boolean # noqa: E501
Test serialization of outer boolean types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.boolean(async_req=True)
>>> result = thread.get()
Keyword Args:
body (bool): Input boolean as post body. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
bool
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.boolean = Endpoint(
settings={
'response_type': (bool,),
'auth': [],
'endpoint_path': '/fake/refs/boolean',
'operation_id': 'boolean',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'body',
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body':
(bool,),
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'*/*'
],
'content_type': [],
},
api_client=api_client,
callable=__boolean
)
def __create_xml_item(
self,
xml_item,
@@ -172,352 +393,22 @@ class FakeApi(object):
callable=__create_xml_item
)
def __fake_outer_boolean_serialize(
def __number_with_validations(
self,
**kwargs
):
"""fake_outer_boolean_serialize # noqa: E501
Test serialization of outer boolean types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.fake_outer_boolean_serialize(async_req=True)
>>> result = thread.get()
Keyword Args:
body (bool): Input boolean as post body. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
bool
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.fake_outer_boolean_serialize = Endpoint(
settings={
'response_type': (bool,),
'auth': [],
'endpoint_path': '/fake/outer/boolean',
'operation_id': 'fake_outer_boolean_serialize',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'body',
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body':
(bool,),
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'*/*'
],
'content_type': [],
},
api_client=api_client,
callable=__fake_outer_boolean_serialize
)
def __fake_outer_composite_serialize(
self,
**kwargs
):
"""fake_outer_composite_serialize # noqa: E501
Test serialization of object with outer number type # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.fake_outer_composite_serialize(async_req=True)
>>> result = thread.get()
Keyword Args:
body (outer_composite.OuterComposite): Input composite as post body. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
outer_composite.OuterComposite
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.fake_outer_composite_serialize = Endpoint(
settings={
'response_type': (outer_composite.OuterComposite,),
'auth': [],
'endpoint_path': '/fake/outer/composite',
'operation_id': 'fake_outer_composite_serialize',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'body',
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body':
(outer_composite.OuterComposite,),
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'*/*'
],
'content_type': [],
},
api_client=api_client,
callable=__fake_outer_composite_serialize
)
def __fake_outer_enum_serialize(
self,
**kwargs
):
"""fake_outer_enum_serialize # noqa: E501
Test serialization of outer enum # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.fake_outer_enum_serialize(async_req=True)
>>> result = thread.get()
Keyword Args:
body (outer_enum.OuterEnum): Input enum as post body. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
outer_enum.OuterEnum
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.fake_outer_enum_serialize = Endpoint(
settings={
'response_type': (outer_enum.OuterEnum,),
'auth': [],
'endpoint_path': '/fake/outer/enum',
'operation_id': 'fake_outer_enum_serialize',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'body',
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body':
(outer_enum.OuterEnum,),
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'*/*'
],
'content_type': [],
},
api_client=api_client,
callable=__fake_outer_enum_serialize
)
def __fake_outer_number_serialize(
self,
**kwargs
):
"""fake_outer_number_serialize # noqa: E501
"""number_with_validations # noqa: E501
Test serialization of outer number types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.fake_outer_number_serialize(async_req=True)
>>> thread = api.number_with_validations(async_req=True)
>>> result = thread.get()
Keyword Args:
body (outer_number.OuterNumber): Input number as post body. [optional]
body (number_with_validations.NumberWithValidations): Input number as post body. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
@@ -539,7 +430,7 @@ class FakeApi(object):
async_req (bool): execute request asynchronously
Returns:
outer_number.OuterNumber
number_with_validations.NumberWithValidations
If the method is called asynchronously, returns the request
thread.
"""
@@ -564,12 +455,12 @@ class FakeApi(object):
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.fake_outer_number_serialize = Endpoint(
self.number_with_validations = Endpoint(
settings={
'response_type': (outer_number.OuterNumber,),
'response_type': (number_with_validations.NumberWithValidations,),
'auth': [],
'endpoint_path': '/fake/outer/number',
'operation_id': 'fake_outer_number_serialize',
'endpoint_path': '/fake/refs/number',
'operation_id': 'number_with_validations',
'http_method': 'POST',
'servers': None,
},
@@ -592,7 +483,7 @@ class FakeApi(object):
},
'openapi_types': {
'body':
(outer_number.OuterNumber,),
(number_with_validations.NumberWithValidations,),
},
'attribute_map': {
},
@@ -609,20 +500,130 @@ class FakeApi(object):
'content_type': [],
},
api_client=api_client,
callable=__fake_outer_number_serialize
callable=__number_with_validations
)
def __fake_outer_string_serialize(
def __object_model_with_ref_props(
self,
**kwargs
):
"""fake_outer_string_serialize # noqa: E501
"""object_model_with_ref_props # noqa: E501
Test serialization of object with $refed properties # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.object_model_with_ref_props(async_req=True)
>>> result = thread.get()
Keyword Args:
body (object_model_with_ref_props.ObjectModelWithRefProps): Input model. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
object_model_with_ref_props.ObjectModelWithRefProps
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.object_model_with_ref_props = Endpoint(
settings={
'response_type': (object_model_with_ref_props.ObjectModelWithRefProps,),
'auth': [],
'endpoint_path': '/fake/refs/object_model_with_ref_props',
'operation_id': 'object_model_with_ref_props',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'body',
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body':
(object_model_with_ref_props.ObjectModelWithRefProps,),
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'*/*'
],
'content_type': [],
},
api_client=api_client,
callable=__object_model_with_ref_props
)
def __string(
self,
**kwargs
):
"""string # noqa: E501
Test serialization of outer string types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.fake_outer_string_serialize(async_req=True)
>>> thread = api.string(async_req=True)
>>> result = thread.get()
@@ -674,12 +675,12 @@ class FakeApi(object):
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.fake_outer_string_serialize = Endpoint(
self.string = Endpoint(
settings={
'response_type': (str,),
'auth': [],
'endpoint_path': '/fake/outer/string',
'operation_id': 'fake_outer_string_serialize',
'endpoint_path': '/fake/refs/string',
'operation_id': 'string',
'http_method': 'POST',
'servers': None,
},
@@ -719,7 +720,117 @@ class FakeApi(object):
'content_type': [],
},
api_client=api_client,
callable=__fake_outer_string_serialize
callable=__string
)
def __string_enum(
self,
**kwargs
):
"""string_enum # noqa: E501
Test serialization of outer enum # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.string_enum(async_req=True)
>>> result = thread.get()
Keyword Args:
body (string_enum.StringEnum): Input enum. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
string_enum.StringEnum
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.string_enum = Endpoint(
settings={
'response_type': (string_enum.StringEnum,),
'auth': [],
'endpoint_path': '/fake/refs/enum',
'operation_id': 'string_enum',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'body',
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body':
(string_enum.StringEnum,),
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'*/*'
],
'content_type': [],
},
api_client=api_client,
callable=__string_enum
)
def __test_body_with_file_schema(

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.model import outer_enum
from petstore_api.model import string_enum
except ImportError:
outer_enum = sys.modules[
'petstore_api.model.outer_enum']
string_enum = sys.modules[
'petstore_api.model.string_enum']
class EnumTest(ModelNormal):
@@ -107,7 +107,7 @@ class EnumTest(ModelNormal):
'enum_string': (str,), # noqa: E501
'enum_integer': (int,), # noqa: E501
'enum_number': (float,), # noqa: E501
'outer_enum': (outer_enum.OuterEnum,), # noqa: E501
'string_enum': (string_enum.StringEnum,), # noqa: E501
}
@cached_property
@@ -119,7 +119,7 @@ class EnumTest(ModelNormal):
'enum_string': 'enum_string', # noqa: E501
'enum_integer': 'enum_integer', # noqa: E501
'enum_number': 'enum_number', # noqa: E501
'outer_enum': 'outerEnum', # noqa: E501
'string_enum': 'stringEnum', # noqa: E501
}
_composed_schemas = {}
@@ -174,7 +174,7 @@ class EnumTest(ModelNormal):
enum_string (str): [optional] # noqa: E501
enum_integer (int): [optional] # noqa: E501
enum_number (float): [optional] # noqa: E501
outer_enum (outer_enum.OuterEnum): [optional] # noqa: E501
string_enum (string_enum.StringEnum): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -35,7 +35,7 @@ from petstore_api.model_utils import ( # noqa: F401
)
class OuterNumber(ModelSimple):
class NumberWithValidations(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -102,7 +102,7 @@ class OuterNumber(ModelSimple):
@convert_js_args_to_python_args
def __init__(self, value, *args, **kwargs): # noqa: E501
"""outer_number.OuterNumber - a model defined in OpenAPI
"""number_with_validations.NumberWithValidations - a model defined in OpenAPI
Args:
value (float):

View File

@@ -34,13 +34,13 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.model import outer_number
from petstore_api.model import number_with_validations
except ImportError:
outer_number = sys.modules[
'petstore_api.model.outer_number']
number_with_validations = sys.modules[
'petstore_api.model.number_with_validations']
class OuterComposite(ModelNormal):
class ObjectModelWithRefProps(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -85,7 +85,7 @@ class OuterComposite(ModelNormal):
and the value is attribute type.
"""
return {
'my_number': (outer_number.OuterNumber,), # noqa: E501
'my_number': (number_with_validations.NumberWithValidations,), # noqa: E501
'my_string': (str,), # noqa: E501
'my_boolean': (bool,), # noqa: E501
}
@@ -113,7 +113,7 @@ class OuterComposite(ModelNormal):
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""outer_composite.OuterComposite - a model defined in OpenAPI
"""object_model_with_ref_props.ObjectModelWithRefProps - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
@@ -146,7 +146,7 @@ class OuterComposite(ModelNormal):
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
my_number (outer_number.OuterNumber): [optional] # noqa: E501
my_number (number_with_validations.NumberWithValidations): [optional] # noqa: E501
my_string (str): [optional] # noqa: E501
my_boolean (bool): [optional] # noqa: E501
"""

View File

@@ -35,7 +35,7 @@ from petstore_api.model_utils import ( # noqa: F401
)
class OuterEnum(ModelSimple):
class StringEnum(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -103,7 +103,7 @@ class OuterEnum(ModelSimple):
@convert_js_args_to_python_args
def __init__(self, value, *args, **kwargs): # noqa: E501
"""outer_enum.OuterEnum - a model defined in OpenAPI
"""string_enum.StringEnum - a model defined in OpenAPI
Args:
value (str):

View File

@@ -57,10 +57,9 @@ from petstore_api.model.model200_response import Model200Response
from petstore_api.model.model_return import ModelReturn
from petstore_api.model.name import Name
from petstore_api.model.number_only import NumberOnly
from petstore_api.model.number_with_validations import NumberWithValidations
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
from petstore_api.model.order import Order
from petstore_api.model.outer_composite import OuterComposite
from petstore_api.model.outer_enum import OuterEnum
from petstore_api.model.outer_number import OuterNumber
from petstore_api.model.parent import Parent
from petstore_api.model.parent_all_of import ParentAllOf
from petstore_api.model.parent_pet import ParentPet
@@ -69,6 +68,7 @@ from petstore_api.model.player import Player
from petstore_api.model.read_only_first import ReadOnlyFirst
from petstore_api.model.special_model_name import SpecialModelName
from petstore_api.model.string_boolean_map import StringBooleanMap
from petstore_api.model.string_enum import StringEnum
from petstore_api.model.tag import Tag
from petstore_api.model.type_holder_default import TypeHolderDefault
from petstore_api.model.type_holder_example import TypeHolderExample

View File

@@ -16,10 +16,10 @@ import unittest
import petstore_api
try:
from petstore_api.model import outer_enum
from petstore_api.model import string_enum
except ImportError:
outer_enum = sys.modules[
'petstore_api.model.outer_enum']
string_enum = sys.modules[
'petstore_api.model.string_enum']
from petstore_api.model.enum_test import EnumTest

View File

@@ -34,43 +34,58 @@ class TestFakeApi(unittest.TestCase):
"""
pass
def test_fake_outer_boolean_serialize(self):
"""Test case for fake_outer_boolean_serialize
def test_boolean(self):
"""Test case for boolean
"""
pass
endpoint = self.api.boolean
assert endpoint.openapi_types['body'] == (bool,)
assert endpoint.settings['response_type'] == (bool,)
def test_fake_outer_composite_serialize(self):
"""Test case for fake_outer_composite_serialize
def test_string(self):
"""Test case for string
"""
pass
from petstore_api.model_utils import str
endpoint = self.api.string
assert endpoint.openapi_types['body'] == (str,)
assert endpoint.settings['response_type'] == (str,)
def test_fake_outer_enum_serialize(self):
"""Test case for fake_outer_enum_serialize
def test_object_model_with_ref_props(self):
"""Test case for object_model_with_ref_props
"""
# verify that the input and output are type OuterEnum
from petstore_api.model import outer_enum
endpoint = self.api.fake_outer_enum_serialize
assert endpoint.openapi_types['body'] == (outer_enum.OuterEnum,)
assert endpoint.settings['response_type'] == (outer_enum.OuterEnum,)
from petstore_api.model import object_model_with_ref_props
endpoint = self.api.object_model_with_ref_props
assert endpoint.openapi_types['body'] == (object_model_with_ref_props.ObjectModelWithRefProps,)
assert endpoint.settings['response_type'] == (object_model_with_ref_props.ObjectModelWithRefProps,)
def test_fake_outer_number_serialize(self):
"""Test case for fake_outer_number_serialize
def test_string_enum(self):
"""Test case for string_enum
"""
# verify that the input and output are the correct type
from petstore_api.model import outer_number
endpoint = self.api.fake_outer_number_serialize
assert endpoint.openapi_types['body'] == (outer_number.OuterNumber,)
assert endpoint.settings['response_type'] == (outer_number.OuterNumber,)
from petstore_api.model import string_enum
endpoint = self.api.string_enum
assert endpoint.openapi_types['body'] == (string_enum.StringEnum,)
assert endpoint.settings['response_type'] == (string_enum.StringEnum,)
def test_fake_outer_string_serialize(self):
"""Test case for fake_outer_string_serialize
def test_array_model(self):
"""Test case for array_model
"""
pass
from petstore_api.model import animal_farm
endpoint = self.api.array_model
assert endpoint.openapi_types['body'] == (animal_farm.AnimalFarm,)
assert endpoint.settings['response_type'] == (animal_farm.AnimalFarm,)
def test_number_with_validations(self):
"""Test case for number_with_validations
"""
from petstore_api.model import number_with_validations
endpoint = self.api.number_with_validations
assert endpoint.openapi_types['body'] == (number_with_validations.NumberWithValidations,)
assert endpoint.settings['response_type'] == (number_with_validations.NumberWithValidations,)
def test_test_body_with_file_schema(self):
"""Test case for test_body_with_file_schema

View File

@@ -0,0 +1,45 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.model.number_with_validations import NumberWithValidations
class TestNumberWithValidations(unittest.TestCase):
"""NumberWithValidations unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testNumberWithValidations(self):
"""Test NumberWithValidations"""
valid_values = [10.0, 15.0, 20.0]
for valid_value in valid_values:
model = NumberWithValidations(valid_value)
assert model.value == valid_value
invalid_values = [9.0, 21.0]
for invalid_value in invalid_values:
with self.assertRaises(petstore_api.ApiValueError):
NumberWithValidations(invalid_value)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,49 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
try:
from petstore_api.model import number_with_validations
except ImportError:
number_with_validations = sys.modules[
'petstore_api.model.number_with_validations']
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
class TestObjectModelWithRefProps(unittest.TestCase):
"""ObjectModelWithRefProps unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testObjectModelWithRefProps(self):
"""Test ObjectModelWithRefProps"""
from petstore_api.model.object_model_with_ref_props import str, number_with_validations
self.assertEqual(
ObjectModelWithRefProps.openapi_types,
{
'my_number': (number_with_validations.NumberWithValidations,),
'my_string': (str,),
'my_boolean': (bool,),
}
)
if __name__ == '__main__':
unittest.main()

View File

@@ -15,11 +15,11 @@ import sys
import unittest
import petstore_api
from petstore_api.model.outer_enum import OuterEnum
from petstore_api.model.string_enum import StringEnum
class TestOuterEnum(unittest.TestCase):
"""OuterEnum unit test stubs"""
class TestStringEnum(unittest.TestCase):
"""StringEnum unit test stubs"""
def setUp(self):
pass
@@ -27,20 +27,22 @@ class TestOuterEnum(unittest.TestCase):
def tearDown(self):
pass
def testOuterEnum(self):
def testStringEnum(self):
"""Test StringEnum"""
"""Test OuterEnum"""
# make sure that we can access its allowed_values
assert OuterEnum.allowed_values[('value',)] == {
assert StringEnum.allowed_values[('value',)] == {
'PLACED': "placed",
'APPROVED': "approved",
'DELIVERED': "delivered"
}
# make sure that an exception is thrown on an invalid value
with self.assertRaises(petstore_api.ApiValueError):
OuterEnum('bad_value')
StringEnum('bad_value')
# make sure valid value works
valid_value = OuterEnum.allowed_values[('value',)]['PLACED']
assert valid_value == OuterEnum(valid_value).value
valid_value = StringEnum.allowed_values[('value',)]['PLACED']
assert valid_value == StringEnum(valid_value).value
if __name__ == '__main__':

View File

@@ -32,8 +32,8 @@ from petstore_api.model import (
parent_pet,
child_lizard,
category,
outer_enum,
outer_number,
string_enum,
number_with_validations,
string_boolean_map,
)
from petstore_api.model_utils import (
@@ -61,7 +61,7 @@ class DeserializationTests(unittest.TestCase):
"enum_string_required": "lower",
"enum_integer": 1,
"enum_number": 1.1,
"outerEnum": "placed"
"stringEnum": "placed"
}
}
response = MockResponse(data=json.dumps(data))
@@ -72,14 +72,14 @@ class DeserializationTests(unittest.TestCase):
self.assertTrue(
isinstance(deserialized['enum_test'], enum_test.EnumTest))
value = (
outer_enum.OuterEnum.allowed_values[('value',)]["PLACED"])
outer_enum_val = outer_enum.OuterEnum(value)
string_enum.StringEnum.allowed_values[('value',)]["PLACED"])
string_enum_val = string_enum.StringEnum(value)
sample_instance = enum_test.EnumTest(
enum_string="UPPER",
enum_string_required="lower",
enum_integer=1,
enum_number=1.1,
outer_enum=outer_enum_val
string_enum=string_enum_val
)
self.assertEqual(deserialized['enum_test'], sample_instance)
@@ -305,27 +305,27 @@ class DeserializationTests(unittest.TestCase):
with self.assertRaises(ApiValueError):
self.deserialize(
MockResponse(data=json.dumps("test str")),
(outer_enum.OuterEnum,),
(string_enum.StringEnum,),
True
)
# valid value works
placed_str = (
outer_enum.OuterEnum.allowed_values[('value',)]["PLACED"]
string_enum.StringEnum.allowed_values[('value',)]["PLACED"]
)
response = MockResponse(data=json.dumps(placed_str))
deserialized = self.deserialize(response,
(outer_enum.OuterEnum,), True)
self.assertTrue(isinstance(deserialized, outer_enum.OuterEnum))
(string_enum.StringEnum,), True)
self.assertTrue(isinstance(deserialized, string_enum.StringEnum))
self.assertTrue(deserialized.value == placed_str)
def test_deserialize_OuterNumber(self):
""" deserialize OuterNumber """
def test_deserialize_NumberWithValidations(self):
""" deserialize NumberWithValidations """
# make sure that an exception is thrown on an invalid type value
with self.assertRaises(ApiTypeError):
deserialized = self.deserialize(
MockResponse(data=json.dumps("test str")),
(outer_number.OuterNumber,),
(number_with_validations.NumberWithValidations,),
True
)
@@ -333,7 +333,7 @@ class DeserializationTests(unittest.TestCase):
with self.assertRaises(ApiValueError):
deserialized = self.deserialize(
MockResponse(data=json.dumps(21.0)),
(outer_number.OuterNumber,),
(number_with_validations.NumberWithValidations,),
True
)
@@ -341,8 +341,8 @@ class DeserializationTests(unittest.TestCase):
number_val = 11.0
response = MockResponse(data=json.dumps(number_val))
number = self.deserialize(response,
(outer_number.OuterNumber,), True)
self.assertTrue(isinstance(number, outer_number.OuterNumber))
(number_with_validations.NumberWithValidations,), True)
self.assertTrue(isinstance(number, number_with_validations.NumberWithValidations))
self.assertTrue(number.value == number_val)
def test_deserialize_file(self):

View File

@@ -32,8 +32,7 @@ from petstore_api.model import (
parent_pet,
child_lizard,
category,
outer_enum,
outer_number,
string_enum,
string_boolean_map,
)
from petstore_api.model_utils import (
@@ -56,15 +55,15 @@ class SerializationTests(unittest.TestCase):
def test_enum_test(self):
""" serialize dict(str, Enum_Test) """
value = (
outer_enum.OuterEnum.allowed_values[('value',)]["PLACED"])
outer_enum_val = outer_enum.OuterEnum(value)
string_enum.StringEnum.allowed_values[('value',)]["PLACED"])
string_enum_val = string_enum.StringEnum(value)
source = enum_test.EnumTest(
enum_string="UPPER",
enum_string_required="lower",
enum_integer=1,
enum_number=1.1,
outer_enum=outer_enum_val
string_enum=string_enum_val
)
result = {
@@ -73,7 +72,7 @@ class SerializationTests(unittest.TestCase):
"enum_string_required": "lower",
"enum_integer": 1,
"enum_number": 1.1,
"outerEnum": "placed"
"stringEnum": "placed"
}
}
serialized = self.serialize({"enum_test": source})

View File

@@ -55,6 +55,9 @@ docs/InlineObject3.md
docs/InlineObject4.md
docs/InlineObject5.md
docs/InlineResponseDefault.md
docs/IntegerEnum.md
docs/IntegerEnumOneValue.md
docs/IntegerEnumWithDefaultValue.md
docs/IsoscelesTriangle.md
docs/List.md
docs/Mammal.md
@@ -66,12 +69,9 @@ docs/Name.md
docs/NullableClass.md
docs/NullableShape.md
docs/NumberOnly.md
docs/NumberWithValidations.md
docs/ObjectModelWithRefProps.md
docs/Order.md
docs/OuterComposite.md
docs/OuterEnum.md
docs/OuterEnumDefaultValue.md
docs/OuterEnumInteger.md
docs/OuterEnumIntegerDefaultValue.md
docs/ParentPet.md
docs/Pet.md
docs/PetApi.md
@@ -87,6 +87,8 @@ docs/SimpleQuadrilateral.md
docs/SpecialModelName.md
docs/StoreApi.md
docs/StringBooleanMap.md
docs/StringEnum.md
docs/StringEnumWithDefaultValue.md
docs/Tag.md
docs/Triangle.md
docs/TriangleInterface.md
@@ -158,6 +160,9 @@ petstore_api/model/inline_object3.py
petstore_api/model/inline_object4.py
petstore_api/model/inline_object5.py
petstore_api/model/inline_response_default.py
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/list.py
petstore_api/model/mammal.py
@@ -169,12 +174,9 @@ petstore_api/model/name.py
petstore_api/model/nullable_class.py
petstore_api/model/nullable_shape.py
petstore_api/model/number_only.py
petstore_api/model/number_with_validations.py
petstore_api/model/object_model_with_ref_props.py
petstore_api/model/order.py
petstore_api/model/outer_composite.py
petstore_api/model/outer_enum.py
petstore_api/model/outer_enum_default_value.py
petstore_api/model/outer_enum_integer.py
petstore_api/model/outer_enum_integer_default_value.py
petstore_api/model/parent_pet.py
petstore_api/model/pet.py
petstore_api/model/pig.py
@@ -188,6 +190,8 @@ petstore_api/model/shape_or_null.py
petstore_api/model/simple_quadrilateral.py
petstore_api/model/special_model_name.py
petstore_api/model/string_boolean_map.py
petstore_api/model/string_enum.py
petstore_api/model/string_enum_with_default_value.py
petstore_api/model/tag.py
petstore_api/model/triangle.py
petstore_api/model/triangle_interface.py

View File

@@ -82,13 +82,15 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
*DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo |
*FakeApi* | [**additional_properties_with_array_of_enums**](docs/FakeApi.md#additional_properties_with_array_of_enums) | **GET** /fake/additional-properties-with-array-of-enums | Additional Properties with Array of Enums
*FakeApi* | [**array_model**](docs/FakeApi.md#array_model) | **POST** /fake/refs/arraymodel |
*FakeApi* | [**array_of_enums**](docs/FakeApi.md#array_of_enums) | **POST** /fake/refs/array-of-enums | Array of Enums
*FakeApi* | [**boolean**](docs/FakeApi.md#boolean) | **POST** /fake/refs/boolean |
*FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*FakeApi* | [**get_additional_properties_with_array_of_enums**](docs/FakeApi.md#get_additional_properties_with_array_of_enums) | **GET** /fake/additional-properties-with-array-of-enums | Additional Properties with Array of Enums
*FakeApi* | [**get_array_of_enums**](docs/FakeApi.md#get_array_of_enums) | **GET** /fake/array-of-enums | Array of Enums
*FakeApi* | [**number_with_validations**](docs/FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
*FakeApi* | [**object_model_with_ref_props**](docs/FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
*FakeApi* | [**string**](docs/FakeApi.md#string) | **POST** /fake/refs/string |
*FakeApi* | [**string_enum**](docs/FakeApi.md#string_enum) | **POST** /fake/refs/enum |
*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
@@ -173,6 +175,9 @@ Class | Method | HTTP request | Description
- [inline_object4.InlineObject4](docs/InlineObject4.md)
- [inline_object5.InlineObject5](docs/InlineObject5.md)
- [inline_response_default.InlineResponseDefault](docs/InlineResponseDefault.md)
- [integer_enum.IntegerEnum](docs/IntegerEnum.md)
- [integer_enum_one_value.IntegerEnumOneValue](docs/IntegerEnumOneValue.md)
- [integer_enum_with_default_value.IntegerEnumWithDefaultValue](docs/IntegerEnumWithDefaultValue.md)
- [isosceles_triangle.IsoscelesTriangle](docs/IsoscelesTriangle.md)
- [list.List](docs/List.md)
- [mammal.Mammal](docs/Mammal.md)
@@ -184,12 +189,9 @@ Class | Method | HTTP request | Description
- [nullable_class.NullableClass](docs/NullableClass.md)
- [nullable_shape.NullableShape](docs/NullableShape.md)
- [number_only.NumberOnly](docs/NumberOnly.md)
- [number_with_validations.NumberWithValidations](docs/NumberWithValidations.md)
- [object_model_with_ref_props.ObjectModelWithRefProps](docs/ObjectModelWithRefProps.md)
- [order.Order](docs/Order.md)
- [outer_composite.OuterComposite](docs/OuterComposite.md)
- [outer_enum.OuterEnum](docs/OuterEnum.md)
- [outer_enum_default_value.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
- [outer_enum_integer.OuterEnumInteger](docs/OuterEnumInteger.md)
- [outer_enum_integer_default_value.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
- [parent_pet.ParentPet](docs/ParentPet.md)
- [pet.Pet](docs/Pet.md)
- [pig.Pig](docs/Pig.md)
@@ -203,6 +205,8 @@ Class | Method | HTTP request | Description
- [simple_quadrilateral.SimpleQuadrilateral](docs/SimpleQuadrilateral.md)
- [special_model_name.SpecialModelName](docs/SpecialModelName.md)
- [string_boolean_map.StringBooleanMap](docs/StringBooleanMap.md)
- [string_enum.StringEnum](docs/StringEnum.md)
- [string_enum_with_default_value.StringEnumWithDefaultValue](docs/StringEnumWithDefaultValue.md)
- [tag.Tag](docs/Tag.md)
- [triangle.Triangle](docs/Triangle.md)
- [triangle_interface.TriangleInterface](docs/TriangleInterface.md)

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | [**[outer_enum.OuterEnum, none_type]**](OuterEnum.md) | |
**value** | [**[string_enum.StringEnum, none_type]**](StringEnum.md) | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -7,10 +7,11 @@ Name | Type | Description | Notes
**enum_string** | **str** | | [optional]
**enum_integer** | **int** | | [optional]
**enum_number** | **float** | | [optional]
**outer_enum** | [**outer_enum.OuterEnum**](OuterEnum.md) | | [optional]
**outer_enum_integer** | [**outer_enum_integer.OuterEnumInteger**](OuterEnumInteger.md) | | [optional]
**outer_enum_default_value** | [**outer_enum_default_value.OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional]
**outer_enum_integer_default_value** | [**outer_enum_integer_default_value.OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional]
**string_enum** | [**string_enum.StringEnum**](StringEnum.md) | | [optional]
**integer_enum** | [**integer_enum.IntegerEnum**](IntegerEnum.md) | | [optional]
**string_enum_with_default_value** | [**string_enum_with_default_value.StringEnumWithDefaultValue**](StringEnumWithDefaultValue.md) | | [optional]
**integer_enum_with_default_value** | [**integer_enum_with_default_value.IntegerEnumWithDefaultValue**](IntegerEnumWithDefaultValue.md) | | [optional]
**integer_enum_one_value** | [**integer_enum_one_value.IntegerEnumOneValue**](IntegerEnumOneValue.md) | | [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)

View File

@@ -4,13 +4,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**additional_properties_with_array_of_enums**](FakeApi.md#additional_properties_with_array_of_enums) | **GET** /fake/additional-properties-with-array-of-enums | Additional Properties with Array of Enums
[**array_model**](FakeApi.md#array_model) | **POST** /fake/refs/arraymodel |
[**array_of_enums**](FakeApi.md#array_of_enums) | **POST** /fake/refs/array-of-enums | Array of Enums
[**boolean**](FakeApi.md#boolean) | **POST** /fake/refs/boolean |
[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint
[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
[**get_additional_properties_with_array_of_enums**](FakeApi.md#get_additional_properties_with_array_of_enums) | **GET** /fake/additional-properties-with-array-of-enums | Additional Properties with Array of Enums
[**get_array_of_enums**](FakeApi.md#get_array_of_enums) | **GET** /fake/array-of-enums | Array of Enums
[**number_with_validations**](FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
[**object_model_with_ref_props**](FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
[**string**](FakeApi.md#string) | **POST** /fake/refs/string |
[**string_enum**](FakeApi.md#string_enum) | **POST** /fake/refs/enum |
[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
@@ -22,6 +24,259 @@ Method | HTTP request | Description
[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-paramters |
# **additional_properties_with_array_of_enums**
> additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums additional_properties_with_array_of_enums()
Additional Properties with Array of Enums
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import additional_properties_with_array_of_enums
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
additional_properties_with_array_of_enums_additional_properties_with_array_of_enums = additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums() # additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums | Input enum (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Additional Properties with Array of Enums
api_response = api_instance.additional_properties_with_array_of_enums(additional_properties_with_array_of_enums_additional_properties_with_array_of_enums=additional_properties_with_array_of_enums_additional_properties_with_array_of_enums)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->additional_properties_with_array_of_enums: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**additional_properties_with_array_of_enums_additional_properties_with_array_of_enums** | [**additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums**](AdditionalPropertiesWithArrayOfEnums.md)| Input enum | [optional]
### Return type
[**additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums**](AdditionalPropertiesWithArrayOfEnums.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Got object with additional properties with array of enums | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **array_model**
> animal_farm.AnimalFarm array_model()
Test serialization of ArrayModel
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import animal_farm
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = animal_farm.AnimalFarm() # animal_farm.AnimalFarm | Input model (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.array_model(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->array_model: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**animal_farm.AnimalFarm**](AnimalFarm.md)| Input model | [optional]
### Return type
[**animal_farm.AnimalFarm**](AnimalFarm.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output model | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **array_of_enums**
> array_of_enums.ArrayOfEnums array_of_enums()
Array of Enums
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import array_of_enums
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
array_of_enums_array_of_enums = array_of_enums.ArrayOfEnums() # array_of_enums.ArrayOfEnums | Input enum (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Array of Enums
api_response = api_instance.array_of_enums(array_of_enums_array_of_enums=array_of_enums_array_of_enums)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->array_of_enums: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**array_of_enums_array_of_enums** | [**array_of_enums.ArrayOfEnums**](ArrayOfEnums.md)| Input enum | [optional]
### Return type
[**array_of_enums.ArrayOfEnums**](ArrayOfEnums.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Got named array of enums | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **boolean**
> bool boolean()
Test serialization of outer boolean types
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = True # bool | Input boolean as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.boolean(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->boolean: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **bool**| Input boolean as post body | [optional]
### Return type
**bool**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output boolean | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_health_get**
> health_check_result.HealthCheckResult fake_health_get()
@@ -80,135 +335,8 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_boolean_serialize**
> bool fake_outer_boolean_serialize()
Test serialization of outer boolean types
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = True # bool | Input boolean as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_boolean_serialize(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **bool**| Input boolean as post body | [optional]
### Return type
**bool**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output boolean | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_composite_serialize**
> outer_composite.OuterComposite fake_outer_composite_serialize()
Test serialization of object with outer number type
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import outer_composite
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
outer_composite_outer_composite = outer_composite.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_composite_serialize(outer_composite_outer_composite=outer_composite_outer_composite)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**outer_composite_outer_composite** | [**outer_composite.OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
### Return type
[**outer_composite.OuterComposite**](OuterComposite.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output composite | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_number_serialize**
> float fake_outer_number_serialize()
# **number_with_validations**
> number_with_validations.NumberWithValidations number_with_validations()
@@ -221,6 +349,7 @@ from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import number_with_validations
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
@@ -233,26 +362,26 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = 3.4 # float | Input number as post body (optional)
body = number_with_validations.NumberWithValidations(3.4) # number_with_validations.NumberWithValidations | Input number as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_number_serialize(body=body)
api_response = api_instance.number_with_validations(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
print("Exception when calling FakeApi->number_with_validations: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **float**| Input number as post body | [optional]
**body** | [**number_with_validations.NumberWithValidations**](NumberWithValidations.md)| Input number as post body | [optional]
### Return type
**float**
[**number_with_validations.NumberWithValidations**](NumberWithValidations.md)
### Authorization
@@ -261,7 +390,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: */*
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
@@ -270,8 +399,72 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_string_serialize**
> str fake_outer_string_serialize()
# **object_model_with_ref_props**
> object_model_with_ref_props.ObjectModelWithRefProps object_model_with_ref_props()
Test serialization of object with $refed properties
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import object_model_with_ref_props
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = object_model_with_ref_props.ObjectModelWithRefProps() # object_model_with_ref_props.ObjectModelWithRefProps | Input model (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.object_model_with_ref_props(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->object_model_with_ref_props: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**object_model_with_ref_props.ObjectModelWithRefProps**](ObjectModelWithRefProps.md)| Input model | [optional]
### Return type
[**object_model_with_ref_props.ObjectModelWithRefProps**](ObjectModelWithRefProps.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output model | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **string**
> str string()
@@ -301,10 +494,10 @@ with petstore_api.ApiClient() as api_client:
# example passing only required values which don't have defaults set
# and optional values
try:
api_response = api_instance.fake_outer_string_serialize(body=body)
api_response = api_instance.string(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
print("Exception when calling FakeApi->string: %s\n" % e)
```
### Parameters
@@ -324,7 +517,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: */*
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
@@ -333,10 +526,12 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_additional_properties_with_array_of_enums**
> additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums get_additional_properties_with_array_of_enums()
# **string_enum**
> string_enum.StringEnum string_enum()
Additional Properties with Array of Enums
Test serialization of outer enum
### Example
@@ -345,7 +540,7 @@ from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import additional_properties_with_array_of_enums
from petstore_api.model import string_enum
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
@@ -358,22 +553,26 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = string_enum.StringEnum("placed") # string_enum.StringEnum | Input enum (optional)
# example, this endpoint has no required or optional parameters
# example passing only required values which don't have defaults set
# and optional values
try:
# Additional Properties with Array of Enums
api_response = api_instance.get_additional_properties_with_array_of_enums()
api_response = api_instance.string_enum(body=body)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->get_additional_properties_with_array_of_enums: %s\n" % e)
print("Exception when calling FakeApi->string_enum: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**string_enum.StringEnum**](StringEnum.md)| Input enum | [optional]
### Return type
[**additional_properties_with_array_of_enums.AdditionalPropertiesWithArrayOfEnums**](AdditionalPropertiesWithArrayOfEnums.md)
[**string_enum.StringEnum**](StringEnum.md)
### Authorization
@@ -381,71 +580,13 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Got object with additional properties with array of enums | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_array_of_enums**
> array_of_enums.ArrayOfEnums get_array_of_enums()
Array of Enums
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import array_of_enums
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
# example, this endpoint has no required or optional parameters
try:
# Array of Enums
api_response = api_instance.get_array_of_enums()
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->get_array_of_enums: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**array_of_enums.ArrayOfEnums**](ArrayOfEnums.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Got named array of enums | - |
**200** | Output enum | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -1,4 +1,4 @@
# outer_enum_integer.OuterEnumInteger
# integer_enum.IntegerEnum
## Properties
Name | Type | Description | Notes

View File

@@ -1,4 +1,4 @@
# outer_enum_integer_default_value.OuterEnumIntegerDefaultValue
# integer_enum_one_value.IntegerEnumOneValue
## Properties
Name | Type | Description | Notes

View File

@@ -0,0 +1,10 @@
# integer_enum_with_default_value.IntegerEnumWithDefaultValue
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **int** | | defaults to 0
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# number_with_validations.NumberWithValidations
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **float** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,9 +1,10 @@
# outer_composite.OuterComposite
# object_model_with_ref_props.ObjectModelWithRefProps
a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**my_number** | **float** | | [optional]
**my_number** | [**number_with_validations.NumberWithValidations**](NumberWithValidations.md) | | [optional]
**my_string** | **str** | | [optional]
**my_boolean** | **bool** | | [optional]

View File

@@ -1,4 +1,4 @@
# outer_enum.OuterEnum
# string_enum.StringEnum
## Properties
Name | Type | Description | Notes

View File

@@ -1,4 +1,4 @@
# outer_enum_default_value.OuterEnumDefaultValue
# string_enum_with_default_value.StringEnumWithDefaultValue
## Properties
Name | Type | Description | Notes

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.model import outer_enum
from petstore_api.model import string_enum
except ImportError:
outer_enum = sys.modules[
'petstore_api.model.outer_enum']
string_enum = sys.modules[
'petstore_api.model.string_enum']
class ArrayOfEnums(ModelSimple):
@@ -81,7 +81,7 @@ class ArrayOfEnums(ModelSimple):
and the value is attribute type.
"""
return {
'value': ([outer_enum.OuterEnum, none_type],), # noqa: E501
'value': ([string_enum.StringEnum, none_type],), # noqa: E501
}
@cached_property
@@ -106,7 +106,7 @@ class ArrayOfEnums(ModelSimple):
"""array_of_enums.ArrayOfEnums - a model defined in OpenAPI
Args:
value ([outer_enum.OuterEnum, none_type]):
value ([string_enum.StringEnum, none_type]):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types

View File

@@ -34,25 +34,30 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.model import outer_enum
from petstore_api.model import integer_enum
except ImportError:
outer_enum = sys.modules[
'petstore_api.model.outer_enum']
integer_enum = sys.modules[
'petstore_api.model.integer_enum']
try:
from petstore_api.model import outer_enum_default_value
from petstore_api.model import integer_enum_one_value
except ImportError:
outer_enum_default_value = sys.modules[
'petstore_api.model.outer_enum_default_value']
integer_enum_one_value = sys.modules[
'petstore_api.model.integer_enum_one_value']
try:
from petstore_api.model import outer_enum_integer
from petstore_api.model import integer_enum_with_default_value
except ImportError:
outer_enum_integer = sys.modules[
'petstore_api.model.outer_enum_integer']
integer_enum_with_default_value = sys.modules[
'petstore_api.model.integer_enum_with_default_value']
try:
from petstore_api.model import outer_enum_integer_default_value
from petstore_api.model import string_enum
except ImportError:
outer_enum_integer_default_value = sys.modules[
'petstore_api.model.outer_enum_integer_default_value']
string_enum = sys.modules[
'petstore_api.model.string_enum']
try:
from petstore_api.model import string_enum_with_default_value
except ImportError:
string_enum_with_default_value = sys.modules[
'petstore_api.model.string_enum_with_default_value']
class EnumTest(ModelNormal):
@@ -122,10 +127,11 @@ class EnumTest(ModelNormal):
'enum_string': (str,), # noqa: E501
'enum_integer': (int,), # noqa: E501
'enum_number': (float,), # noqa: E501
'outer_enum': (outer_enum.OuterEnum,), # noqa: E501
'outer_enum_integer': (outer_enum_integer.OuterEnumInteger,), # noqa: E501
'outer_enum_default_value': (outer_enum_default_value.OuterEnumDefaultValue,), # noqa: E501
'outer_enum_integer_default_value': (outer_enum_integer_default_value.OuterEnumIntegerDefaultValue,), # noqa: E501
'string_enum': (string_enum.StringEnum,), # noqa: E501
'integer_enum': (integer_enum.IntegerEnum,), # noqa: E501
'string_enum_with_default_value': (string_enum_with_default_value.StringEnumWithDefaultValue,), # noqa: E501
'integer_enum_with_default_value': (integer_enum_with_default_value.IntegerEnumWithDefaultValue,), # noqa: E501
'integer_enum_one_value': (integer_enum_one_value.IntegerEnumOneValue,), # noqa: E501
}
@cached_property
@@ -137,10 +143,11 @@ class EnumTest(ModelNormal):
'enum_string': 'enum_string', # noqa: E501
'enum_integer': 'enum_integer', # noqa: E501
'enum_number': 'enum_number', # noqa: E501
'outer_enum': 'outerEnum', # noqa: E501
'outer_enum_integer': 'outerEnumInteger', # noqa: E501
'outer_enum_default_value': 'outerEnumDefaultValue', # noqa: E501
'outer_enum_integer_default_value': 'outerEnumIntegerDefaultValue', # noqa: E501
'string_enum': 'stringEnum', # noqa: E501
'integer_enum': 'IntegerEnum', # noqa: E501
'string_enum_with_default_value': 'StringEnumWithDefaultValue', # noqa: E501
'integer_enum_with_default_value': 'IntegerEnumWithDefaultValue', # noqa: E501
'integer_enum_one_value': 'IntegerEnumOneValue', # noqa: E501
}
_composed_schemas = {}
@@ -195,10 +202,11 @@ class EnumTest(ModelNormal):
enum_string (str): [optional] # noqa: E501
enum_integer (int): [optional] # noqa: E501
enum_number (float): [optional] # noqa: E501
outer_enum (outer_enum.OuterEnum): [optional] # noqa: E501
outer_enum_integer (outer_enum_integer.OuterEnumInteger): [optional] # noqa: E501
outer_enum_default_value (outer_enum_default_value.OuterEnumDefaultValue): [optional] # noqa: E501
outer_enum_integer_default_value (outer_enum_integer_default_value.OuterEnumIntegerDefaultValue): [optional] # noqa: E501
string_enum (string_enum.StringEnum): [optional] # noqa: E501
integer_enum (integer_enum.IntegerEnum): [optional] # noqa: E501
string_enum_with_default_value (string_enum_with_default_value.StringEnumWithDefaultValue): [optional] # noqa: E501
integer_enum_with_default_value (integer_enum_with_default_value.IntegerEnumWithDefaultValue): [optional] # noqa: E501
integer_enum_one_value (integer_enum_one_value.IntegerEnumOneValue): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -35,7 +35,7 @@ from petstore_api.model_utils import ( # noqa: F401
)
class OuterEnumInteger(ModelSimple):
class IntegerEnum(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -103,7 +103,7 @@ class OuterEnumInteger(ModelSimple):
@convert_js_args_to_python_args
def __init__(self, value, *args, **kwargs): # noqa: E501
"""outer_enum_integer.OuterEnumInteger - a model defined in OpenAPI
"""integer_enum.IntegerEnum - a model defined in OpenAPI
Args:
value (int):

View File

@@ -0,0 +1,174 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
import sys # noqa: F401
import six # noqa: F401
import nulltype # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
int,
none_type,
str,
validate_get_composed_info,
)
class IntegerEnumOneValue(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
('value',): {
'0': 0,
},
}
validations = {
}
additional_properties_type = None
_nullable = False
@cached_property
def openapi_types():
"""
This must be a class method so a model may have properties that are
of type self, this ensures that we don't create a cyclic import
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'value': (int,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {}
_composed_schemas = None
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""integer_enum_one_value.IntegerEnumOneValue - a model defined in OpenAPI
Args:
Keyword Args:
value (int): defaults to 0, must be one of [0, ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
"""
value = kwargs.get('value', 0)
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
self.value = value
for var_name, var_value in six.iteritems(kwargs):
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)

View File

@@ -35,7 +35,7 @@ from petstore_api.model_utils import ( # noqa: F401
)
class OuterEnumIntegerDefaultValue(ModelSimple):
class IntegerEnumWithDefaultValue(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -103,7 +103,7 @@ class OuterEnumIntegerDefaultValue(ModelSimple):
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""outer_enum_integer_default_value.OuterEnumIntegerDefaultValue - a model defined in OpenAPI
"""integer_enum_with_default_value.IntegerEnumWithDefaultValue - a model defined in OpenAPI
Args:

View File

@@ -0,0 +1,174 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
import sys # noqa: F401
import six # noqa: F401
import nulltype # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
int,
none_type,
str,
validate_get_composed_info,
)
class NumberWithValidations(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
('value',): {
'inclusive_maximum': 20,
'inclusive_minimum': 10,
},
}
additional_properties_type = None
_nullable = False
@cached_property
def openapi_types():
"""
This must be a class method so a model may have properties that are
of type self, this ensures that we don't create a cyclic import
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'value': (float,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {}
_composed_schemas = None
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, value, *args, **kwargs): # noqa: E501
"""number_with_validations.NumberWithValidations - a model defined in OpenAPI
Args:
value (float):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
self.value = value
for var_name, var_value in six.iteritems(kwargs):
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)

View File

@@ -33,9 +33,14 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_get_composed_info,
)
try:
from petstore_api.model import number_with_validations
except ImportError:
number_with_validations = sys.modules[
'petstore_api.model.number_with_validations']
class OuterComposite(ModelNormal):
class ObjectModelWithRefProps(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -80,7 +85,7 @@ class OuterComposite(ModelNormal):
and the value is attribute type.
"""
return {
'my_number': (float,), # noqa: E501
'my_number': (number_with_validations.NumberWithValidations,), # noqa: E501
'my_string': (str,), # noqa: E501
'my_boolean': (bool,), # noqa: E501
}
@@ -108,7 +113,7 @@ class OuterComposite(ModelNormal):
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""outer_composite.OuterComposite - a model defined in OpenAPI
"""object_model_with_ref_props.ObjectModelWithRefProps - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
@@ -141,7 +146,7 @@ class OuterComposite(ModelNormal):
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
my_number (float): [optional] # noqa: E501
my_number (number_with_validations.NumberWithValidations): [optional] # noqa: E501
my_string (str): [optional] # noqa: E501
my_boolean (bool): [optional] # noqa: E501
"""

View File

@@ -35,7 +35,7 @@ from petstore_api.model_utils import ( # noqa: F401
)
class OuterEnum(ModelSimple):
class StringEnum(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -104,7 +104,7 @@ class OuterEnum(ModelSimple):
@convert_js_args_to_python_args
def __init__(self, value, *args, **kwargs): # noqa: E501
"""outer_enum.OuterEnum - a model defined in OpenAPI
"""string_enum.StringEnum - a model defined in OpenAPI
Args:
value (str, none_type):

View File

@@ -35,7 +35,7 @@ from petstore_api.model_utils import ( # noqa: F401
)
class OuterEnumDefaultValue(ModelSimple):
class StringEnumWithDefaultValue(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
@@ -103,7 +103,7 @@ class OuterEnumDefaultValue(ModelSimple):
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""outer_enum_default_value.OuterEnumDefaultValue - a model defined in OpenAPI
"""string_enum_with_default_value.StringEnumWithDefaultValue - a model defined in OpenAPI
Args:

View File

@@ -60,6 +60,9 @@ from petstore_api.model.inline_object3 import InlineObject3
from petstore_api.model.inline_object4 import InlineObject4
from petstore_api.model.inline_object5 import InlineObject5
from petstore_api.model.inline_response_default import InlineResponseDefault
from petstore_api.model.integer_enum import IntegerEnum
from petstore_api.model.integer_enum_one_value import IntegerEnumOneValue
from petstore_api.model.integer_enum_with_default_value import IntegerEnumWithDefaultValue
from petstore_api.model.isosceles_triangle import IsoscelesTriangle
from petstore_api.model.list import List
from petstore_api.model.mammal import Mammal
@@ -71,12 +74,9 @@ from petstore_api.model.name import Name
from petstore_api.model.nullable_class import NullableClass
from petstore_api.model.nullable_shape import NullableShape
from petstore_api.model.number_only import NumberOnly
from petstore_api.model.number_with_validations import NumberWithValidations
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
from petstore_api.model.order import Order
from petstore_api.model.outer_composite import OuterComposite
from petstore_api.model.outer_enum import OuterEnum
from petstore_api.model.outer_enum_default_value import OuterEnumDefaultValue
from petstore_api.model.outer_enum_integer import OuterEnumInteger
from petstore_api.model.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue
from petstore_api.model.parent_pet import ParentPet
from petstore_api.model.pet import Pet
from petstore_api.model.pig import Pig
@@ -90,6 +90,8 @@ from petstore_api.model.shape_or_null import ShapeOrNull
from petstore_api.model.simple_quadrilateral import SimpleQuadrilateral
from petstore_api.model.special_model_name import SpecialModelName
from petstore_api.model.string_boolean_map import StringBooleanMap
from petstore_api.model.string_enum import StringEnum
from petstore_api.model.string_enum_with_default_value import StringEnumWithDefaultValue
from petstore_api.model.tag import Tag
from petstore_api.model.triangle import Triangle
from petstore_api.model.triangle_interface import TriangleInterface

View File

@@ -16,10 +16,10 @@ import unittest
import petstore_api
try:
from petstore_api.model import outer_enum
from petstore_api.model import string_enum
except ImportError:
outer_enum = sys.modules[
'petstore_api.model.outer_enum']
string_enum = sys.modules[
'petstore_api.model.string_enum']
from petstore_api.model.array_of_enums import ArrayOfEnums

View File

@@ -16,25 +16,30 @@ import unittest
import petstore_api
try:
from petstore_api.model import outer_enum
from petstore_api.model import integer_enum
except ImportError:
outer_enum = sys.modules[
'petstore_api.model.outer_enum']
integer_enum = sys.modules[
'petstore_api.model.integer_enum']
try:
from petstore_api.model import outer_enum_default_value
from petstore_api.model import integer_enum_one_value
except ImportError:
outer_enum_default_value = sys.modules[
'petstore_api.model.outer_enum_default_value']
integer_enum_one_value = sys.modules[
'petstore_api.model.integer_enum_one_value']
try:
from petstore_api.model import outer_enum_integer
from petstore_api.model import integer_enum_with_default_value
except ImportError:
outer_enum_integer = sys.modules[
'petstore_api.model.outer_enum_integer']
integer_enum_with_default_value = sys.modules[
'petstore_api.model.integer_enum_with_default_value']
try:
from petstore_api.model import outer_enum_integer_default_value
from petstore_api.model import string_enum
except ImportError:
outer_enum_integer_default_value = sys.modules[
'petstore_api.model.outer_enum_integer_default_value']
string_enum = sys.modules[
'petstore_api.model.string_enum']
try:
from petstore_api.model import string_enum_with_default_value
except ImportError:
string_enum_with_default_value = sys.modules[
'petstore_api.model.string_enum_with_default_value']
from petstore_api.model.enum_test import EnumTest

View File

@@ -9,13 +9,32 @@
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
from collections import namedtuple
import unittest
import json
import six
if six.PY3:
from unittest.mock import patch
else:
from mock import patch
import petstore_api
from petstore_api.api.fake_api import FakeApi # noqa: E501
from petstore_api.rest import RESTClientObject, RESTResponse
HTTPResponse = namedtuple(
'urllib3_response_HTTPResponse',
['status', 'reason', 'data', 'getheaders', 'getheader']
)
headers = {'Content-Type': 'application/json'}
def get_headers():
return {}
def get_header(name, default=None):
return {}.get(name, default)
class TestFakeApi(unittest.TestCase):
@@ -27,6 +46,65 @@ class TestFakeApi(unittest.TestCase):
def tearDown(self):
pass
@staticmethod
def mock_response(body_value):
http_response = HTTPResponse(
status=200,
reason='OK',
data=json.dumps(body_value).encode('utf-8'),
getheaders=get_headers,
getheader=get_header
)
return RESTResponse(http_response)
@staticmethod
def assert_request_called_with(mock_method, url, value):
mock_method.assert_called_with(
'POST',
url,
_preload_content=True,
_request_timeout=None,
body=value,
headers={
'Accept': 'application/json',
'User-Agent': 'OpenAPI-Generator/1.0.0/python',
'Content-Type': 'application/json'
},
post_params=[],
query_params=[]
)
def test_array_model(self):
"""Test case for array_model
"""
from petstore_api.model import animal_farm, animal
endpoint = self.api.array_model
assert endpoint.openapi_types['body'] == (animal_farm.AnimalFarm,)
assert endpoint.settings['response_type'] == (animal_farm.AnimalFarm,)
# serialization + deserialization works
with patch.object(RESTClientObject, 'request') as mock_method:
cat = animal.Animal(class_name="Cat", color="black")
body = animal_farm.AnimalFarm([cat])
json_data = [{"className": "Cat", "color": "black"}]
mock_method.return_value = self.mock_response(json_data)
response = endpoint(body=body)
self.assert_request_called_with(mock_method, 'http://petstore.swagger.io:80/v2/fake/refs/arraymodel', json_data)
assert isinstance(response, animal_farm.AnimalFarm)
assert response == body
def test_boolean(self):
"""Test case for boolean
"""
endpoint = self.api.boolean
assert endpoint.openapi_types['body'] == (bool,)
assert endpoint.settings['response_type'] == (bool,)
def test_fake_health_get(self):
"""Test case for fake_health_get
@@ -34,29 +112,109 @@ class TestFakeApi(unittest.TestCase):
"""
pass
def test_fake_outer_boolean_serialize(self):
"""Test case for fake_outer_boolean_serialize
def test_additional_properties_with_array_of_enums(self):
"""Test case for additional_properties_with_array_of_enums
Additional Properties with Array of Enums # noqa: E501
"""
pass
def test_fake_outer_composite_serialize(self):
"""Test case for fake_outer_composite_serialize
def test_array_of_enums(self):
"""Test case for array_of_enums
Array of Enums # noqa: E501
"""
from petstore_api.model import array_of_enums, string_enum
endpoint = self.api.array_of_enums
assert endpoint.openapi_types['array_of_enums_array_of_enums'] == (array_of_enums.ArrayOfEnums,)
assert endpoint.settings['response_type'] == (array_of_enums.ArrayOfEnums,)
# serialization + deserialization works
with patch.object(RESTClientObject, 'request') as mock_method:
value = [string_enum.StringEnum("placed")]
body = array_of_enums.ArrayOfEnums(value)
value_simple = ["placed"]
mock_method.return_value = self.mock_response(value_simple)
response = endpoint(array_of_enums_array_of_enums=body)
self.assert_request_called_with(mock_method, 'http://petstore.swagger.io:80/v2/fake/refs/array-of-enums', value_simple)
assert isinstance(response, array_of_enums.ArrayOfEnums)
assert response.value == value
def test_number_with_validations(self):
"""Test case for number_with_validations
"""
pass
from petstore_api.model import number_with_validations
endpoint = self.api.number_with_validations
assert endpoint.openapi_types['body'] == (number_with_validations.NumberWithValidations,)
assert endpoint.settings['response_type'] == (number_with_validations.NumberWithValidations,)
def test_fake_outer_number_serialize(self):
"""Test case for fake_outer_number_serialize
# serialization + deserialization works
with patch.object(RESTClientObject, 'request') as mock_method:
value = 10.0
body = number_with_validations.NumberWithValidations(value)
mock_method.return_value = self.mock_response(value)
response = endpoint(body=body)
self.assert_request_called_with(mock_method, 'http://petstore.swagger.io:80/v2/fake/refs/number', value)
assert isinstance(response, number_with_validations.NumberWithValidations)
assert response.value == value
def test_object_model_with_ref_props(self):
"""Test case for object_model_with_ref_props
"""
pass
from petstore_api.model import object_model_with_ref_props
endpoint = self.api.object_model_with_ref_props
assert endpoint.openapi_types['body'] == (object_model_with_ref_props.ObjectModelWithRefProps,)
assert endpoint.settings['response_type'] == (object_model_with_ref_props.ObjectModelWithRefProps,)
def test_fake_outer_string_serialize(self):
"""Test case for fake_outer_string_serialize
def test_string(self):
"""Test case for string
"""
pass
from petstore_api.model_utils import str
endpoint = self.api.string
assert endpoint.openapi_types['body'] == (str,)
assert endpoint.settings['response_type'] == (str,)
# serialization + deserialization works
with patch.object(RESTClientObject, 'request') as mock_method:
body = "blah"
value_simple = body
mock_method.return_value = self.mock_response(value_simple)
response = endpoint(body=body)
self.assert_request_called_with(mock_method, 'http://petstore.swagger.io:80/v2/fake/refs/string', value_simple)
assert isinstance(response, str)
assert response == value_simple
def test_string_enum(self):
"""Test case for string_enum
"""
from petstore_api.model import string_enum
endpoint = self.api.string_enum
assert endpoint.openapi_types['body'] == (string_enum.StringEnum,)
assert endpoint.settings['response_type'] == (string_enum.StringEnum,)
# serialization + deserialization works
from petstore_api.rest import RESTClientObject, RESTResponse
with patch.object(RESTClientObject, 'request') as mock_method:
value = "placed"
body = string_enum.StringEnum(value)
mock_method.return_value = self.mock_response(value)
response = endpoint(body=body)
self.assert_request_called_with(mock_method, 'http://petstore.swagger.io:80/v2/fake/refs/enum', value)
assert isinstance(response, string_enum.StringEnum)
assert response.value == value
def test_test_body_with_file_schema(self):
"""Test case for test_body_with_file_schema

View File

@@ -176,5 +176,9 @@ class TestFruitReq(unittest.TestCase):
fruit._additional_properties_model_instances, []
)
# we can pass in None
fruit = FruitReq(None)
assert fruit is None
if __name__ == '__main__':
unittest.main()

View File

@@ -15,11 +15,11 @@ import sys
import unittest
import petstore_api
from petstore_api.model.outer_number import OuterNumber
from petstore_api.model.integer_enum import IntegerEnum
class TestOuterNumber(unittest.TestCase):
"""OuterNumber unit test stubs"""
class TestIntegerEnum(unittest.TestCase):
"""IntegerEnum unit test stubs"""
def setUp(self):
pass
@@ -27,10 +27,10 @@ class TestOuterNumber(unittest.TestCase):
def tearDown(self):
pass
def testOuterNumber(self):
"""Test OuterNumber"""
def testIntegerEnum(self):
"""Test IntegerEnum"""
# FIXME: construct object with mandatory attributes with example values
# model = OuterNumber() # noqa: E501
# model = IntegerEnum() # noqa: E501
pass

View File

@@ -15,16 +15,11 @@ import sys
import unittest
import petstore_api
try:
from petstore_api.model import outer_number
except ImportError:
outer_number = sys.modules[
'petstore_api.model.outer_number']
from petstore_api.model.outer_composite import OuterComposite
from petstore_api.model.integer_enum_one_value import IntegerEnumOneValue
class TestOuterComposite(unittest.TestCase):
"""OuterComposite unit test stubs"""
class TestIntegerEnumOneValue(unittest.TestCase):
"""IntegerEnumOneValue unit test stubs"""
def setUp(self):
pass
@@ -32,11 +27,13 @@ class TestOuterComposite(unittest.TestCase):
def tearDown(self):
pass
def testOuterComposite(self):
"""Test OuterComposite"""
# FIXME: construct object with mandatory attributes with example values
# model = OuterComposite() # noqa: E501
pass
def testIntegerEnumOneValue(self):
"""Test IntegerEnumOneValue"""
model = IntegerEnumOneValue()
assert model.value == 0, "With only one option, the value is assigned automatically"
model = IntegerEnumOneValue(value=0)
assert model.value == 0, "We can also pass in the value as a named argument"
if __name__ == '__main__':

View File

@@ -15,11 +15,11 @@ import sys
import unittest
import petstore_api
from petstore_api.model.outer_enum_default_value import OuterEnumDefaultValue
from petstore_api.model.integer_enum_with_default_value import IntegerEnumWithDefaultValue
class TestOuterEnumDefaultValue(unittest.TestCase):
"""OuterEnumDefaultValue unit test stubs"""
class TestIntegerEnumWithDefaultValue(unittest.TestCase):
"""IntegerEnumWithDefaultValue unit test stubs"""
def setUp(self):
pass
@@ -27,10 +27,10 @@ class TestOuterEnumDefaultValue(unittest.TestCase):
def tearDown(self):
pass
def testOuterEnumDefaultValue(self):
"""Test OuterEnumDefaultValue"""
def testIntegerEnumWithDefaultValue(self):
"""Test IntegerEnumWithDefaultValue"""
# FIXME: construct object with mandatory attributes with example values
# model = OuterEnumDefaultValue() # noqa: E501
# model = IntegerEnumWithDefaultValue() # noqa: E501
pass

View File

@@ -0,0 +1,44 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.model.number_with_validations import NumberWithValidations
class TestNumberWithValidations(unittest.TestCase):
"""NumberWithValidations unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testNumberWithValidations(self):
"""Test NumberWithValidations"""
valid_values = [10.0, 15.0, 20.0]
for valid_value in valid_values:
model = NumberWithValidations(valid_value)
assert model.value == valid_value
invalid_values = [9.0, 21.0]
for invalid_value in invalid_values:
with self.assertRaises(petstore_api.ApiValueError):
NumberWithValidations(invalid_value)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,49 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
try:
from petstore_api.model import number_with_validations
except ImportError:
number_with_validations = sys.modules[
'petstore_api.model.number_with_validations']
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
class TestObjectModelWithRefProps(unittest.TestCase):
"""ObjectModelWithRefProps unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testObjectModelWithRefProps(self):
"""Test ObjectModelWithRefProps"""
from petstore_api.model.object_model_with_ref_props import str, number_with_validations
self.assertEqual(
ObjectModelWithRefProps.openapi_types,
{
'my_number': (number_with_validations.NumberWithValidations,),
'my_string': (str,),
'my_boolean': (bool,),
}
)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,38 +0,0 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.model.outer_composite import OuterComposite
class TestOuterComposite(unittest.TestCase):
"""OuterComposite unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testOuterComposite(self):
"""Test OuterComposite"""
# FIXME: construct object with mandatory attributes with example values
# model = OuterComposite() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -1,38 +0,0 @@
# 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: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.model.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue
class TestOuterEnumIntegerDefaultValue(unittest.TestCase):
"""OuterEnumIntegerDefaultValue unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testOuterEnumIntegerDefaultValue(self):
"""Test OuterEnumIntegerDefaultValue"""
# FIXME: construct object with mandatory attributes with example values
# model = OuterEnumIntegerDefaultValue() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -15,11 +15,11 @@ import sys
import unittest
import petstore_api
from petstore_api.model.outer_enum import OuterEnum
from petstore_api.model.string_enum import StringEnum
class TestOuterEnum(unittest.TestCase):
"""OuterEnum unit test stubs"""
class TestStringEnum(unittest.TestCase):
"""StringEnum unit test stubs"""
def setUp(self):
pass
@@ -27,18 +27,24 @@ class TestOuterEnum(unittest.TestCase):
def tearDown(self):
pass
def testOuterEnum(self):
"""Test OuterEnum"""
# Since 'OuterEnum' is nullable, validate the null value can be assigned
# to OuterEnum.
inst = OuterEnum(None)
def testStringEnum(self):
"""Test StringEnum"""
inst = StringEnum(None)
self.assertIsNone(inst)
inst = OuterEnum('approved')
assert isinstance(inst, OuterEnum)
inst = StringEnum('approved')
assert isinstance(inst, StringEnum)
with self.assertRaises(petstore_api.ApiValueError):
OuterEnum('garbage')
StringEnum('garbage')
# make sure that we can access its allowed_values
assert StringEnum.allowed_values[('value',)] == {
'None': None,
'PLACED': "placed",
'APPROVED': "approved",
'DELIVERED': "delivered"
}
if __name__ == '__main__':

View File

@@ -15,11 +15,11 @@ import sys
import unittest
import petstore_api
from petstore_api.model.outer_enum_integer import OuterEnumInteger
from petstore_api.model.string_enum_with_default_value import StringEnumWithDefaultValue
class TestOuterEnumInteger(unittest.TestCase):
"""OuterEnumInteger unit test stubs"""
class TestStringEnumWithDefaultValue(unittest.TestCase):
"""StringEnumWithDefaultValue unit test stubs"""
def setUp(self):
pass
@@ -27,10 +27,10 @@ class TestOuterEnumInteger(unittest.TestCase):
def tearDown(self):
pass
def testOuterEnumInteger(self):
"""Test OuterEnumInteger"""
def testStringEnumWithDefaultValue(self):
"""Test StringEnumWithDefaultValue"""
# FIXME: construct object with mandatory attributes with example values
# model = OuterEnumInteger() # noqa: E501
# model = StringEnumWithDefaultValue() # noqa: E501
pass

View File

@@ -25,7 +25,7 @@ import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import array_of_enums
from petstore_api.model import format_test
from petstore_api.model import outer_enum
from petstore_api.model import string_enum
import petstore_api.configuration
HOST = 'http://petstore.swagger.io/v2'
@@ -74,7 +74,7 @@ class ApiClientTests(unittest.TestCase):
response = MockResponse(data=json.dumps(data))
deserialized = self.api_client.deserialize(response, (array_of_enums.ArrayOfEnums, ), True)
assert isinstance(deserialized, array_of_enums.ArrayOfEnums)
assert array_of_enums.ArrayOfEnums([outer_enum.OuterEnum(v) for v in data]) == deserialized
assert array_of_enums.ArrayOfEnums([string_enum.StringEnum(v) for v in data]) == deserialized
def checkRaiseRegex(self, expected_exception, expected_regex):
if sys.version_info < (3, 0):

View File

@@ -29,6 +29,7 @@ from petstore_api.model import (
fruit_req,
drawing,
banana_req,
number_with_validations,
)
@@ -301,3 +302,29 @@ class DeserializationTests(unittest.TestCase):
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, (drawing.Drawing,), True)
def test_deserialize_NumberWithValidations(self):
""" deserialize NumberWithValidations """
# make sure that an exception is thrown on an invalid type value
with self.assertRaises(petstore_api.ApiTypeError):
self.deserialize(
MockResponse(data=json.dumps("test str")),
(number_with_validations.NumberWithValidations,),
True
)
# make sure that an exception is thrown on an invalid value
with self.assertRaises(petstore_api.ApiValueError):
self.deserialize(
MockResponse(data=json.dumps(21.0)),
(number_with_validations.NumberWithValidations,),
True
)
# valid value works
number_val = 11.0
response = MockResponse(data=json.dumps(number_val))
number = self.deserialize(response,
(number_with_validations.NumberWithValidations,), True)
self.assertTrue(isinstance(number, number_with_validations.NumberWithValidations))
self.assertTrue(number.value == number_val)