Merge remote-tracking branch 'origin/master' into 6.0.x

This commit is contained in:
William Cheng
2021-09-01 14:16:17 +08:00
3893 changed files with 67761 additions and 15499 deletions

View File

@@ -59,6 +59,7 @@ docs/IntegerEnum.md
docs/IntegerEnumOneValue.md
docs/IntegerEnumWithDefaultValue.md
docs/IsoscelesTriangle.md
docs/Legs.md
docs/List.md
docs/Mammal.md
docs/MapTest.md
@@ -170,6 +171,7 @@ petstore_api/model/integer_enum.py
petstore_api/model/integer_enum_one_value.py
petstore_api/model/integer_enum_with_default_value.py
petstore_api/model/isosceles_triangle.py
petstore_api/model/legs.py
petstore_api/model/list.py
petstore_api/model/mammal.py
petstore_api/model/map_test.py

View File

@@ -106,7 +106,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
*FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-paramters |
*FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters |
*FakeApi* | [**upload_download_file**](docs/FakeApi.md#upload_download_file) | **POST** /fake/uploadDownloadFile | uploads a file and downloads a file using application/octet-stream
*FakeApi* | [**upload_file**](docs/FakeApi.md#upload_file) | **POST** /fake/uploadFile | uploads a file using multipart/form-data
*FakeApi* | [**upload_files**](docs/FakeApi.md#upload_files) | **POST** /fake/uploadFiles | uploads files using multipart/form-data
@@ -187,6 +187,7 @@ Class | Method | HTTP request | Description
- [IntegerEnumOneValue](docs/IntegerEnumOneValue.md)
- [IntegerEnumWithDefaultValue](docs/IntegerEnumWithDefaultValue.md)
- [IsoscelesTriangle](docs/IsoscelesTriangle.md)
- [Legs](docs/Legs.md)
- [List](docs/List.md)
- [Mammal](docs/Mammal.md)
- [MapTest](docs/MapTest.md)

View File

@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**tail** | **bool** | | [optional] [readonly] if omitted the server will use the default value of True
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[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

@@ -16,6 +16,7 @@ To test special tags and operation ID starting with number
### Example
```python
import time
import petstore_api
@@ -68,6 +69,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |

View File

@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**class_name** | **str** | |
**declawed** | **bool** | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**tail** | **bool** | | [optional] [readonly] if omitted the server will use the default value of True
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[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

@@ -6,6 +6,7 @@ this is a model that allows payloads of type object or number
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**tail** | **bool** | | [optional] [readonly] if omitted the server will use the default value of True
**class_name** | **str** | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

View File

@@ -14,6 +14,7 @@ Method | HTTP request | Description
### Example
```python
import time
import petstore_api
@@ -59,6 +60,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**0** | response | - |

View File

@@ -6,7 +6,9 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**breed** | **str** | | [optional]
**legs** | [**Legs**](Legs.md) | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**tail** | **bool** | | [optional] [readonly] if omitted the server will use the default value of True
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[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

@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **str** | | [optional]
**legs** | [**Legs**](Legs.md) | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -27,7 +27,7 @@ Method | HTTP request | Description
[**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
[**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-paramters |
[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters |
[**upload_download_file**](FakeApi.md#upload_download_file) | **POST** /fake/uploadDownloadFile | uploads a file and downloads a file using application/octet-stream
[**upload_file**](FakeApi.md#upload_file) | **POST** /fake/uploadFile | uploads a file using multipart/form-data
[**upload_files**](FakeApi.md#upload_files) | **POST** /fake/uploadFiles | uploads files using multipart/form-data
@@ -40,6 +40,7 @@ Additional Properties with Array of Enums
### Example
```python
import time
import petstore_api
@@ -95,6 +96,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Got object with additional properties with array of enums | - |
@@ -110,6 +112,7 @@ Test serialization of ArrayModel
### Example
```python
import time
import petstore_api
@@ -162,6 +165,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output model | - |
@@ -175,6 +179,7 @@ Array of Enums
### Example
```python
import time
import petstore_api
@@ -228,6 +233,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Got named array of enums | - |
@@ -243,6 +249,7 @@ Test serialization of outer boolean types
### Example
```python
import time
import petstore_api
@@ -292,6 +299,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output boolean | - |
@@ -307,6 +315,7 @@ Test serialization of object with $refed properties
### Example
```python
import time
import petstore_api
@@ -357,6 +366,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output model | - |
@@ -370,6 +380,7 @@ downloads a file using Content-Disposition
### Example
```python
import time
import petstore_api
@@ -419,6 +430,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | * Content-Disposition - describes the received file. Looks like: &#39;attachment; filename&#x3D;fileName.txt&#39; <br> |
@@ -432,6 +444,7 @@ Object contains enum properties and array properties containing enums
### Example
```python
import time
import petstore_api
@@ -501,6 +514,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Got object containing enums | - |
@@ -514,6 +528,7 @@ Health check endpoint
### Example
```python
import time
import petstore_api
@@ -560,6 +575,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | The instance started successfully | - |
@@ -575,6 +591,7 @@ Test serialization of mammals
### Example
```python
import time
import petstore_api
@@ -628,6 +645,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output mammal | - |
@@ -643,6 +661,7 @@ Test serialization of outer number types
### Example
```python
import time
import petstore_api
@@ -693,6 +712,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output number | - |
@@ -708,6 +728,7 @@ Test serialization of object with $refed properties
### Example
```python
import time
import petstore_api
@@ -762,6 +783,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output model | - |
@@ -775,6 +797,7 @@ No authorization required
### Example
```python
import time
import petstore_api
@@ -833,6 +856,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | InlineAdditionalPropertiesPayload | - |
@@ -846,6 +870,7 @@ No authorization required
### Example
```python
import time
import petstore_api
@@ -904,6 +929,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | InlineAdditionalPropertiesRefPayload | - |
@@ -919,6 +945,7 @@ Test serialization of outer string types
### Example
```python
import time
import petstore_api
@@ -968,6 +995,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output string | - |
@@ -983,6 +1011,7 @@ Test serialization of outer enum
### Example
```python
import time
import petstore_api
@@ -1033,6 +1062,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output enum | - |
@@ -1048,6 +1078,7 @@ For this test, the body for this request much reference a schema named `File`.
### Example
```python
import time
import petstore_api
@@ -1105,6 +1136,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Success | - |
@@ -1118,6 +1150,7 @@ No authorization required
### Example
```python
import time
import petstore_api
@@ -1181,6 +1214,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Success | - |
@@ -1196,6 +1230,7 @@ To test \"client\" model
### Example
```python
import time
import petstore_api
@@ -1248,6 +1283,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -1264,6 +1300,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
### Example
* Basic Authentication (http_basic_test):
```python
import time
import petstore_api
@@ -1356,6 +1393,7 @@ void (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Invalid username supplied | - |
@@ -1372,6 +1410,7 @@ To test enum parameters
### Example
```python
import time
import petstore_api
@@ -1439,6 +1478,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Invalid request | - |
@@ -1456,6 +1496,7 @@ Fake endpoint to test group parameters (optional)
### Example
* Bearer (JWT) Authentication (bearer_test):
```python
import time
import petstore_api
@@ -1531,6 +1572,7 @@ void (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Someting wrong | - |
@@ -1544,6 +1586,7 @@ test inline additionalProperties
### Example
```python
import time
import petstore_api
@@ -1594,6 +1637,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -1607,6 +1651,7 @@ test json serialization of form data
### Example
```python
import time
import petstore_api
@@ -1657,6 +1702,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -1672,6 +1718,7 @@ To test the collection format in query parameters
### Example
```python
import time
import petstore_api
@@ -1737,6 +1784,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Success | - |
@@ -1750,6 +1798,7 @@ uploads a file and downloads a file using application/octet-stream
### Example
```python
import time
import petstore_api
@@ -1799,6 +1848,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -1812,6 +1862,7 @@ uploads a file using multipart/form-data
### Example
```python
import time
import petstore_api
@@ -1873,6 +1924,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -1886,6 +1938,7 @@ uploads files using multipart/form-data
### Example
```python
import time
import petstore_api
@@ -1937,6 +1990,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |

View File

@@ -17,6 +17,7 @@ To test class name in snake case
### Example
* Api Key Authentication (api_key_query):
```python
import time
import petstore_api
@@ -79,6 +80,7 @@ Name | Type | Description | Notes
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |

View File

@@ -0,0 +1,13 @@
# Legs
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**legs** | **str** | | defaults to "4"
**name** | **str** | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -21,6 +21,7 @@ Add a new pet to the store
### Example
* OAuth Authentication (petstore_auth):
```python
import time
import petstore_api
@@ -157,6 +158,7 @@ void (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**405** | Invalid input | - |
@@ -171,6 +173,7 @@ Deletes a pet
### Example
* OAuth Authentication (petstore_auth):
```python
import time
import petstore_api
@@ -239,6 +242,7 @@ void (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Invalid pet value | - |
@@ -255,6 +259,7 @@ Multiple status values can be provided with comma separated strings
### Example
* OAuth Authentication (petstore_auth):
```python
import time
import petstore_api
@@ -377,6 +382,7 @@ Name | Type | Description | Notes
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -394,6 +400,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
### Example
* OAuth Authentication (petstore_auth):
```python
import time
import petstore_api
@@ -514,6 +521,7 @@ Name | Type | Description | Notes
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -531,6 +539,7 @@ Returns a single pet
### Example
* Api Key Authentication (api_key):
```python
import time
import petstore_api
@@ -591,6 +600,7 @@ Name | Type | Description | Notes
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -607,6 +617,7 @@ Update an existing pet
### Example
* OAuth Authentication (petstore_auth):
```python
import time
import petstore_api
@@ -743,6 +754,7 @@ void (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Invalid ID supplied | - |
@@ -759,6 +771,7 @@ Updates a pet in the store with form data
### Example
* OAuth Authentication (petstore_auth):
```python
import time
import petstore_api
@@ -829,6 +842,7 @@ void (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**405** | Invalid input | - |

View File

@@ -19,6 +19,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
### Example
```python
import time
import petstore_api
@@ -67,6 +68,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Invalid ID supplied | - |
@@ -84,6 +86,7 @@ Returns a map of status codes to quantities
### Example
* Api Key Authentication (api_key):
```python
import time
import petstore_api
@@ -139,6 +142,7 @@ This endpoint does not need any parameter.
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -154,6 +158,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
### Example
```python
import time
import petstore_api
@@ -204,6 +209,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -219,6 +225,7 @@ Place an order for a pet
### Example
```python
import time
import petstore_api
@@ -276,6 +283,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |

View File

@@ -23,6 +23,7 @@ This can only be done by the logged in user.
### Example
```python
import time
import petstore_api
@@ -85,6 +86,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**0** | successful operation | - |
@@ -98,6 +100,7 @@ Creates list of users with given input array
### Example
```python
import time
import petstore_api
@@ -162,6 +165,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**0** | successful operation | - |
@@ -175,6 +179,7 @@ Creates list of users with given input array
### Example
```python
import time
import petstore_api
@@ -239,6 +244,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**0** | successful operation | - |
@@ -254,6 +260,7 @@ This can only be done by the logged in user.
### Example
```python
import time
import petstore_api
@@ -302,6 +309,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Invalid username supplied | - |
@@ -316,6 +324,7 @@ Get user by user name
### Example
```python
import time
import petstore_api
@@ -366,6 +375,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | - |
@@ -381,6 +391,7 @@ Logs user into the system
### Example
```python
import time
import petstore_api
@@ -432,6 +443,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> |
@@ -446,6 +458,7 @@ Logs out current logged in user session
### Example
```python
import time
import petstore_api
@@ -490,6 +503,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**0** | successful operation | - |
@@ -505,6 +519,7 @@ This can only be done by the logged in user.
### Example
```python
import time
import petstore_api
@@ -569,6 +584,7 @@ No authorization required
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**400** | Invalid user supplied | - |

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
@@ -55,4 +55,3 @@ git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -3040,7 +3040,7 @@ class FakeApi(object):
settings={
'response_type': None,
'auth': [],
'endpoint_path': '/fake/test-query-paramters',
'endpoint_path': '/fake/test-query-parameters',
'operation_id': 'test_query_parameter_collection_format',
'http_method': 'PUT',
'servers': None,

View File

@@ -588,12 +588,12 @@ class ApiClient(object):
else:
return content_types[0]
def update_params_for_auth(self, headers, querys, auth_settings,
def update_params_for_auth(self, headers, queries, auth_settings,
resource_path, method, body):
"""Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param queries: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
:param resource_path: A string representation of the HTTP request resource path.
:param method: A string representation of the HTTP request method.
@@ -616,10 +616,10 @@ class ApiClient(object):
# that are calculated dynamically.
signing_info = self.configuration.signing_info
auth_headers = signing_info.get_http_signature_headers(
resource_path, method, headers, body, querys)
resource_path, method, headers, body, queries)
headers.update(auth_headers)
elif auth_setting['in'] == 'query':
querys.append((auth_setting['key'], auth_setting['value']))
queries.append((auth_setting['key'], auth_setting['value']))
else:
raise ApiValueError(
'Authentication token must be in `query` or `header`'

View File

@@ -75,7 +75,7 @@ class Configuration(object):
:param server_operation_variables: Mapping from operation ID to a mapping with
string values to replace variables in templated server configuration.
The validation of enums is performed for variables with defined enum values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format
:Example:
@@ -131,7 +131,7 @@ conf = petstore_api.Configuration(
'Authorization' header, which is used to carry the signature.
One may be tempted to sign all headers by default, but in practice it rarely works.
This is beccause explicit proxies, transparent proxies, TLS termination endpoints or
This is because explicit proxies, transparent proxies, TLS termination endpoints or
load balancers may add/modify/remove headers. Include the HTTP headers that you know
are not going to be modified in transit.
@@ -301,7 +301,7 @@ conf = petstore_api.Configuration(
"Invalid keyword: '{0}''".format(v))
self._disabled_client_side_validations = s
if name == "signing_info" and value is not None:
# Ensure the host paramater from signing info is the same as
# Ensure the host parameter from signing info is the same as
# Configuration.host.
value.host = self.host

View File

@@ -91,6 +91,7 @@ class Animal(ModelNormal):
return {
'class_name': (str,), # noqa: E501
'color': (str,), # noqa: E501
'tail': (bool,), # noqa: E501
}
@cached_property
@@ -107,9 +108,11 @@ class Animal(ModelNormal):
attribute_map = {
'class_name': 'className', # noqa: E501
'color': 'color', # noqa: E501
'tail': 'tail', # noqa: E501
}
read_only_vars = {
'tail', # noqa: E501
}
_composed_schemas = {}
@@ -154,6 +157,7 @@ class Animal(ModelNormal):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -240,6 +244,7 @@ class Animal(ModelNormal):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -92,6 +92,7 @@ class Cat(ModelComposed):
'class_name': (str,), # noqa: E501
'declawed': (bool,), # noqa: E501
'color': (str,), # noqa: E501
'tail': (bool,), # noqa: E501
}
@cached_property
@@ -106,9 +107,11 @@ class Cat(ModelComposed):
'class_name': 'className', # noqa: E501
'declawed': 'declawed', # noqa: E501
'color': 'color', # noqa: E501
'tail': 'tail', # noqa: E501
}
read_only_vars = {
'tail', # noqa: E501
}
@classmethod
@@ -150,6 +153,7 @@ class Cat(ModelComposed):
_visited_composed_classes = (Animal,)
declawed (bool): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -252,6 +256,7 @@ class Cat(ModelComposed):
_visited_composed_classes = (Animal,)
declawed (bool): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -308,7 +313,7 @@ class Cat(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -304,7 +304,7 @@ class ChildCat(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -301,7 +301,7 @@ class ComplexQuadrilateral(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -90,6 +90,7 @@ class ComposedOneOfNumberWithValidations(ModelComposed):
lazy_import()
return {
'color': (str,), # noqa: E501
'tail': (bool,), # noqa: E501
'class_name': (str,), # noqa: E501
}
@@ -100,10 +101,12 @@ class ComposedOneOfNumberWithValidations(ModelComposed):
attribute_map = {
'color': 'color', # noqa: E501
'tail': 'tail', # noqa: E501
'class_name': 'className', # noqa: E501
}
read_only_vars = {
'tail', # noqa: E501
}
@classmethod
@@ -143,6 +146,7 @@ class ComposedOneOfNumberWithValidations(ModelComposed):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
class_name (str): [optional] # noqa: E501
"""
@@ -244,6 +248,7 @@ class ComposedOneOfNumberWithValidations(ModelComposed):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
class_name (str): [optional] # noqa: E501
"""
@@ -301,7 +306,7 @@ class ComposedOneOfNumberWithValidations(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -296,7 +296,7 @@ class ComposedSchemaWithPropsAndNoAddProps(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -32,8 +32,10 @@ from petstore_api.exceptions import ApiAttributeError
def lazy_import():
from petstore_api.model.animal import Animal
from petstore_api.model.dog_all_of import DogAllOf
from petstore_api.model.legs import Legs
globals()['Animal'] = Animal
globals()['DogAllOf'] = DogAllOf
globals()['Legs'] = Legs
class Dog(ModelComposed):
@@ -91,7 +93,9 @@ class Dog(ModelComposed):
return {
'class_name': (str,), # noqa: E501
'breed': (str,), # noqa: E501
'legs': (Legs,), # noqa: E501
'color': (str,), # noqa: E501
'tail': (bool,), # noqa: E501
}
@cached_property
@@ -105,10 +109,13 @@ class Dog(ModelComposed):
attribute_map = {
'class_name': 'className', # noqa: E501
'breed': 'breed', # noqa: E501
'legs': 'legs', # noqa: E501
'color': 'color', # noqa: E501
'tail': 'tail', # noqa: E501
}
read_only_vars = {
'tail', # noqa: E501
}
@classmethod
@@ -149,7 +156,9 @@ class Dog(ModelComposed):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -251,7 +260,9 @@ class Dog(ModelComposed):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
tail (bool): [optional] if omitted the server will use the default value of True # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -308,7 +319,7 @@ class Dog(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -29,6 +29,10 @@ from ..model_utils import OpenApiModel
from petstore_api.exceptions import ApiAttributeError
def lazy_import():
from petstore_api.model.legs import Legs
globals()['Legs'] = Legs
class DogAllOf(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
@@ -66,6 +70,7 @@ class DogAllOf(ModelNormal):
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -80,8 +85,10 @@ class DogAllOf(ModelNormal):
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy_import()
return {
'breed': (str,), # noqa: E501
'legs': (Legs,), # noqa: E501
}
@cached_property
@@ -91,6 +98,7 @@ class DogAllOf(ModelNormal):
attribute_map = {
'breed': 'breed', # noqa: E501
'legs': 'legs', # noqa: E501
}
read_only_vars = {
@@ -135,6 +143,7 @@ class DogAllOf(ModelNormal):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -217,6 +226,7 @@ class DogAllOf(ModelNormal):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
legs (Legs): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -301,7 +301,7 @@ class EquilateralTriangle(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -320,7 +320,7 @@ class Fruit(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -309,7 +309,7 @@ class FruitReq(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -320,7 +320,7 @@ class GmFruit(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -301,7 +301,7 @@ class IsoscelesTriangle(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -0,0 +1,271 @@
"""
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
"""
import re # noqa: F401
import sys # 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,
none_type,
validate_get_composed_info,
)
from ..model_utils import OpenApiModel
from petstore_api.exceptions import ApiAttributeError
class Legs(ModelNormal):
"""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.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
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 = {
('legs',): {
'2': "2",
'4': "4",
},
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'legs': (str,), # noqa: E501
'name': (str,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'legs': 'legs', # noqa: E501
'name': 'name', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""Legs - a model defined in OpenAPI
Args:
Keyword Args:
legs (str): defaults to "4", must be one of ["2", "4", ] # 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,)
name (str): [optional] # noqa: E501
"""
legs = kwargs.get('legs', "4")
_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', ())
self = super(OpenApiModel, cls).__new__(cls)
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.legs = legs
for var_name, var_value in kwargs.items():
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)
return self
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
"""Legs - a model defined in OpenAPI
Args:
Keyword Args:
legs (str): defaults to "4", must be one of ["2", "4", ] # 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,)
name (str): [optional] # noqa: E501
"""
legs = kwargs.get('legs', "4")
_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.legs = legs
for var_name, var_value in kwargs.items():
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)
if var_name in self.read_only_vars:
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@@ -323,7 +323,7 @@ class Mammal(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -311,7 +311,7 @@ class NullableShape(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -302,7 +302,7 @@ class ParentPet(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -303,7 +303,7 @@ class Pig(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -307,7 +307,7 @@ class Quadrilateral(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -301,7 +301,7 @@ class ScaleneTriangle(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -311,7 +311,7 @@ class Shape(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -311,7 +311,7 @@ class ShapeOrNull(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -301,7 +301,7 @@ class SimpleQuadrilateral(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -291,7 +291,7 @@ class SomeObject(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -310,7 +310,7 @@ class Triangle(ModelComposed):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error beause the class level
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading

View File

@@ -446,7 +446,7 @@ class ModelSimple(OpenApiModel):
)
def __contains__(self, name):
"""used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`"""
"""used by `in` operator to check if an attribute value was set in an instance: `'attr' in instance`"""
if name in self.required_properties:
return name in self.__dict__
@@ -501,7 +501,7 @@ class ModelNormal(OpenApiModel):
)
def __contains__(self, name):
"""used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`"""
"""used by `in` operator to check if an attribute value was set in an instance: `'attr' in instance`"""
if name in self.required_properties:
return name in self.__dict__
@@ -648,7 +648,7 @@ class ModelComposed(OpenApiModel):
return value
def __contains__(self, name):
"""used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`"""
"""used by `in` operator to check if an attribute value was set in an instance: `'attr' in instance`"""
if name in self.required_properties:
return name in self.__dict__
@@ -1479,6 +1479,9 @@ def is_valid_type(input_class_simple, valid_classes):
Returns:
bool
"""
if issubclass(input_class_simple, OpenApiModel) and \
valid_classes == (bool, date, datetime, dict, float, int, list, str, none_type,):
return True
valid_type = input_class_simple in valid_classes
if not valid_type and (
issubclass(input_class_simple, OpenApiModel) or
@@ -1747,7 +1750,10 @@ def get_allof_instances(self, model_args, constant_args):
for allof_class in self._composed_schemas['allOf']:
try:
allof_instance = allof_class(**model_args, **constant_args)
if constant_args.get('_spec_property_naming'):
allof_instance = allof_class._from_openapi_data(**model_args, **constant_args)
else:
allof_instance = allof_class(**model_args, **constant_args)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
@@ -1809,10 +1815,16 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
try:
if not single_value_input:
oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
if constant_kwargs.get('_spec_property_naming'):
oneof_instance = oneof_class._from_openapi_data(**model_kwargs, **constant_kwargs)
else:
oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
else:
if issubclass(oneof_class, ModelSimple):
oneof_instance = oneof_class(model_arg, **constant_kwargs)
if constant_kwargs.get('_spec_property_naming'):
oneof_instance = oneof_class._from_openapi_data(model_arg, **constant_kwargs)
else:
oneof_instance = oneof_class(model_arg, **constant_kwargs)
elif oneof_class in PRIMITIVE_TYPES:
oneof_instance = validate_and_convert_types(
model_arg,
@@ -1867,7 +1879,10 @@ def get_anyof_instances(self, model_args, constant_args):
continue
try:
anyof_instance = anyof_class(**model_args, **constant_args)
if constant_args.get('_spec_property_naming'):
anyof_instance = anyof_class._from_openapi_data(**model_args, **constant_args)
else:
anyof_instance = anyof_class(**model_args, **constant_args)
anyof_instances.append(anyof_instance)
except Exception:
pass

View File

@@ -62,6 +62,7 @@ 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.legs import Legs
from petstore_api.model.list import List
from petstore_api.model.mammal import Mammal
from petstore_api.model.map_test import MapTest

View File

@@ -341,7 +341,7 @@ class HttpSigningConfiguration(object):
:return: A tuple of (digest, prefix).
The digest is a hashing object that contains the cryptographic digest of
the HTTP request.
The prefix is a string that identifies the cryptographc hash. It is used
The prefix is a string that identifies the cryptographic hash. It is used
to generate the 'Digest' header as specified in RFC 3230.
"""
if self.hash_algorithm == HASH_SHA512:

View File

@@ -0,0 +1,35 @@
"""
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
"""
import sys
import unittest
import petstore_api
from petstore_api.model.legs import Legs
class TestLegs(unittest.TestCase):
"""Legs unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testLegs(self):
"""Test Legs"""
# FIXME: construct object with mandatory attributes with example values
# model = Legs() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,41 @@
# 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
"""
import sys
import unittest
import petstore_api
from petstore_api.model.dog import Dog
from petstore_api.model.legs import Legs
class TestSetAttrForComposedSchema(unittest.TestCase):
"""TestSetAttrForComposedSchema unit test"""
def setUp(self):
pass
def tearDown(self):
pass
def testSetAttrForComposedSchema(self):
"""Test SetAttrForComposedSchema"""
try:
dog_instance = Dog(class_name="Dog", color="Black")
dog_instance.breed = "bulldog"
dog_instance.legs = Legs(legs="4")
except petstore_api.exceptions.ApiTypeError:
self.assertTrue(False)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,52 @@
# 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
"""
import sys
import unittest
import json
from collections import namedtuple
import petstore_api
from petstore_api.model.animal import Animal
from petstore_api.model.dog import Dog
class TestReadOnlyForComposedSchema(unittest.TestCase):
"""TestReadOnlyForComposedSchema unit test"""
def setUp(self):
pass
def tearDown(self):
pass
def testReadOnlyForComposedSchema(self):
"""Test ReadOnlyForComposedSchema"""
MockResponse = namedtuple('MockResponse', 'data')
client = petstore_api.ApiClient()
""" deserialize dict(str, Enum_Test) """
data = {
"Dog": {
"class_name": "Dog",
"breed": "BullDog",
"color": "Black",
"tail": True
}
}
response = MockResponse(data=json.dumps(data))
deserialized = client.deserialize(response, ({str: (Dog,)},), True)
assert isinstance(deserialized, dict)
assert isinstance(deserialized['Dog'], Dog)
if __name__ == '__main__':
unittest.main()