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

This commit is contained in:
William Cheng
2023-04-12 17:51:47 +08:00
5414 changed files with 134722 additions and 66020 deletions

View File

@@ -15,12 +15,12 @@ jobs:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:s
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}s
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@@ -34,4 +34,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
pytest

View File

@@ -11,6 +11,7 @@ docs/DataQueryAllOf.md
docs/DefaultValue.md
docs/FormApi.md
docs/HeaderApi.md
docs/NumberPropertiesOnly.md
docs/PathApi.md
docs/Pet.md
docs/Query.md
@@ -36,6 +37,7 @@ openapi_client/models/category.py
openapi_client/models/data_query.py
openapi_client/models/data_query_all_of.py
openapi_client/models/default_value.py
openapi_client/models/number_properties_only.py
openapi_client/models/pet.py
openapi_client/models/query.py
openapi_client/models/string_enum_ref.py
@@ -43,6 +45,7 @@ openapi_client/models/tag.py
openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py
openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py
openapi_client/rest.py
pyproject.toml
requirements.txt
setup.cfg
setup.py

View File

@@ -40,6 +40,10 @@ Then import the package:
import openapi_client
```
### Tests
Execute `pytest` to run the tests.
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
@@ -64,15 +68,14 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
try:
# Test body parameter(s)
api_response = api_instance.test_echo_body_pet(pet=pet)
print("The response of BodyApi->test_echo_body_pet:\n")
# Test binary (gif) response body
api_response = api_instance.test_binary_gif()
print("The response of BodyApi->test_binary_gif:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling BodyApi->test_echo_body_pet: %s\n" % e)
print("Exception when calling BodyApi->test_binary_gif: %s\n" % e)
```
@@ -82,6 +85,7 @@ All URIs are relative to *http://localhost:3000*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
*FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s)
@@ -103,6 +107,7 @@ Class | Method | HTTP request | Description
- [DataQuery](docs/DataQuery.md)
- [DataQueryAllOf](docs/DataQueryAllOf.md)
- [DefaultValue](docs/DefaultValue.md)
- [NumberPropertiesOnly](docs/NumberPropertiesOnly.md)
- [Pet](docs/Pet.md)
- [Query](docs/Query.md)
- [StringEnumRef](docs/StringEnumRef.md)

View File

@@ -4,10 +4,71 @@ All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
# **test_binary_gif**
> bytearray test_binary_gif()
Test binary (gif) response body
Test binary (gif) response body
### Example
```python
from __future__ import print_function
import time
import os
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost:3000"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
try:
# Test binary (gif) response body
api_response = api_instance.test_binary_gif()
print("The response of BodyApi->test_binary_gif:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BodyApi->test_binary_gif: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
**bytearray**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: image/gif
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_echo_body_pet**
> Pet test_echo_body_pet(pet=pet)

View File

@@ -0,0 +1,30 @@
# NumberPropertiesOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**number** | **float** | | [optional]
**float** | **float** | | [optional]
**double** | **float** | | [optional]
## Example
```python
from openapi_client.models.number_properties_only import NumberPropertiesOnly
# TODO update the JSON string below
json = "{}"
# create an instance of NumberPropertiesOnly from a JSON string
number_properties_only_instance = NumberPropertiesOnly.from_json(json)
# print the JSON string representation of the object
print NumberPropertiesOnly.to_json()
# convert the object into a dict
number_properties_only_dict = number_properties_only_instance.to_dict()
# create an instance of NumberPropertiesOnly from a dict
number_properties_only_form_dict = number_properties_only.from_dict(number_properties_only_dict)
```
[[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

@@ -9,12 +9,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
__version__ = "1.0.0"
# import apis into sdk package
@@ -39,6 +39,7 @@ from openapi_client.models.category import Category
from openapi_client.models.data_query import DataQuery
from openapi_client.models.data_query_all_of import DataQueryAllOf
from openapi_client.models.default_value import DefaultValue
from openapi_client.models.number_properties_only import NumberPropertiesOnly
from openapi_client.models.pet import Pet
from openapi_client.models.query import Query
from openapi_client.models.string_enum_ref import StringEnumRef

View File

@@ -1,5 +1,3 @@
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
@@ -8,3 +6,4 @@ from openapi_client.api.form_api import FormApi
from openapi_client.api.header_api import HeaderApi
from openapi_client.api.path_api import PathApi
from openapi_client.api.query_api import QueryApi

View File

@@ -7,12 +7,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import re # noqa: F401
from pydantic import validate_arguments, ValidationError
@@ -43,6 +43,138 @@ class BodyApi(object):
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501
"""Test binary (gif) response body # noqa: E501
Test binary (gif) response body # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_binary_gif(async_req=True)
>>> result = thread.get()
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: 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.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: bytearray
"""
kwargs['_return_http_data_only'] = True
return self.test_binary_gif_with_http_info(**kwargs) # noqa: E501
@validate_arguments
def test_binary_gif_with_http_info(self, **kwargs): # noqa: E501
"""Test binary (gif) response body # noqa: E501
Test binary (gif) response body # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_binary_gif_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: 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.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict))
"""
_params = locals()
_all_params = [
]
_all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
]
)
# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_binary_gif" % _key
)
_params[_key] = _val
del _params['kwargs']
_collection_formats = {}
# process the path parameters
_path_params = {}
# process the query parameters
_query_params = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
# process the form parameters
_form_params = []
_files = {}
# process the body parameter
_body_params = None
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['image/gif']) # noqa: E501
# authentication setting
_auth_settings = [] # noqa: E501
_response_types_map = {
'200': "bytearray",
}
return self.api_client.call_api(
'/binary/gif', 'POST',
_path_params,
_query_params,
_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> Pet: # noqa: E501
"""Test body parameter(s) # noqa: E501

View File

@@ -7,12 +7,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import re # noqa: F401
from pydantic import validate_arguments, ValidationError

View File

@@ -7,12 +7,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import re # noqa: F401
from pydantic import validate_arguments, ValidationError

View File

@@ -7,12 +7,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import re # noqa: F401
from pydantic import validate_arguments, ValidationError

View File

@@ -7,12 +7,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import re # noqa: F401
from pydantic import validate_arguments, ValidationError
@@ -22,7 +22,7 @@ from datetime import date, datetime
from pydantic import StrictBool, StrictInt, StrictStr
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Optional
from openapi_client.api_client import ApiClient
@@ -45,7 +45,7 @@ class QueryApi(object):
self.api_client = api_client
@validate_arguments
def test_query_datetime_date_string(self, datetime_query : Optional[Union[StrictStr, datetime]] = None, date_query : Optional[Union[StrictStr, date]] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
def test_query_datetime_date_string(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
@@ -80,7 +80,7 @@ class QueryApi(object):
return self.test_query_datetime_date_string_with_http_info(datetime_query, date_query, string_query, **kwargs) # noqa: E501
@validate_arguments
def test_query_datetime_date_string_with_http_info(self, datetime_query : Optional[Union[StrictStr, datetime]] = None, date_query : Optional[Union[StrictStr, date]] = None, string_query : Optional[StrictStr] = None, **kwargs): # noqa: E501
def test_query_datetime_date_string_with_http_info(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs): # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
@@ -363,7 +363,7 @@ class QueryApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_query_style_deep_object_explode_true_object(self, query_object : Optional[Dict[str, Dict[str, StrictStr]]] = None, **kwargs) -> str: # noqa: E501
def test_query_style_deep_object_explode_true_object(self, query_object : Optional[Dict[str, Dict[str, Any]]] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
@@ -394,7 +394,7 @@ class QueryApi(object):
return self.test_query_style_deep_object_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
def test_query_style_deep_object_explode_true_object_with_http_info(self, query_object : Optional[Dict[str, Dict[str, StrictStr]]] = None, **kwargs): # noqa: E501
def test_query_style_deep_object_explode_true_object_with_http_info(self, query_object : Optional[Dict[str, Dict[str, Any]]] = None, **kwargs): # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
@@ -643,7 +643,7 @@ class QueryApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_query_style_form_explode_true_array_string(self, query_object : Optional[Dict[str, StrictStr]] = None, **kwargs) -> str: # noqa: E501
def test_query_style_form_explode_true_array_string(self, query_object : Optional[Dict[str, Any]] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
@@ -674,7 +674,7 @@ class QueryApi(object):
return self.test_query_style_form_explode_true_array_string_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
def test_query_style_form_explode_true_array_string_with_http_info(self, query_object : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501
def test_query_style_form_explode_true_array_string_with_http_info(self, query_object : Optional[Dict[str, Any]] = None, **kwargs): # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
@@ -783,7 +783,7 @@ class QueryApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_query_style_form_explode_true_object(self, query_object : Optional[Dict[str, StrictStr]] = None, **kwargs) -> str: # noqa: E501
def test_query_style_form_explode_true_object(self, query_object : Optional[Dict[str, Any]] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
@@ -814,7 +814,7 @@ class QueryApi(object):
return self.test_query_style_form_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
def test_query_style_form_explode_true_object_with_http_info(self, query_object : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501
def test_query_style_form_explode_true_object_with_http_info(self, query_object : Optional[Dict[str, Any]] = None, **kwargs): # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501

View File

@@ -1,4 +1,5 @@
# coding: utf-8
"""
Echo Server API
@@ -6,10 +7,11 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import atexit
import datetime
@@ -37,10 +39,6 @@ class ApiClient(object):
the methods and models for each application are generated from the OpenAPI
templates.
NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
:param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to
@@ -66,7 +64,7 @@ class ApiClient(object):
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None, pool_threads=1):
# use default configuraiton if none is provided
# use default configuration if none is provided
if configuration is None:
configuration = Configuration.get_default()
self.configuration = configuration
@@ -231,7 +229,9 @@ class ApiClient(object):
response_type = response_types_map.get(str(response_data.status), None)
if response_type not in ["file", "bytes"]:
if response_type == "bytearray":
response_data.data = response_data.data
else:
match = None
content_type = response_data.getheader('content-type')
if content_type is not None:
@@ -240,8 +240,9 @@ class ApiClient(object):
response_data.data = response_data.data.decode(encoding)
# deserialize response data
if response_type:
if response_type == "bytearray":
return_data = response_data.data
elif response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None

View File

@@ -7,12 +7,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import copy
import logging
import multiprocessing
@@ -22,7 +22,6 @@ import urllib3
import http.client as httplib
from openapi_client.exceptions import ApiValueError
JSON_SCHEMA_VALIDATION_KEYWORDS = {
'multipleOf', 'maximum', 'exclusiveMaximum',
'minimum', 'exclusiveMinimum', 'maxLength',
@@ -30,10 +29,7 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
}
class Configuration(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""This class contains various settings of the API client.
:param host: Base url.
:param api_key: Dict to store API key(s).

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""

View File

@@ -8,18 +8,19 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
# import models into model package
from openapi_client.models.bird import Bird
from openapi_client.models.category import Category
from openapi_client.models.data_query import DataQuery
from openapi_client.models.data_query_all_of import DataQueryAllOf
from openapi_client.models.default_value import DefaultValue
from openapi_client.models.number_properties_only import NumberPropertiesOnly
from openapi_client.models.pet import Pet
from openapi_client.models.query import Query
from openapi_client.models.string_enum_ref import StringEnumRef

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -22,10 +24,8 @@ from typing import Optional
from pydantic import BaseModel, StrictStr
class Bird(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
Bird
"""
size: Optional[StrictStr] = None
color: Optional[StrictStr] = None

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -22,10 +24,8 @@ from typing import Optional
from pydantic import BaseModel, StrictInt, StrictStr
class Category(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
Category
"""
id: Optional[StrictInt] = None
name: Optional[StrictStr] = None

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -23,10 +25,8 @@ from pydantic import BaseModel, Field, StrictStr
from openapi_client.models.query import Query
class DataQuery(Query):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
DataQuery
"""
suffix: Optional[StrictStr] = Field(None, description="test suffix")
text: Optional[StrictStr] = Field(None, description="Some text containing white spaces")

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -22,10 +24,8 @@ from typing import Optional
from pydantic import BaseModel, Field, StrictStr
class DataQueryAllOf(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
DataQueryAllOf
"""
suffix: Optional[StrictStr] = Field(None, description="test suffix")
text: Optional[StrictStr] = Field(None, description="Some text containing white spaces")

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -23,10 +25,8 @@ from pydantic import BaseModel, StrictInt, StrictStr, conlist, validator
from openapi_client.models.string_enum_ref import StringEnumRef
class DefaultValue(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
to test the default value of properties
"""
array_string_enum_ref_default: Optional[conlist(StringEnumRef)] = None
array_string_enum_default: Optional[conlist(StrictStr)] = None
@@ -42,9 +42,9 @@ class DefaultValue(BaseModel):
def array_string_enum_default_validate_enum(cls, v):
if v is None:
return v
if v not in ('success', 'failure', 'unclassified'):
raise ValueError("must validate the enum values ('success', 'failure', 'unclassified')")
for i in v:
if i not in ('success', 'failure', 'unclassified'):
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
return v
class Config:
@@ -71,15 +71,18 @@ class DefaultValue(BaseModel):
},
exclude_none=True)
# set to None if array_string_nullable (nullable) is None
if self.array_string_nullable is None:
# and __fields_set__ contains the field
if self.array_string_nullable is None and "array_string_nullable" in self.__fields_set__:
_dict['array_string_nullable'] = None
# set to None if array_string_extension_nullable (nullable) is None
if self.array_string_extension_nullable is None:
# and __fields_set__ contains the field
if self.array_string_extension_nullable is None and "array_string_extension_nullable" in self.__fields_set__:
_dict['array_string_extension_nullable'] = None
# set to None if string_nullable (nullable) is None
if self.string_nullable is None:
# and __fields_set__ contains the field
if self.string_nullable is None and "string_nullable" in self.__fields_set__:
_dict['string_nullable'] = None
return _dict

View File

@@ -0,0 +1,75 @@
# coding: utf-8
"""
Echo Server API
Echo Server API # noqa: E501
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import annotations
from inspect import getfullargspec
import pprint
import re # noqa: F401
import json
from typing import Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt, confloat, conint
class NumberPropertiesOnly(BaseModel):
"""
NumberPropertiesOnly
"""
number: Optional[Union[StrictFloat, StrictInt]] = None
float: Optional[Union[StrictFloat, StrictInt]] = None
double: Optional[Union[confloat(le=50.2, ge=0.8, strict=True), conint(le=50, ge=1, strict=True)]] = None
__properties = ["number", "float", "double"]
class Config:
allow_population_by_field_name = True
validate_assignment = True
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> NumberPropertiesOnly:
"""Create an instance of NumberPropertiesOnly from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
},
exclude_none=True)
return _dict
@classmethod
def from_dict(cls, obj: dict) -> NumberPropertiesOnly:
"""Create an instance of NumberPropertiesOnly from a dict"""
if obj is None:
return None
if type(obj) is not dict:
return NumberPropertiesOnly.parse_obj(obj)
_obj = NumberPropertiesOnly.parse_obj({
"number": obj.get("number"),
"float": obj.get("float"),
"double": obj.get("double")
})
return _obj

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -24,10 +26,8 @@ from openapi_client.models.category import Category
from openapi_client.models.tag import Tag
class Pet(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
Pet
"""
id: Optional[StrictInt] = None
name: StrictStr = ...
@@ -41,9 +41,8 @@ class Pet(BaseModel):
def status_validate_enum(cls, v):
if v is None:
return v
if v not in ('available', 'pending', 'sold'):
raise ValueError("must validate the enum values ('available', 'pending', 'sold')")
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
return v
class Config:

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -22,10 +24,8 @@ from typing import List, Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator
class Query(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
Query
"""
id: Optional[StrictInt] = Field(None, description="Query")
outcomes: Optional[conlist(StrictStr)] = None
@@ -35,9 +35,9 @@ class Query(BaseModel):
def outcomes_validate_enum(cls, v):
if v is None:
return v
if v not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
raise ValueError("must validate the enum values ('SUCCESS', 'FAILURE', 'SKIPPED')")
for i in v:
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
return v
class Config:

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -21,16 +23,13 @@ from aenum import Enum, no_arg
class StringEnumRef(str, Enum):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
StringEnumRef
"""
"""
allowed enum values
"""
SUCCESS = 'success'
FAILURE = 'failure'
UNCLASSIFIED = 'unclassified'

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -22,10 +24,8 @@ from typing import Optional
from pydantic import BaseModel, StrictInt, StrictStr
class Tag(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
Tag
"""
id: Optional[StrictInt] = None
name: Optional[StrictStr] = None

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -22,10 +24,8 @@ from typing import Optional
from pydantic import BaseModel, StrictInt, StrictStr
class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
"""
size: Optional[StrictStr] = None
color: Optional[StrictStr] = None

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -22,10 +24,8 @@ from typing import List, Optional
from pydantic import BaseModel, StrictStr, conlist
class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
"""
values: Optional[conlist(StrictStr)] = None
__properties = ["values"]

View File

@@ -7,12 +7,12 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import absolute_import
import io
import json
import logging

View File

@@ -0,0 +1,27 @@
[tool.poetry]
name = "openapi_client"
version = "1.0.0"
description = "Echo Server API"
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
license = "Apache 2.0"
readme = "README.md"
repository = "https://github.com/GIT_REPO_ID/GIT_USER_ID"
keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"]
[tool.poetry.dependencies]
python = "^3.7"
urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
pydantic = "^1.10.5"
aenum = ">=3.1.11"
[tool.poetry.dev-dependencies]
pytest = ">=7.2.1"
tox = ">=3.9.0"
flake8 = ">=4.0.0"
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

View File

@@ -1,5 +1,5 @@
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.25.3
pydantic >= 1.10.2
pydantic >= 1.10.5, < 2
aenum >= 3.1.11

View File

@@ -7,7 +7,9 @@
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by: https://openapi-generator.tech
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
@@ -25,7 +27,7 @@ PYTHON_REQUIRES = ">=3.7"
REQUIRES = [
"urllib3 >= 1.25.3",
"python-dateutil",
"pydantic",
"pydantic >= 1.10.5, < 2",
"aenum"
]

View File

@@ -14,6 +14,7 @@ from __future__ import absolute_import
import unittest
import datetime
import base64
import openapi_client
from openapi_client.api.query_api import QueryApi # noqa: E501
@@ -51,16 +52,23 @@ class TestManual(unittest.TestCase):
e = EchoServerResponseParser(api_response)
self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=2013-10-20T19%3A20%3A30.000000-0500&date_query=2013-10-20&string_query=string_query_example")
def testDateTimeQueryWithString(self):
api_instance = openapi_client.QueryApi()
datetime_query = '19:20:30 2013-10-20' # datetime | (optional)
date_query = '2013-10-20' # date | (optional)
string_query = 'string_query_example' # str | (optional)
# Test query parameter(s)
api_response = api_instance.test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query)
e = EchoServerResponseParser(api_response)
self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=19%3A20%3A30%202013-10-20&date_query=2013-10-20&string_query=string_query_example")
def testBinaryGif(self):
api_instance = openapi_client.BodyApi()
# Test binary response
api_response = api_instance.test_binary_gif()
self.assertEqual((base64.b64encode(api_response)).decode("utf-8"), "R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")
def testNumberPropertiesOnly(self):
n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123, "float": 456, "double": 34}')
self.assertEqual(n.number, 123)
self.assertEqual(n.float, 456)
self.assertEqual(n.double, 34)
n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123.1, "float": 456.2, "double": 34.3}')
self.assertEqual(n.number, 123.1)
self.assertEqual(n.float, 456.2)
self.assertEqual(n.double, 34.3)
class EchoServerResponseParser():
def __init__(self, http_response):

View File

@@ -0,0 +1,57 @@
# coding: utf-8
"""
Echo Server API
Echo Server API # noqa: E501
The version of the OpenAPI document: 0.1.0
Contact: team@openapitools.org
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
import unittest
import datetime
import openapi_client
from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501
from openapi_client.rest import ApiException
class TestNumberPropertiesOnly(unittest.TestCase):
"""NumberPropertiesOnly unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional):
"""Test NumberPropertiesOnly
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `NumberPropertiesOnly`
"""
model = openapi_client.models.number_properties_only.NumberPropertiesOnly() # noqa: E501
if include_optional :
return NumberPropertiesOnly(
number = 1.337,
float = 1.337,
double = ''
)
else :
return NumberPropertiesOnly(
)
"""
def testNumberPropertiesOnly(self):
"""Test NumberPropertiesOnly"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()