mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-18 21:47:04 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# outer_number.OuterNumber
|
||||
# number_with_validations.NumberWithValidations
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
@@ -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]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# outer_enum.OuterEnum
|
||||
# string_enum.StringEnum
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
@@ -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
|
||||
"""
|
||||
@@ -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):
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
@@ -1,43 +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
|
||||
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
|
||||
|
||||
|
||||
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()
|
||||
@@ -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_number import OuterNumber
|
||||
|
||||
|
||||
class TestOuterNumber(unittest.TestCase):
|
||||
"""OuterNumber unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testOuterNumber(self):
|
||||
"""Test OuterNumber"""
|
||||
# FIXME: construct object with mandatory attributes with example values
|
||||
# model = OuterNumber() # noqa: E501
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -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__':
|
||||
@@ -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):
|
||||
|
||||
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user