forked from loafle/openapi-generator-original
[PYTHON] GetItem not working for Client generated allOf model and broken since 5.2.0 (#12239)
* I feel the issue is due to the creation of self._var_name_to_model_instances while doing the deserialization of the data. Earlier the Python SDK code was using get_var_name_to_model_instances function which was adding var name to model instances that contain it. So <class 'openapi_client.model.stream_options_all_of'> will not part of mapping in self._var_name_to_model_instances for variable name stream_options. Now with the latest Python SDK code following is the way through which var_name_to_model_instances is created: for prop_name in model_args: if prop_name not in discarded_args: var_name_to_model_instances[prop_name] = [self] + composed_instances Now as we can see that the var_name_to_model_instances is populated with self and composed_instance which will also contain stream_options_all_of as a composed instance and there will be no check that if stream_options is present in composed_instances or not. As there is no attribute_mapping found for stream_options in stream_options_all_of, the type for stream_options will be treated as dict for mapping stream_options_all_of as mentioned by @Chekov2k. So what I suggest is the following code: for prop_name in model_args: if prop_name not in discarded_args: var_name_to_model_instances[prop_name] = [self] + list( filter( lambda x: prop_name in x.openapi_types, composed_instances)) This way we can check if the property name is present in that composed instance or not. If it's okay for @spacether I can raise a PR for this. * [get_item_all_of_bug] Added samples, test cases to validate all_of schema. * [getiem_all_of_bug] Updated docs and samples. * [getiem_all_of_bug] Updated test cases, docs and samples.
This commit is contained in:
parent
76eddeb713
commit
e823290c8f
@ -1729,7 +1729,9 @@ def validate_get_composed_info(constant_args, model_args, self):
|
||||
var_name_to_model_instances = {}
|
||||
for prop_name in model_args:
|
||||
if prop_name not in discarded_args:
|
||||
var_name_to_model_instances[prop_name] = [self] + composed_instances
|
||||
var_name_to_model_instances[prop_name] = [self] + list(
|
||||
filter(
|
||||
lambda x: prop_name in x.openapi_types, composed_instances))
|
||||
|
||||
return [
|
||||
composed_instances,
|
||||
|
@ -1365,6 +1365,23 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GmFruitNoProperties'
|
||||
/fake/TxRxAllOfModel:
|
||||
post:
|
||||
tags:
|
||||
- fake
|
||||
operationId: txRxAllOfModel
|
||||
responses:
|
||||
200:
|
||||
description: success
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/StreamOptions'
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/StreamOptions'
|
||||
servers:
|
||||
- url: 'http://{server}.swagger.io:{port}/v2'
|
||||
description: petstore server
|
||||
@ -2503,4 +2520,32 @@ components:
|
||||
items:
|
||||
type: object
|
||||
prop2:
|
||||
type: object
|
||||
type: object
|
||||
StreamOptions:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/EgressThresholdOptions"
|
||||
- $ref: "#/components/schemas/PublishOptions"
|
||||
|
||||
EgressThresholdOptions:
|
||||
type: object
|
||||
properties:
|
||||
egressThresholds:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 1
|
||||
example: 0.9
|
||||
|
||||
PublishOptions:
|
||||
type: object
|
||||
properties:
|
||||
publish:
|
||||
type : object
|
||||
properties:
|
||||
egressUnknownDetections:
|
||||
type: boolean
|
||||
example: true
|
||||
filterZeroDetections:
|
||||
type: boolean
|
||||
example: true
|
||||
|
@ -2046,7 +2046,9 @@ def validate_get_composed_info(constant_args, model_args, self):
|
||||
var_name_to_model_instances = {}
|
||||
for prop_name in model_args:
|
||||
if prop_name not in discarded_args:
|
||||
var_name_to_model_instances[prop_name] = [self] + composed_instances
|
||||
var_name_to_model_instances[prop_name] = [self] + list(
|
||||
filter(
|
||||
lambda x: prop_name in x.openapi_types, composed_instances))
|
||||
|
||||
return [
|
||||
composed_instances,
|
||||
|
@ -115,9 +115,9 @@ class TestChild(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
child._var_name_to_model_instances,
|
||||
{
|
||||
'radio_waves': [child, child_allof_instance, parent_instance],
|
||||
'tele_vision': [child, child_allof_instance, parent_instance],
|
||||
'inter_net': [child, child_allof_instance, parent_instance]
|
||||
'radio_waves': [child, parent_instance],
|
||||
'tele_vision': [child, parent_instance],
|
||||
'inter_net': [child, child_allof_instance]
|
||||
}
|
||||
)
|
||||
# model._additional_properties_model_instances stores a list of
|
||||
|
@ -112,9 +112,9 @@ class TestDog(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
dog._var_name_to_model_instances,
|
||||
{
|
||||
'breed': [dog, animal_instance, dog_allof_instance],
|
||||
'class_name': [dog, animal_instance, dog_allof_instance],
|
||||
'color': [dog, animal_instance, dog_allof_instance]
|
||||
'breed': [dog, dog_allof_instance],
|
||||
'class_name': [dog, animal_instance],
|
||||
'color': [dog, animal_instance]
|
||||
}
|
||||
)
|
||||
# model._additional_properties_model_instances stores a list of
|
||||
|
@ -2046,7 +2046,9 @@ def validate_get_composed_info(constant_args, model_args, self):
|
||||
var_name_to_model_instances = {}
|
||||
for prop_name in model_args:
|
||||
if prop_name not in discarded_args:
|
||||
var_name_to_model_instances[prop_name] = [self] + composed_instances
|
||||
var_name_to_model_instances[prop_name] = [self] + list(
|
||||
filter(
|
||||
lambda x: prop_name in x.openapi_types, composed_instances))
|
||||
|
||||
return [
|
||||
composed_instances,
|
||||
|
@ -2046,7 +2046,9 @@ def validate_get_composed_info(constant_args, model_args, self):
|
||||
var_name_to_model_instances = {}
|
||||
for prop_name in model_args:
|
||||
if prop_name not in discarded_args:
|
||||
var_name_to_model_instances[prop_name] = [self] + composed_instances
|
||||
var_name_to_model_instances[prop_name] = [self] + list(
|
||||
filter(
|
||||
lambda x: prop_name in x.openapi_types, composed_instances))
|
||||
|
||||
return [
|
||||
composed_instances,
|
||||
|
@ -2046,7 +2046,9 @@ def validate_get_composed_info(constant_args, model_args, self):
|
||||
var_name_to_model_instances = {}
|
||||
for prop_name in model_args:
|
||||
if prop_name not in discarded_args:
|
||||
var_name_to_model_instances[prop_name] = [self] + composed_instances
|
||||
var_name_to_model_instances[prop_name] = [self] + list(
|
||||
filter(
|
||||
lambda x: prop_name in x.openapi_types, composed_instances))
|
||||
|
||||
return [
|
||||
composed_instances,
|
||||
|
@ -35,6 +35,7 @@ docs/DefaultApi.md
|
||||
docs/Dog.md
|
||||
docs/DogAllOf.md
|
||||
docs/Drawing.md
|
||||
docs/EgressThresholdOptions.md
|
||||
docs/EnumArrays.md
|
||||
docs/EnumClass.md
|
||||
docs/EnumTest.md
|
||||
@ -82,6 +83,8 @@ docs/PetApi.md
|
||||
docs/Pig.md
|
||||
docs/PostInlineAdditionalPropertiesPayloadRequest.md
|
||||
docs/PostInlineAdditionalPropertiesPayloadRequestArrayDataInner.md
|
||||
docs/PublishOptions.md
|
||||
docs/PublishOptionsPublish.md
|
||||
docs/Quadrilateral.md
|
||||
docs/QuadrilateralInterface.md
|
||||
docs/ReadOnlyFirst.md
|
||||
@ -95,6 +98,7 @@ docs/SomeObject.md
|
||||
docs/SomeObjectWithSelfAttr.md
|
||||
docs/SpecialModelName.md
|
||||
docs/StoreApi.md
|
||||
docs/StreamOptions.md
|
||||
docs/StringBooleanMap.md
|
||||
docs/StringEnum.md
|
||||
docs/StringEnumWithDefaultValue.md
|
||||
@ -151,6 +155,7 @@ petstore_api/model/danish_pig.py
|
||||
petstore_api/model/dog.py
|
||||
petstore_api/model/dog_all_of.py
|
||||
petstore_api/model/drawing.py
|
||||
petstore_api/model/egress_threshold_options.py
|
||||
petstore_api/model/enum_arrays.py
|
||||
petstore_api/model/enum_class.py
|
||||
petstore_api/model/enum_test.py
|
||||
@ -195,6 +200,8 @@ petstore_api/model/pet.py
|
||||
petstore_api/model/pig.py
|
||||
petstore_api/model/post_inline_additional_properties_payload_request.py
|
||||
petstore_api/model/post_inline_additional_properties_payload_request_array_data_inner.py
|
||||
petstore_api/model/publish_options.py
|
||||
petstore_api/model/publish_options_publish.py
|
||||
petstore_api/model/quadrilateral.py
|
||||
petstore_api/model/quadrilateral_interface.py
|
||||
petstore_api/model/read_only_first.py
|
||||
@ -207,6 +214,7 @@ petstore_api/model/simple_quadrilateral.py
|
||||
petstore_api/model/some_object.py
|
||||
petstore_api/model/some_object_with_self_attr.py
|
||||
petstore_api/model/special_model_name.py
|
||||
petstore_api/model/stream_options.py
|
||||
petstore_api/model/string_boolean_map.py
|
||||
petstore_api/model/string_enum.py
|
||||
petstore_api/model/string_enum_with_default_value.py
|
||||
|
@ -107,6 +107,7 @@ Class | Method | HTTP request | Description
|
||||
*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-parameters |
|
||||
*FakeApi* | [**tx_rx_all_of_model**](docs/FakeApi.md#tx_rx_all_of_model) | **POST** /fake/TxRxAllOfModel |
|
||||
*FakeApi* | [**tx_rx_any_of_model**](docs/FakeApi.md#tx_rx_any_of_model) | **POST** /fake/TxRxAnyOfModel |
|
||||
*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
|
||||
@ -166,6 +167,7 @@ Class | Method | HTTP request | Description
|
||||
- [Dog](docs/Dog.md)
|
||||
- [DogAllOf](docs/DogAllOf.md)
|
||||
- [Drawing](docs/Drawing.md)
|
||||
- [EgressThresholdOptions](docs/EgressThresholdOptions.md)
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
@ -210,6 +212,8 @@ Class | Method | HTTP request | Description
|
||||
- [Pig](docs/Pig.md)
|
||||
- [PostInlineAdditionalPropertiesPayloadRequest](docs/PostInlineAdditionalPropertiesPayloadRequest.md)
|
||||
- [PostInlineAdditionalPropertiesPayloadRequestArrayDataInner](docs/PostInlineAdditionalPropertiesPayloadRequestArrayDataInner.md)
|
||||
- [PublishOptions](docs/PublishOptions.md)
|
||||
- [PublishOptionsPublish](docs/PublishOptionsPublish.md)
|
||||
- [Quadrilateral](docs/Quadrilateral.md)
|
||||
- [QuadrilateralInterface](docs/QuadrilateralInterface.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
@ -222,6 +226,7 @@ Class | Method | HTTP request | Description
|
||||
- [SomeObject](docs/SomeObject.md)
|
||||
- [SomeObjectWithSelfAttr](docs/SomeObjectWithSelfAttr.md)
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [StreamOptions](docs/StreamOptions.md)
|
||||
- [StringBooleanMap](docs/StringBooleanMap.md)
|
||||
- [StringEnum](docs/StringEnum.md)
|
||||
- [StringEnumWithDefaultValue](docs/StringEnumWithDefaultValue.md)
|
||||
|
@ -0,0 +1,12 @@
|
||||
# EgressThresholdOptions
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**egress_thresholds** | **{str: (float,)}** | | [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)
|
||||
|
||||
|
@ -28,6 +28,7 @@ Method | HTTP request | Description
|
||||
[**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-parameters |
|
||||
[**tx_rx_all_of_model**](FakeApi.md#tx_rx_all_of_model) | **POST** /fake/TxRxAllOfModel |
|
||||
[**tx_rx_any_of_model**](FakeApi.md#tx_rx_any_of_model) | **POST** /fake/TxRxAnyOfModel |
|
||||
[**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
|
||||
@ -1794,6 +1795,71 @@ 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)
|
||||
|
||||
# **tx_rx_all_of_model**
|
||||
> StreamOptions tx_rx_all_of_model()
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```python
|
||||
import time
|
||||
import petstore_api
|
||||
from petstore_api.api import fake_api
|
||||
from petstore_api.model.stream_options import StreamOptions
|
||||
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)
|
||||
stream_options = StreamOptions(None) # StreamOptions | (optional)
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
# and optional values
|
||||
try:
|
||||
api_response = api_instance.tx_rx_all_of_model(stream_options=stream_options)
|
||||
pprint(api_response)
|
||||
except petstore_api.ApiException as e:
|
||||
print("Exception when calling FakeApi->tx_rx_all_of_model: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**stream_options** | [**StreamOptions**](StreamOptions.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**StreamOptions**](StreamOptions.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | success | - |
|
||||
|
||||
[[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)
|
||||
|
||||
# **tx_rx_any_of_model**
|
||||
> GmFruitNoProperties tx_rx_any_of_model()
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
# PublishOptions
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**publish** | [**PublishOptionsPublish**](PublishOptionsPublish.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)
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
# PublishOptionsPublish
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**egress_unknown_detections** | **bool** | | [optional]
|
||||
**filter_zero_detections** | **bool** | | [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)
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
# StreamOptions
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**egress_thresholds** | **{str: (float,)}** | | [optional]
|
||||
**publish** | [**PublishOptionsPublish**](PublishOptionsPublish.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)
|
||||
|
||||
|
@ -36,6 +36,7 @@ from petstore_api.model.mammal import Mammal
|
||||
from petstore_api.model.number_with_validations import NumberWithValidations
|
||||
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
|
||||
from petstore_api.model.post_inline_additional_properties_payload_request import PostInlineAdditionalPropertiesPayloadRequest
|
||||
from petstore_api.model.stream_options import StreamOptions
|
||||
from petstore_api.model.string_enum import StringEnum
|
||||
from petstore_api.model.user import User
|
||||
|
||||
@ -1485,6 +1486,54 @@ class FakeApi(object):
|
||||
},
|
||||
api_client=api_client
|
||||
)
|
||||
self.tx_rx_all_of_model_endpoint = _Endpoint(
|
||||
settings={
|
||||
'response_type': (StreamOptions,),
|
||||
'auth': [],
|
||||
'endpoint_path': '/fake/TxRxAllOfModel',
|
||||
'operation_id': 'tx_rx_all_of_model',
|
||||
'http_method': 'POST',
|
||||
'servers': None,
|
||||
},
|
||||
params_map={
|
||||
'all': [
|
||||
'stream_options',
|
||||
],
|
||||
'required': [],
|
||||
'nullable': [
|
||||
],
|
||||
'enum': [
|
||||
],
|
||||
'validation': [
|
||||
]
|
||||
},
|
||||
root_map={
|
||||
'validations': {
|
||||
},
|
||||
'allowed_values': {
|
||||
},
|
||||
'openapi_types': {
|
||||
'stream_options':
|
||||
(StreamOptions,),
|
||||
},
|
||||
'attribute_map': {
|
||||
},
|
||||
'location_map': {
|
||||
'stream_options': 'body',
|
||||
},
|
||||
'collection_format_map': {
|
||||
}
|
||||
},
|
||||
headers_map={
|
||||
'accept': [
|
||||
'application/json'
|
||||
],
|
||||
'content_type': [
|
||||
'application/json'
|
||||
]
|
||||
},
|
||||
api_client=api_client
|
||||
)
|
||||
self.tx_rx_any_of_model_endpoint = _Endpoint(
|
||||
settings={
|
||||
'response_type': (GmFruitNoProperties,),
|
||||
@ -3681,6 +3730,84 @@ class FakeApi(object):
|
||||
context
|
||||
return self.test_query_parameter_collection_format_endpoint.call_with_http_info(**kwargs)
|
||||
|
||||
def tx_rx_all_of_model(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""tx_rx_all_of_model # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
|
||||
>>> thread = api.tx_rx_all_of_model(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
|
||||
Keyword Args:
|
||||
stream_options (StreamOptions): [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 (int/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.
|
||||
_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)
|
||||
_content_type (str/None): force body content-type.
|
||||
Default is None and content-type will be predicted by allowed
|
||||
content-types and body.
|
||||
_host_index (int/None): specifies the index of the server
|
||||
that we want to use.
|
||||
Default is read from the configuration.
|
||||
_request_auths (list): set to override the auth_settings for an a single
|
||||
request; this effectively ignores the authentication
|
||||
in the spec for a single request.
|
||||
Default is None
|
||||
async_req (bool): execute request asynchronously
|
||||
|
||||
Returns:
|
||||
StreamOptions
|
||||
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['_spec_property_naming'] = kwargs.get(
|
||||
'_spec_property_naming', False
|
||||
)
|
||||
kwargs['_content_type'] = kwargs.get(
|
||||
'_content_type')
|
||||
kwargs['_host_index'] = kwargs.get('_host_index')
|
||||
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
|
||||
return self.tx_rx_all_of_model_endpoint.call_with_http_info(**kwargs)
|
||||
|
||||
def tx_rx_any_of_model(
|
||||
self,
|
||||
**kwargs
|
||||
|
@ -0,0 +1,263 @@
|
||||
"""
|
||||
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,
|
||||
OpenApiModel
|
||||
)
|
||||
from petstore_api.exceptions import ApiAttributeError
|
||||
|
||||
|
||||
|
||||
class EgressThresholdOptions(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 = {
|
||||
}
|
||||
|
||||
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 {
|
||||
'egress_thresholds': ({str: (float,)},), # noqa: E501
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def discriminator():
|
||||
return None
|
||||
|
||||
|
||||
attribute_map = {
|
||||
'egress_thresholds': 'egressThresholds', # noqa: E501
|
||||
}
|
||||
|
||||
read_only_vars = {
|
||||
}
|
||||
|
||||
_composed_schemas = {}
|
||||
|
||||
@classmethod
|
||||
@convert_js_args_to_python_args
|
||||
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
|
||||
"""EgressThresholdOptions - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
egress_thresholds ({str: (float,)}): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', True)
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
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
|
||||
"""EgressThresholdOptions - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
egress_thresholds ({str: (float,)}): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
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.")
|
@ -0,0 +1,269 @@
|
||||
"""
|
||||
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,
|
||||
OpenApiModel
|
||||
)
|
||||
from petstore_api.exceptions import ApiAttributeError
|
||||
|
||||
|
||||
def lazy_import():
|
||||
from petstore_api.model.publish_options_publish import PublishOptionsPublish
|
||||
globals()['PublishOptionsPublish'] = PublishOptionsPublish
|
||||
|
||||
|
||||
class PublishOptions(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 = {
|
||||
}
|
||||
|
||||
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
|
||||
"""
|
||||
lazy_import()
|
||||
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.
|
||||
"""
|
||||
lazy_import()
|
||||
return {
|
||||
'publish': (PublishOptionsPublish,), # noqa: E501
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def discriminator():
|
||||
return None
|
||||
|
||||
|
||||
attribute_map = {
|
||||
'publish': 'publish', # noqa: E501
|
||||
}
|
||||
|
||||
read_only_vars = {
|
||||
}
|
||||
|
||||
_composed_schemas = {}
|
||||
|
||||
@classmethod
|
||||
@convert_js_args_to_python_args
|
||||
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
|
||||
"""PublishOptions - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
publish (PublishOptionsPublish): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', True)
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
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
|
||||
"""PublishOptions - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
publish (PublishOptionsPublish): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
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.")
|
@ -0,0 +1,267 @@
|
||||
"""
|
||||
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,
|
||||
OpenApiModel
|
||||
)
|
||||
from petstore_api.exceptions import ApiAttributeError
|
||||
|
||||
|
||||
|
||||
class PublishOptionsPublish(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 = {
|
||||
}
|
||||
|
||||
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 {
|
||||
'egress_unknown_detections': (bool,), # noqa: E501
|
||||
'filter_zero_detections': (bool,), # noqa: E501
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def discriminator():
|
||||
return None
|
||||
|
||||
|
||||
attribute_map = {
|
||||
'egress_unknown_detections': 'egressUnknownDetections', # noqa: E501
|
||||
'filter_zero_detections': 'filterZeroDetections', # noqa: E501
|
||||
}
|
||||
|
||||
read_only_vars = {
|
||||
}
|
||||
|
||||
_composed_schemas = {}
|
||||
|
||||
@classmethod
|
||||
@convert_js_args_to_python_args
|
||||
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
|
||||
"""PublishOptionsPublish - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
egress_unknown_detections (bool): [optional] # noqa: E501
|
||||
filter_zero_detections (bool): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_check_type = kwargs.pop('_check_type', True)
|
||||
_spec_property_naming = kwargs.pop('_spec_property_naming', True)
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
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
|
||||
"""PublishOptionsPublish - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
egress_unknown_detections (bool): [optional] # noqa: E501
|
||||
filter_zero_detections (bool): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
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.")
|
@ -0,0 +1,328 @@
|
||||
"""
|
||||
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,
|
||||
OpenApiModel
|
||||
)
|
||||
from petstore_api.exceptions import ApiAttributeError
|
||||
|
||||
|
||||
def lazy_import():
|
||||
from petstore_api.model.egress_threshold_options import EgressThresholdOptions
|
||||
from petstore_api.model.publish_options import PublishOptions
|
||||
from petstore_api.model.publish_options_publish import PublishOptionsPublish
|
||||
globals()['EgressThresholdOptions'] = EgressThresholdOptions
|
||||
globals()['PublishOptions'] = PublishOptions
|
||||
globals()['PublishOptionsPublish'] = PublishOptionsPublish
|
||||
|
||||
|
||||
class StreamOptions(ModelComposed):
|
||||
"""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 = {
|
||||
}
|
||||
|
||||
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
|
||||
"""
|
||||
lazy_import()
|
||||
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.
|
||||
"""
|
||||
lazy_import()
|
||||
return {
|
||||
'egress_thresholds': ({str: (float,)},), # noqa: E501
|
||||
'publish': (PublishOptionsPublish,), # noqa: E501
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def discriminator():
|
||||
return None
|
||||
|
||||
|
||||
attribute_map = {
|
||||
'egress_thresholds': 'egressThresholds', # noqa: E501
|
||||
'publish': 'publish', # noqa: E501
|
||||
}
|
||||
|
||||
read_only_vars = {
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@convert_js_args_to_python_args
|
||||
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
|
||||
"""StreamOptions - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
egress_thresholds ({str: (float,)}): [optional] # noqa: E501
|
||||
publish (PublishOptionsPublish): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
constant_args = {
|
||||
'_check_type': _check_type,
|
||||
'_path_to_item': _path_to_item,
|
||||
'_spec_property_naming': _spec_property_naming,
|
||||
'_configuration': _configuration,
|
||||
'_visited_composed_classes': self._visited_composed_classes,
|
||||
}
|
||||
composed_info = validate_get_composed_info(
|
||||
constant_args, kwargs, self)
|
||||
self._composed_instances = composed_info[0]
|
||||
self._var_name_to_model_instances = composed_info[1]
|
||||
self._additional_properties_model_instances = composed_info[2]
|
||||
discarded_args = composed_info[3]
|
||||
|
||||
for var_name, var_value in kwargs.items():
|
||||
if var_name in discarded_args and \
|
||||
self._configuration is not None and \
|
||||
self._configuration.discard_unknown_keys and \
|
||||
self._additional_properties_model_instances:
|
||||
# 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',
|
||||
'_composed_instances',
|
||||
'_var_name_to_model_instances',
|
||||
'_additional_properties_model_instances',
|
||||
])
|
||||
|
||||
@convert_js_args_to_python_args
|
||||
def __init__(self, *args, **kwargs): # noqa: E501
|
||||
"""StreamOptions - a model defined in OpenAPI
|
||||
|
||||
Keyword Args:
|
||||
_check_type (bool): if True, values for parameters in openapi_types
|
||||
will be type checked and a TypeError will be
|
||||
raised if the wrong type is input.
|
||||
Defaults to True
|
||||
_path_to_item (tuple/list): This is a list of keys or values to
|
||||
drill down to the model in received_data
|
||||
when deserializing a response
|
||||
_spec_property_naming (bool): True if the variable names in the input data
|
||||
are serialized names, as specified in the OpenAPI document.
|
||||
False if the variable names in the input data
|
||||
are pythonic names, e.g. snake case (default)
|
||||
_configuration (Configuration): the instance to use when
|
||||
deserializing a file_type parameter.
|
||||
If passed, type conversion is attempted
|
||||
If omitted no type conversion is done.
|
||||
_visited_composed_classes (tuple): This stores a tuple of
|
||||
classes that we have traveled through so that
|
||||
if we see that class again we will not use its
|
||||
discriminator again.
|
||||
When traveling through a discriminator, the
|
||||
composed schema that is
|
||||
is traveled through is added to this set.
|
||||
For example if Animal has a discriminator
|
||||
petType and we pass in "Dog", and the class Dog
|
||||
allOf includes Animal, we move through Animal
|
||||
once using the discriminator, and pick Dog.
|
||||
Then in Dog, we will make an instance of the
|
||||
Animal class but this time we won't travel
|
||||
through its discriminator because we passed in
|
||||
_visited_composed_classes = (Animal,)
|
||||
egress_thresholds ({str: (float,)}): [optional] # noqa: E501
|
||||
publish (PublishOptionsPublish): [optional] # noqa: E501
|
||||
"""
|
||||
|
||||
_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:
|
||||
for arg in args:
|
||||
if isinstance(arg, dict):
|
||||
kwargs.update(arg)
|
||||
else:
|
||||
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__,)
|
||||
|
||||
constant_args = {
|
||||
'_check_type': _check_type,
|
||||
'_path_to_item': _path_to_item,
|
||||
'_spec_property_naming': _spec_property_naming,
|
||||
'_configuration': _configuration,
|
||||
'_visited_composed_classes': self._visited_composed_classes,
|
||||
}
|
||||
composed_info = validate_get_composed_info(
|
||||
constant_args, kwargs, self)
|
||||
self._composed_instances = composed_info[0]
|
||||
self._var_name_to_model_instances = composed_info[1]
|
||||
self._additional_properties_model_instances = composed_info[2]
|
||||
discarded_args = composed_info[3]
|
||||
|
||||
for var_name, var_value in kwargs.items():
|
||||
if var_name in discarded_args and \
|
||||
self._configuration is not None and \
|
||||
self._configuration.discard_unknown_keys and \
|
||||
self._additional_properties_model_instances:
|
||||
# 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.")
|
||||
|
||||
@cached_property
|
||||
def _composed_schemas():
|
||||
# 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 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
|
||||
lazy_import()
|
||||
return {
|
||||
'anyOf': [
|
||||
],
|
||||
'allOf': [
|
||||
EgressThresholdOptions,
|
||||
PublishOptions,
|
||||
],
|
||||
'oneOf': [
|
||||
],
|
||||
}
|
@ -2046,7 +2046,9 @@ def validate_get_composed_info(constant_args, model_args, self):
|
||||
var_name_to_model_instances = {}
|
||||
for prop_name in model_args:
|
||||
if prop_name not in discarded_args:
|
||||
var_name_to_model_instances[prop_name] = [self] + composed_instances
|
||||
var_name_to_model_instances[prop_name] = [self] + list(
|
||||
filter(
|
||||
lambda x: prop_name in x.openapi_types, composed_instances))
|
||||
|
||||
return [
|
||||
composed_instances,
|
||||
|
@ -40,6 +40,7 @@ from petstore_api.model.danish_pig import DanishPig
|
||||
from petstore_api.model.dog import Dog
|
||||
from petstore_api.model.dog_all_of import DogAllOf
|
||||
from petstore_api.model.drawing import Drawing
|
||||
from petstore_api.model.egress_threshold_options import EgressThresholdOptions
|
||||
from petstore_api.model.enum_arrays import EnumArrays
|
||||
from petstore_api.model.enum_class import EnumClass
|
||||
from petstore_api.model.enum_test import EnumTest
|
||||
@ -84,6 +85,8 @@ from petstore_api.model.pet import Pet
|
||||
from petstore_api.model.pig import Pig
|
||||
from petstore_api.model.post_inline_additional_properties_payload_request import PostInlineAdditionalPropertiesPayloadRequest
|
||||
from petstore_api.model.post_inline_additional_properties_payload_request_array_data_inner import PostInlineAdditionalPropertiesPayloadRequestArrayDataInner
|
||||
from petstore_api.model.publish_options import PublishOptions
|
||||
from petstore_api.model.publish_options_publish import PublishOptionsPublish
|
||||
from petstore_api.model.quadrilateral import Quadrilateral
|
||||
from petstore_api.model.quadrilateral_interface import QuadrilateralInterface
|
||||
from petstore_api.model.read_only_first import ReadOnlyFirst
|
||||
@ -96,6 +99,7 @@ from petstore_api.model.simple_quadrilateral import SimpleQuadrilateral
|
||||
from petstore_api.model.some_object import SomeObject
|
||||
from petstore_api.model.some_object_with_self_attr import SomeObjectWithSelfAttr
|
||||
from petstore_api.model.special_model_name import SpecialModelName
|
||||
from petstore_api.model.stream_options import StreamOptions
|
||||
from petstore_api.model.string_boolean_map import StringBooleanMap
|
||||
from petstore_api.model.string_enum import StringEnum
|
||||
from petstore_api.model.string_enum_with_default_value import StringEnumWithDefaultValue
|
||||
|
@ -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.egress_threshold_options import EgressThresholdOptions
|
||||
|
||||
|
||||
class TestEgressThresholdOptions(unittest.TestCase):
|
||||
"""EgressThresholdOptions unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testEgressThresholdOptions(self):
|
||||
"""Test EgressThresholdOptions"""
|
||||
# FIXME: construct object with mandatory attributes with example values
|
||||
# model = EgressThresholdOptions() # noqa: E501
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -0,0 +1,37 @@
|
||||
"""
|
||||
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.publish_options_publish import PublishOptionsPublish
|
||||
globals()['PublishOptionsPublish'] = PublishOptionsPublish
|
||||
from petstore_api.model.publish_options import PublishOptions
|
||||
|
||||
|
||||
class TestPublishOptions(unittest.TestCase):
|
||||
"""PublishOptions unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testPublishOptions(self):
|
||||
"""Test PublishOptions"""
|
||||
# FIXME: construct object with mandatory attributes with example values
|
||||
# model = PublishOptions() # noqa: E501
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -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.publish_options_publish import PublishOptionsPublish
|
||||
|
||||
|
||||
class TestPublishOptionsPublish(unittest.TestCase):
|
||||
"""PublishOptionsPublish unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testPublishOptionsPublish(self):
|
||||
"""Test PublishOptionsPublish"""
|
||||
# FIXME: construct object with mandatory attributes with example values
|
||||
# model = PublishOptionsPublish() # noqa: E501
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -0,0 +1,41 @@
|
||||
"""
|
||||
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.egress_threshold_options import EgressThresholdOptions
|
||||
from petstore_api.model.publish_options import PublishOptions
|
||||
from petstore_api.model.publish_options_publish import PublishOptionsPublish
|
||||
globals()['EgressThresholdOptions'] = EgressThresholdOptions
|
||||
globals()['PublishOptions'] = PublishOptions
|
||||
globals()['PublishOptionsPublish'] = PublishOptionsPublish
|
||||
from petstore_api.model.stream_options import StreamOptions
|
||||
|
||||
|
||||
class TestStreamOptions(unittest.TestCase):
|
||||
"""StreamOptions unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testStreamOptions(self):
|
||||
"""Test StreamOptions"""
|
||||
# FIXME: construct object with mandatory attributes with example values
|
||||
# model = StreamOptions() # noqa: E501
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -747,5 +747,39 @@ class TestFakeApi(unittest.TestCase):
|
||||
assert isinstance(response, GmFruitNoProperties)
|
||||
assert model_to_dict(response) == expected_json_body
|
||||
|
||||
def test_post_tx_rx_all_of_payload(self):
|
||||
"""Test case for postInlineAdditionlPropertiesPayload
|
||||
"""
|
||||
from petstore_api.model.stream_options import StreamOptions
|
||||
from petstore_api.model.publish_options_publish import PublishOptionsPublish
|
||||
endpoint = self.api.tx_rx_all_of_model_endpoint
|
||||
assert endpoint.openapi_types['stream_options'] == (StreamOptions,)
|
||||
assert endpoint.settings['response_type'] == (StreamOptions,)
|
||||
|
||||
# serialization + deserialization works
|
||||
from petstore_api.rest import RESTClientObject, RESTResponse
|
||||
with patch.object(RESTClientObject, 'request') as mock_method:
|
||||
expected_json_body = {
|
||||
"egressThresholds": {
|
||||
"person":0.8
|
||||
},
|
||||
"publish": {
|
||||
"egressUnknownDetections": False
|
||||
}
|
||||
}
|
||||
stream_option_instance = StreamOptions(**expected_json_body)
|
||||
mock_method.return_value = self.mock_response(expected_json_body)
|
||||
|
||||
response = self.api.tx_rx_all_of_model(stream_options=stream_option_instance)
|
||||
self.assert_request_called_with(
|
||||
mock_method,
|
||||
'http://petstore.swagger.io:80/v2/fake/TxRxAllOfModel',
|
||||
body=expected_json_body
|
||||
)
|
||||
|
||||
assert isinstance(response, StreamOptions)
|
||||
assert model_to_dict(response) == expected_json_body
|
||||
assert response.publish == PublishOptionsPublish(**{"egress_unknown_detections": False})
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
@ -147,7 +147,7 @@ class TestFruit(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
fruit._var_name_to_model_instances,
|
||||
{
|
||||
'color': [fruit, banana_instance],
|
||||
'color': [fruit],
|
||||
'length_cm': [fruit, banana_instance],
|
||||
}
|
||||
)
|
||||
@ -206,7 +206,7 @@ class TestFruit(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
fruit._var_name_to_model_instances,
|
||||
{
|
||||
'color': [fruit, apple_instance],
|
||||
'color': [fruit],
|
||||
'cultivar': [fruit, apple_instance],
|
||||
}
|
||||
)
|
||||
|
@ -110,7 +110,7 @@ class TestGmFruit(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
fruit._var_name_to_model_instances,
|
||||
{
|
||||
'color': [fruit, banana_instance],
|
||||
'color': [fruit],
|
||||
'length_cm': [fruit, banana_instance],
|
||||
}
|
||||
)
|
||||
@ -153,9 +153,9 @@ class TestGmFruit(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
fruit._var_name_to_model_instances,
|
||||
{
|
||||
'color': [fruit, apple_instance, banana_instance],
|
||||
'length_cm': [fruit, apple_instance, banana_instance],
|
||||
'cultivar': [fruit, apple_instance, banana_instance],
|
||||
'color': [fruit],
|
||||
'length_cm': [fruit, banana_instance],
|
||||
'cultivar': [fruit, apple_instance],
|
||||
}
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -204,7 +204,7 @@ class TestGmFruit(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
fruit._var_name_to_model_instances,
|
||||
{
|
||||
'color': [fruit, apple_instance],
|
||||
'color': [fruit],
|
||||
'cultivar': [fruit, apple_instance],
|
||||
'origin': [fruit, apple_instance],
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user