forked from loafle/openapi-generator-original
* Fix escaped regex values in Python client (#1517). * Override PythonClientCodegen toRegularExpression() method to correct issue with backslashes being escaped. This issue was a result of calling escapeText() in the parent DefaultCodegen class. * Only escape unescaped forward slashes in PythonClientCodegen. * Override addRegularExpressionDelimiter in PythonClientCodegen.java such that only unescaped forward slashes in the pattern get escaped. * Adds a new test resource .yaml file for specifically testing this issue. * Check for regular expression modifiers in PythonClientCodegen. * Adds check in postProcessPattern() in PythonClientCodegen.java to check if regular expression has modifiers defined. If so, it throws an exception as modifiers are not currently supported in the Python client. * PythonClientCodegen warns that regex modifiers are not supported. * Changes behavior in PythonClientCodegen.java to no longer throw an IllegalArgumentException in the case that a pattern contains modifiers. A warning message will be logged instead stating that modifiers are not currently supported by the codegen class. * Remove warning for PythonClientCodegen regex modifier support. * Removes warning message from PythonClientCodegen.java stating that regular expression modifiers are not currently supported. Further code review and testing revealed that this feature is already supported and working. * Add updated Python client sample files.
This commit is contained in:
@@ -381,6 +381,19 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addRegularExpressionDelimiter(String pattern) {
|
||||
if (StringUtils.isEmpty(pattern)) {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
if (!pattern.matches("^/.*")) {
|
||||
// Perform a negative lookbehind on each `/` to ensure that it is escaped.
|
||||
return "/" + pattern.replaceAll("(?<!\\\\)\\/", "\\\\/") + "/";
|
||||
}
|
||||
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
@@ -635,6 +648,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toRegularExpression(String pattern) {
|
||||
return addRegularExpressionDelimiter(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
String example;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
|
||||
package org.openapitools.codegen.python;
|
||||
|
||||
import io.swagger.parser.OpenAPIParser;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -54,4 +59,25 @@ public class PythonClientCodegenTest {
|
||||
Assert.assertEquals(codegen.isHideGenerationTimestamp(), false);
|
||||
}
|
||||
|
||||
@Test(description = "test regex patterns")
|
||||
public void testRegularExpressionOpenAPISchemaVersion3() {
|
||||
final OpenAPI openAPI = new OpenAPIParser()
|
||||
.readLocation("src/test/resources/3_0/issue_1517.yaml", null, new ParseOptions()).getOpenAPI();
|
||||
final PythonClientCodegen codegen = new PythonClientCodegen();
|
||||
final String path = "/ping";
|
||||
final Operation p = openAPI.getPaths().get(path).getGet();
|
||||
final CodegenOperation op = codegen.fromOperation(path, "get", p, openAPI.getComponents().getSchemas());
|
||||
// pattern_no_forward_slashes '^pattern$'
|
||||
Assert.assertEquals(op.allParams.get(0).pattern, "/^pattern$/");
|
||||
// pattern_two_slashes '/^pattern$/'
|
||||
Assert.assertEquals(op.allParams.get(1).pattern, "/^pattern$/");
|
||||
// pattern_dont_escape_backslash '/^pattern\d{3}$/'
|
||||
Assert.assertEquals(op.allParams.get(2).pattern, "/^pattern\\d{3}$/");
|
||||
// pattern_dont_escape_escaped_forward_slash '/^pattern\/\d{3}$/'
|
||||
Assert.assertEquals(op.allParams.get(3).pattern, "/^pattern\\/\\d{3}$/");
|
||||
// pattern_escape_unescaped_forward_slash '^pattern/\d{3}$'
|
||||
Assert.assertEquals(op.allParams.get(4).pattern, "/^pattern\\/\\d{3}$/");
|
||||
// pattern_with_modifiers '/^pattern\d{3}$/i
|
||||
Assert.assertEquals(op.allParams.get(5).pattern, "/^pattern\\d{3}$/i");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: Test Regex generation for parameter validation
|
||||
version: 1.0.0
|
||||
components:
|
||||
headers:
|
||||
|
||||
responses:
|
||||
OK_200:
|
||||
description: OK
|
||||
|
||||
paths:
|
||||
/ping:
|
||||
get:
|
||||
summary: Get Payment Information
|
||||
description: Returns the content of a payment object
|
||||
parameters:
|
||||
- name: pattern_no_forward_slashes
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^pattern$'
|
||||
- name: pattern_two_slashes
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
pattern: '/^pattern$/'
|
||||
- name: pattern_dont_escape_backslash
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^pattern\d{3}$'
|
||||
- name: pattern_dont_escape_escaped_forward_slash
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^pattern\/\d{3}$'
|
||||
- name: pattern_escape_unescaped_forward_slash
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^pattern/\d{3}$'
|
||||
- name: pattern_with_modifiers
|
||||
in: header
|
||||
schema:
|
||||
type: string
|
||||
pattern: '/^pattern\d{3}$/i'
|
||||
|
||||
responses:
|
||||
'200':
|
||||
$ref: "#/components/responses/OK_200"
|
||||
@@ -1 +1 @@
|
||||
2.3.0-SNAPSHOT
|
||||
3.3.4-SNAPSHOT
|
||||
@@ -1,11 +1,11 @@
|
||||
# petstore-api
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end --
|
||||
|
||||
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
- Package version: 1.0.0
|
||||
- Build package: io.swagger.codegen.languages.PythonClientCodegen
|
||||
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
|
||||
|
||||
## Requirements.
|
||||
|
||||
@@ -50,13 +50,14 @@ import time
|
||||
import petstore_api
|
||||
from petstore_api.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi()
|
||||
test_code_inject____end____rn_n_r = 'test_code_inject____end____rn_n_r_example' # str | To test code injection */ ' \" =end -- \\r\\n \\n \\r (optional)
|
||||
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
|
||||
unknown_base_type = petstore_api.UNKNOWN_BASE_TYPE() # UNKNOWN_BASE_TYPE | (optional)
|
||||
|
||||
try:
|
||||
# To test code injection */ ' \" =end -- \\r\\n \\n \\r
|
||||
api_instance.test_code_inject____end__rn_n_r(test_code_inject____end____rn_n_r=test_code_inject____end____rn_n_r)
|
||||
api_instance.test_code_inject____end__rn_n_r(unknown_base_type=unknown_base_type)
|
||||
except ApiException as e:
|
||||
print("Exception when calling FakeApi->test_code_inject____end__rn_n_r: %s\n" % e)
|
||||
|
||||
@@ -64,7 +65,7 @@ except ApiException as e:
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r*
|
||||
All URIs are relative to *http://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
@@ -97,5 +98,6 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Author
|
||||
|
||||
apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# petstore_api.FakeApi
|
||||
|
||||
All URIs are relative to *https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r*
|
||||
All URIs are relative to *http://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
@@ -8,7 +8,9 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **test_code_inject____end__rn_n_r**
|
||||
> test_code_inject____end__rn_n_r(test_code_inject____end____rn_n_r=test_code_inject____end____rn_n_r)
|
||||
> test_code_inject____end__rn_n_r(unknown_base_type=unknown_base_type)
|
||||
|
||||
To test code injection */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
To test code injection */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
@@ -22,11 +24,11 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi()
|
||||
test_code_inject____end____rn_n_r = 'test_code_inject____end____rn_n_r_example' # str | To test code injection */ ' \" =end -- \\r\\n \\n \\r (optional)
|
||||
unknown_base_type = petstore_api.UNKNOWN_BASE_TYPE() # UNKNOWN_BASE_TYPE | (optional)
|
||||
|
||||
try:
|
||||
# To test code injection */ ' \" =end -- \\r\\n \\n \\r
|
||||
api_instance.test_code_inject____end__rn_n_r(test_code_inject____end____rn_n_r=test_code_inject____end____rn_n_r)
|
||||
api_instance.test_code_inject____end__rn_n_r(unknown_base_type=unknown_base_type)
|
||||
except ApiException as e:
|
||||
print("Exception when calling FakeApi->test_code_inject____end__rn_n_r: %s\n" % e)
|
||||
```
|
||||
@@ -35,7 +37,7 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**test_code_inject____end____rn_n_r** | **str**| To test code injection */ ' \" =end -- \\r\\n \\n \\r | [optional]
|
||||
**unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -48,7 +50,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, */ \" =end --
|
||||
- **Accept**: application/json, */ \" =end --
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
@@ -36,7 +36,7 @@ git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
|
||||
@@ -3,18 +3,20 @@
|
||||
# flake8: noqa
|
||||
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
__version__ = "1.0.0"
|
||||
|
||||
# import apis into sdk package
|
||||
from petstore_api.api.fake_api import FakeApi
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ from petstore_api.api_client import ApiClient
|
||||
|
||||
|
||||
class FakeApi(object):
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator
|
||||
Ref: https://openapi-generator.tech
|
||||
|
||||
Do not edit the class manually.
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
def __init__(self, api_client=None):
|
||||
@@ -34,56 +34,59 @@ class FakeApi(object):
|
||||
self.api_client = api_client
|
||||
|
||||
def test_code_inject____end__rn_n_r(self, **kwargs): # noqa: E501
|
||||
"""To test code injection */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
|
||||
"""To test code injection */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
|
||||
|
||||
To test code injection */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async=True
|
||||
>>> thread = api.test_code_inject____end__rn_n_r(async=True)
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.test_code_inject____end__rn_n_r(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async bool
|
||||
:param str test_code_inject____end____rn_n_r: To test code injection */ ' \" =end -- \\r\\n \\n \\r
|
||||
:param async_req bool
|
||||
:param UNKNOWN_BASE_TYPE unknown_base_type:
|
||||
:return: None
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
kwargs['_return_http_data_only'] = True
|
||||
if kwargs.get('async'):
|
||||
if kwargs.get('async_req'):
|
||||
return self.test_code_inject____end__rn_n_r_with_http_info(**kwargs) # noqa: E501
|
||||
else:
|
||||
(data) = self.test_code_inject____end__rn_n_r_with_http_info(**kwargs) # noqa: E501
|
||||
return data
|
||||
|
||||
def test_code_inject____end__rn_n_r_with_http_info(self, **kwargs): # noqa: E501
|
||||
"""To test code injection */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
|
||||
"""To test code injection */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
|
||||
|
||||
To test code injection */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please pass async=True
|
||||
>>> thread = api.test_code_inject____end__rn_n_r_with_http_info(async=True)
|
||||
asynchronous HTTP request, please pass async_req=True
|
||||
>>> thread = api.test_code_inject____end__rn_n_r_with_http_info(async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async bool
|
||||
:param str test_code_inject____end____rn_n_r: To test code injection */ ' \" =end -- \\r\\n \\n \\r
|
||||
:param async_req bool
|
||||
:param UNKNOWN_BASE_TYPE unknown_base_type:
|
||||
:return: None
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
|
||||
all_params = ['test_code_inject____end____rn_n_r'] # noqa: E501
|
||||
all_params.append('async')
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['unknown_base_type'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
all_params.append('_request_timeout')
|
||||
|
||||
params = locals()
|
||||
for key, val in six.iteritems(params['kwargs']):
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_code_inject____end__rn_n_r" % key
|
||||
)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
local_var_params[key] = val
|
||||
del local_var_params['kwargs']
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -95,14 +98,10 @@ class FakeApi(object):
|
||||
|
||||
form_params = []
|
||||
local_var_files = {}
|
||||
if 'test_code_inject____end____rn_n_r' in params:
|
||||
form_params.append(('test code inject */ ' " =end -- \r\n \n \r', params['test_code_inject____end____rn_n_r'])) # noqa: E501
|
||||
|
||||
body_params = None
|
||||
# HTTP header `Accept`
|
||||
header_params['Accept'] = self.api_client.select_header_accept(
|
||||
['application/json', '*/ \" =end -- ']) # noqa: E501
|
||||
|
||||
if 'unknown_base_type' in local_var_params:
|
||||
body_params = local_var_params['unknown_base_type']
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
|
||||
['application/json', '*/ \" =end -- ']) # noqa: E501
|
||||
@@ -120,8 +119,8 @@ class FakeApi(object):
|
||||
files=local_var_files,
|
||||
response_type=None, # noqa: E501
|
||||
auth_settings=auth_settings,
|
||||
async=params.get('async'),
|
||||
_return_http_data_only=params.get('_return_http_data_only'),
|
||||
_preload_content=params.get('_preload_content', True),
|
||||
_request_timeout=params.get('_request_timeout'),
|
||||
async_req=local_var_params.get('async_req'),
|
||||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
||||
_preload_content=local_var_params.get('_preload_content', True),
|
||||
_request_timeout=local_var_params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# coding: utf-8
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
@@ -29,15 +29,15 @@ from petstore_api import rest
|
||||
|
||||
|
||||
class ApiClient(object):
|
||||
"""Generic API client for Swagger client library builds.
|
||||
"""Generic API client for OpenAPI client library builds.
|
||||
|
||||
Swagger generic API client. This client handles the client-
|
||||
OpenAPI generic API client. This client handles the client-
|
||||
server communication, and is invariant across implementations. Specifics of
|
||||
the methods and models for each application are generated from the Swagger
|
||||
the methods and models for each application are generated from the OpenAPI
|
||||
templates.
|
||||
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
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
|
||||
@@ -46,6 +46,8 @@ class ApiClient(object):
|
||||
the API.
|
||||
:param cookie: a cookie to include in the header when making calls
|
||||
to the API
|
||||
:param pool_threads: The number of threads to use for async requests
|
||||
to the API. More threads means more concurrent API requests.
|
||||
"""
|
||||
|
||||
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
|
||||
@@ -59,25 +61,37 @@ class ApiClient(object):
|
||||
'datetime': datetime.datetime,
|
||||
'object': object,
|
||||
}
|
||||
_pool = None
|
||||
|
||||
def __init__(self, configuration=None, header_name=None, header_value=None,
|
||||
cookie=None):
|
||||
cookie=None, pool_threads=None):
|
||||
if configuration is None:
|
||||
configuration = Configuration()
|
||||
self.configuration = configuration
|
||||
self.pool_threads = pool_threads
|
||||
|
||||
self.pool = ThreadPool()
|
||||
self.rest_client = rest.RESTClientObject(configuration)
|
||||
self.default_headers = {}
|
||||
if header_name is not None:
|
||||
self.default_headers[header_name] = header_value
|
||||
self.cookie = cookie
|
||||
# Set default User-Agent.
|
||||
self.user_agent = 'Swagger-Codegen/1.0.0/python'
|
||||
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||
|
||||
def __del__(self):
|
||||
self.pool.close()
|
||||
self.pool.join()
|
||||
if self._pool:
|
||||
self._pool.close()
|
||||
self._pool.join()
|
||||
self._pool = None
|
||||
|
||||
@property
|
||||
def pool(self):
|
||||
"""Create thread pool on first request
|
||||
avoids instantiating unused threadpool for blocking clients.
|
||||
"""
|
||||
if self._pool is None:
|
||||
self._pool = ThreadPool(self.pool_threads)
|
||||
return self._pool
|
||||
|
||||
@property
|
||||
def user_agent(self):
|
||||
@@ -177,7 +191,7 @@ class ApiClient(object):
|
||||
convert to string in iso8601 format.
|
||||
If obj is list, sanitize each element in the list.
|
||||
If obj is dict, return the dict.
|
||||
If obj is swagger model, return the properties dict.
|
||||
If obj is OpenAPI model, return the properties dict.
|
||||
|
||||
:param obj: The data to serialize.
|
||||
:return: The serialized form of data.
|
||||
@@ -199,12 +213,12 @@ class ApiClient(object):
|
||||
obj_dict = obj
|
||||
else:
|
||||
# Convert model obj to dict except
|
||||
# attributes `swagger_types`, `attribute_map`
|
||||
# attributes `openapi_types`, `attribute_map`
|
||||
# and attributes which value is not None.
|
||||
# Convert attribute name to json key in
|
||||
# model definition for request.
|
||||
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
|
||||
for attr, _ in six.iteritems(obj.swagger_types)
|
||||
for attr, _ in six.iteritems(obj.openapi_types)
|
||||
if getattr(obj, attr) is not None}
|
||||
|
||||
return {key: self.sanitize_for_serialization(val)
|
||||
@@ -245,12 +259,12 @@ class ApiClient(object):
|
||||
|
||||
if type(klass) == str:
|
||||
if klass.startswith('list['):
|
||||
sub_kls = re.match('list\[(.*)\]', klass).group(1)
|
||||
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
|
||||
return [self.__deserialize(sub_data, sub_kls)
|
||||
for sub_data in data]
|
||||
|
||||
if klass.startswith('dict('):
|
||||
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
|
||||
sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2)
|
||||
return {k: self.__deserialize(v, sub_kls)
|
||||
for k, v in six.iteritems(data)}
|
||||
|
||||
@@ -274,12 +288,12 @@ class ApiClient(object):
|
||||
def call_api(self, resource_path, method,
|
||||
path_params=None, query_params=None, header_params=None,
|
||||
body=None, post_params=None, files=None,
|
||||
response_type=None, auth_settings=None, async=None,
|
||||
response_type=None, auth_settings=None, async_req=None,
|
||||
_return_http_data_only=None, collection_formats=None,
|
||||
_preload_content=True, _request_timeout=None):
|
||||
"""Makes the HTTP request (synchronous) and returns deserialized data.
|
||||
|
||||
To make an async request, set the async parameter.
|
||||
To make an async_req request, set the async_req parameter.
|
||||
|
||||
:param resource_path: Path to method endpoint.
|
||||
:param method: Method to call.
|
||||
@@ -294,7 +308,7 @@ class ApiClient(object):
|
||||
:param response: Response data type.
|
||||
:param files dict: key -> filename, value -> filepath,
|
||||
for `multipart/form-data`.
|
||||
:param async bool: execute request asynchronously
|
||||
:param async_req bool: execute request asynchronously
|
||||
:param _return_http_data_only: response data without head status code
|
||||
and headers
|
||||
:param collection_formats: dict of collection formats for path, query,
|
||||
@@ -307,13 +321,13 @@ class ApiClient(object):
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:return:
|
||||
If async parameter is True,
|
||||
If async_req parameter is True,
|
||||
the request will be called asynchronously.
|
||||
The method will return the request thread.
|
||||
If parameter async is False or missing,
|
||||
If parameter async_req is False or missing,
|
||||
then the method will return the response directly.
|
||||
"""
|
||||
if not async:
|
||||
if not async_req:
|
||||
return self.__call_api(resource_path, method,
|
||||
path_params, query_params, header_params,
|
||||
body, post_params, files,
|
||||
@@ -546,7 +560,7 @@ class ApiClient(object):
|
||||
return data
|
||||
|
||||
def __deserialize_object(self, value):
|
||||
"""Return a original value.
|
||||
"""Return an original value.
|
||||
|
||||
:return: object.
|
||||
"""
|
||||
@@ -599,13 +613,13 @@ class ApiClient(object):
|
||||
:return: model object.
|
||||
"""
|
||||
|
||||
if not klass.swagger_types and not hasattr(klass,
|
||||
if not klass.openapi_types and not hasattr(klass,
|
||||
'get_real_child_model'):
|
||||
return data
|
||||
|
||||
kwargs = {}
|
||||
if klass.swagger_types is not None:
|
||||
for attr, attr_type in six.iteritems(klass.swagger_types):
|
||||
if klass.openapi_types is not None:
|
||||
for attr, attr_type in six.iteritems(klass.openapi_types):
|
||||
if (data is not None and
|
||||
klass.attribute_map[attr] in data and
|
||||
isinstance(data, (list, dict))):
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
@@ -38,16 +38,16 @@ class TypeWithDefault(type):
|
||||
|
||||
|
||||
class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator
|
||||
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
Ref: https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""Constructor"""
|
||||
# Default Base url
|
||||
self.host = "https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r"
|
||||
self.host = "http://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r"
|
||||
# Temp file folder for downloading files
|
||||
self.temp_folder_path = None
|
||||
|
||||
@@ -134,17 +134,6 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
||||
self.logger_file_handler.setFormatter(self.logger_formatter)
|
||||
for _, logger in six.iteritems(self.logger):
|
||||
logger.addHandler(self.logger_file_handler)
|
||||
if self.logger_stream_handler:
|
||||
logger.removeHandler(self.logger_stream_handler)
|
||||
else:
|
||||
# If not set logging file,
|
||||
# then add stream handler and remove file handler.
|
||||
self.logger_stream_handler = logging.StreamHandler()
|
||||
self.logger_stream_handler.setFormatter(self.logger_formatter)
|
||||
for _, logger in six.iteritems(self.logger):
|
||||
logger.addHandler(self.logger_stream_handler)
|
||||
if self.logger_file_handler:
|
||||
logger.removeHandler(self.logger_file_handler)
|
||||
|
||||
@property
|
||||
def debug(self):
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
# flake8: noqa
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
@@ -18,19 +18,20 @@ import six
|
||||
|
||||
|
||||
class ModelReturn(object):
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
Ref: https://openapi-generator.tech
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
"""
|
||||
Attributes:
|
||||
swagger_types (dict): The key is attribute name
|
||||
openapi_types (dict): The key is attribute name
|
||||
and the value is attribute type.
|
||||
attribute_map (dict): The key is attribute name
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
swagger_types = {
|
||||
openapi_types = {
|
||||
'_return': 'int'
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ class ModelReturn(object):
|
||||
}
|
||||
|
||||
def __init__(self, _return=None): # noqa: E501
|
||||
"""ModelReturn - a model defined in Swagger""" # noqa: E501
|
||||
"""ModelReturn - a model defined in OpenAPI""" # noqa: E501
|
||||
|
||||
self.__return = None
|
||||
self.discriminator = None
|
||||
@@ -74,7 +75,7 @@ class ModelReturn(object):
|
||||
"""Returns the model properties as a dict"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in six.iteritems(self.swagger_types):
|
||||
for attr, _ in six.iteritems(self.openapi_types):
|
||||
value = getattr(self, attr)
|
||||
if isinstance(value, list):
|
||||
result[attr] = list(map(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from six.moves.urllib.parse import urlencode
|
||||
try:
|
||||
import urllib3
|
||||
except ImportError:
|
||||
raise ImportError('Swagger python client requires urllib3.')
|
||||
raise ImportError('OpenAPI Python client requires urllib3.')
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
|
||||
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Contact: something@something.abc */ ' \" =end -- \\r\\n \\n \\r
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"]
|
||||
setup(
|
||||
name=NAME,
|
||||
version=VERSION,
|
||||
description="Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r",
|
||||
author_email="apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r",
|
||||
description="OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r",
|
||||
author_email="something@something.abc */ ' \" =end -- \\r\\n \\n \\r",
|
||||
url="",
|
||||
keywords=["Swagger", "Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r"],
|
||||
keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore */ ' \" =end -- \\r\\n \\n \\r"],
|
||||
install_requires=REQUIRES,
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
|
||||
@@ -488,7 +488,7 @@ 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)
|
||||
|
||||
# **test_group_parameters**
|
||||
> test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
|
||||
Fake endpoint to test group parameters (optional)
|
||||
|
||||
@@ -504,13 +504,16 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi()
|
||||
required_string_group = 56 # int | Required String in group parameters
|
||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||
required_int64_group = 56 # int | Required Integer in group parameters
|
||||
string_group = 56 # int | String in group parameters (optional)
|
||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||
int64_group = 56 # int | Integer in group parameters (optional)
|
||||
|
||||
try:
|
||||
# Fake endpoint to test group parameters (optional)
|
||||
api_instance.test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
except ApiException as e:
|
||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||
```
|
||||
@@ -519,6 +522,9 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**required_string_group** | **int**| Required String in group parameters |
|
||||
**required_boolean_group** | **bool**| Required Boolean in group parameters |
|
||||
**required_int64_group** | **int**| Required Integer in group parameters |
|
||||
**string_group** | **int**| String in group parameters | [optional]
|
||||
**boolean_group** | **bool**| Boolean in group parameters | [optional]
|
||||
**int64_group** | **int**| Integer in group parameters | [optional]
|
||||
|
||||
@@ -1009,16 +1009,19 @@ class FakeApi(object):
|
||||
_request_timeout=local_var_params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def test_group_parameters(self, **kwargs): # noqa: E501
|
||||
def test_group_parameters(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501
|
||||
"""Fake endpoint to test group parameters (optional) # noqa: E501
|
||||
|
||||
Fake endpoint to test group parameters (optional) # 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_group_parameters(async_req=True)
|
||||
>>> thread = api.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param int required_string_group: Required String in group parameters (required)
|
||||
:param bool required_boolean_group: Required Boolean in group parameters (required)
|
||||
:param int required_int64_group: Required Integer in group parameters (required)
|
||||
:param int string_group: String in group parameters
|
||||
:param bool boolean_group: Boolean in group parameters
|
||||
:param int int64_group: Integer in group parameters
|
||||
@@ -1028,21 +1031,24 @@ class FakeApi(object):
|
||||
"""
|
||||
kwargs['_return_http_data_only'] = True
|
||||
if kwargs.get('async_req'):
|
||||
return self.test_group_parameters_with_http_info(**kwargs) # noqa: E501
|
||||
return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501
|
||||
else:
|
||||
(data) = self.test_group_parameters_with_http_info(**kwargs) # noqa: E501
|
||||
(data) = self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501
|
||||
return data
|
||||
|
||||
def test_group_parameters_with_http_info(self, **kwargs): # noqa: E501
|
||||
def test_group_parameters_with_http_info(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501
|
||||
"""Fake endpoint to test group parameters (optional) # noqa: E501
|
||||
|
||||
Fake endpoint to test group parameters (optional) # 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_group_parameters_with_http_info(async_req=True)
|
||||
>>> thread = api.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param int required_string_group: Required String in group parameters (required)
|
||||
:param bool required_boolean_group: Required Boolean in group parameters (required)
|
||||
:param int required_int64_group: Required Integer in group parameters (required)
|
||||
:param int string_group: String in group parameters
|
||||
:param bool boolean_group: Boolean in group parameters
|
||||
:param int int64_group: Integer in group parameters
|
||||
@@ -1053,7 +1059,7 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['string_group', 'boolean_group', 'int64_group'] # noqa: E501
|
||||
all_params = ['required_string_group', 'required_boolean_group', 'required_int64_group', 'string_group', 'boolean_group', 'int64_group'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
@@ -1067,18 +1073,36 @@ class FakeApi(object):
|
||||
)
|
||||
local_var_params[key] = val
|
||||
del local_var_params['kwargs']
|
||||
# verify the required parameter 'required_string_group' is set
|
||||
if ('required_string_group' not in local_var_params or
|
||||
local_var_params['required_string_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_boolean_group' is set
|
||||
if ('required_boolean_group' not in local_var_params or
|
||||
local_var_params['required_boolean_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_int64_group' is set
|
||||
if ('required_int64_group' not in local_var_params or
|
||||
local_var_params['required_int64_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
|
||||
query_params = []
|
||||
if 'required_string_group' in local_var_params:
|
||||
query_params.append(('required_string_group', local_var_params['required_string_group'])) # noqa: E501
|
||||
if 'required_int64_group' in local_var_params:
|
||||
query_params.append(('required_int64_group', local_var_params['required_int64_group'])) # noqa: E501
|
||||
if 'string_group' in local_var_params:
|
||||
query_params.append(('string_group', local_var_params['string_group'])) # noqa: E501
|
||||
if 'int64_group' in local_var_params:
|
||||
query_params.append(('int64_group', local_var_params['int64_group'])) # noqa: E501
|
||||
|
||||
header_params = {}
|
||||
if 'required_boolean_group' in local_var_params:
|
||||
header_params['required_boolean_group'] = local_var_params['required_boolean_group'] # noqa: E501
|
||||
if 'boolean_group' in local_var_params:
|
||||
header_params['boolean_group'] = local_var_params['boolean_group'] # noqa: E501
|
||||
|
||||
|
||||
@@ -488,7 +488,7 @@ 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)
|
||||
|
||||
# **test_group_parameters**
|
||||
> test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
|
||||
Fake endpoint to test group parameters (optional)
|
||||
|
||||
@@ -504,13 +504,16 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi()
|
||||
required_string_group = 56 # int | Required String in group parameters
|
||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||
required_int64_group = 56 # int | Required Integer in group parameters
|
||||
string_group = 56 # int | String in group parameters (optional)
|
||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||
int64_group = 56 # int | Integer in group parameters (optional)
|
||||
|
||||
try:
|
||||
# Fake endpoint to test group parameters (optional)
|
||||
api_instance.test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
except ApiException as e:
|
||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||
```
|
||||
@@ -519,6 +522,9 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**required_string_group** | **int**| Required String in group parameters |
|
||||
**required_boolean_group** | **bool**| Required Boolean in group parameters |
|
||||
**required_int64_group** | **int**| Required Integer in group parameters |
|
||||
**string_group** | **int**| String in group parameters | [optional]
|
||||
**boolean_group** | **bool**| Boolean in group parameters | [optional]
|
||||
**int64_group** | **int**| Integer in group parameters | [optional]
|
||||
|
||||
@@ -1009,16 +1009,19 @@ class FakeApi(object):
|
||||
_request_timeout=local_var_params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def test_group_parameters(self, **kwargs): # noqa: E501
|
||||
def test_group_parameters(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501
|
||||
"""Fake endpoint to test group parameters (optional) # noqa: E501
|
||||
|
||||
Fake endpoint to test group parameters (optional) # 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_group_parameters(async_req=True)
|
||||
>>> thread = api.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param int required_string_group: Required String in group parameters (required)
|
||||
:param bool required_boolean_group: Required Boolean in group parameters (required)
|
||||
:param int required_int64_group: Required Integer in group parameters (required)
|
||||
:param int string_group: String in group parameters
|
||||
:param bool boolean_group: Boolean in group parameters
|
||||
:param int int64_group: Integer in group parameters
|
||||
@@ -1028,21 +1031,24 @@ class FakeApi(object):
|
||||
"""
|
||||
kwargs['_return_http_data_only'] = True
|
||||
if kwargs.get('async_req'):
|
||||
return self.test_group_parameters_with_http_info(**kwargs) # noqa: E501
|
||||
return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501
|
||||
else:
|
||||
(data) = self.test_group_parameters_with_http_info(**kwargs) # noqa: E501
|
||||
(data) = self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501
|
||||
return data
|
||||
|
||||
def test_group_parameters_with_http_info(self, **kwargs): # noqa: E501
|
||||
def test_group_parameters_with_http_info(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501
|
||||
"""Fake endpoint to test group parameters (optional) # noqa: E501
|
||||
|
||||
Fake endpoint to test group parameters (optional) # 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_group_parameters_with_http_info(async_req=True)
|
||||
>>> thread = api.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param int required_string_group: Required String in group parameters (required)
|
||||
:param bool required_boolean_group: Required Boolean in group parameters (required)
|
||||
:param int required_int64_group: Required Integer in group parameters (required)
|
||||
:param int string_group: String in group parameters
|
||||
:param bool boolean_group: Boolean in group parameters
|
||||
:param int int64_group: Integer in group parameters
|
||||
@@ -1053,7 +1059,7 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['string_group', 'boolean_group', 'int64_group'] # noqa: E501
|
||||
all_params = ['required_string_group', 'required_boolean_group', 'required_int64_group', 'string_group', 'boolean_group', 'int64_group'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
@@ -1067,18 +1073,36 @@ class FakeApi(object):
|
||||
)
|
||||
local_var_params[key] = val
|
||||
del local_var_params['kwargs']
|
||||
# verify the required parameter 'required_string_group' is set
|
||||
if ('required_string_group' not in local_var_params or
|
||||
local_var_params['required_string_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_boolean_group' is set
|
||||
if ('required_boolean_group' not in local_var_params or
|
||||
local_var_params['required_boolean_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_int64_group' is set
|
||||
if ('required_int64_group' not in local_var_params or
|
||||
local_var_params['required_int64_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
|
||||
query_params = []
|
||||
if 'required_string_group' in local_var_params:
|
||||
query_params.append(('required_string_group', local_var_params['required_string_group'])) # noqa: E501
|
||||
if 'required_int64_group' in local_var_params:
|
||||
query_params.append(('required_int64_group', local_var_params['required_int64_group'])) # noqa: E501
|
||||
if 'string_group' in local_var_params:
|
||||
query_params.append(('string_group', local_var_params['string_group'])) # noqa: E501
|
||||
if 'int64_group' in local_var_params:
|
||||
query_params.append(('int64_group', local_var_params['int64_group'])) # noqa: E501
|
||||
|
||||
header_params = {}
|
||||
if 'required_boolean_group' in local_var_params:
|
||||
header_params['required_boolean_group'] = local_var_params['required_boolean_group'] # noqa: E501
|
||||
if 'boolean_group' in local_var_params:
|
||||
header_params['boolean_group'] = local_var_params['boolean_group'] # noqa: E501
|
||||
|
||||
|
||||
@@ -488,7 +488,7 @@ 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)
|
||||
|
||||
# **test_group_parameters**
|
||||
> test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
|
||||
Fake endpoint to test group parameters (optional)
|
||||
|
||||
@@ -504,13 +504,16 @@ from pprint import pprint
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = petstore_api.FakeApi()
|
||||
required_string_group = 56 # int | Required String in group parameters
|
||||
required_boolean_group = True # bool | Required Boolean in group parameters
|
||||
required_int64_group = 56 # int | Required Integer in group parameters
|
||||
string_group = 56 # int | String in group parameters (optional)
|
||||
boolean_group = True # bool | Boolean in group parameters (optional)
|
||||
int64_group = 56 # int | Integer in group parameters (optional)
|
||||
|
||||
try:
|
||||
# Fake endpoint to test group parameters (optional)
|
||||
api_instance.test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
|
||||
except ApiException as e:
|
||||
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
|
||||
```
|
||||
@@ -519,6 +522,9 @@ except ApiException as e:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**required_string_group** | **int**| Required String in group parameters |
|
||||
**required_boolean_group** | **bool**| Required Boolean in group parameters |
|
||||
**required_int64_group** | **int**| Required Integer in group parameters |
|
||||
**string_group** | **int**| String in group parameters | [optional]
|
||||
**boolean_group** | **bool**| Boolean in group parameters | [optional]
|
||||
**int64_group** | **int**| Integer in group parameters | [optional]
|
||||
|
||||
@@ -1009,16 +1009,19 @@ class FakeApi(object):
|
||||
_request_timeout=local_var_params.get('_request_timeout'),
|
||||
collection_formats=collection_formats)
|
||||
|
||||
def test_group_parameters(self, **kwargs): # noqa: E501
|
||||
def test_group_parameters(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501
|
||||
"""Fake endpoint to test group parameters (optional) # noqa: E501
|
||||
|
||||
Fake endpoint to test group parameters (optional) # 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_group_parameters(async_req=True)
|
||||
>>> thread = api.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param int required_string_group: Required String in group parameters (required)
|
||||
:param bool required_boolean_group: Required Boolean in group parameters (required)
|
||||
:param int required_int64_group: Required Integer in group parameters (required)
|
||||
:param int string_group: String in group parameters
|
||||
:param bool boolean_group: Boolean in group parameters
|
||||
:param int int64_group: Integer in group parameters
|
||||
@@ -1028,21 +1031,24 @@ class FakeApi(object):
|
||||
"""
|
||||
kwargs['_return_http_data_only'] = True
|
||||
if kwargs.get('async_req'):
|
||||
return self.test_group_parameters_with_http_info(**kwargs) # noqa: E501
|
||||
return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501
|
||||
else:
|
||||
(data) = self.test_group_parameters_with_http_info(**kwargs) # noqa: E501
|
||||
(data) = self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501
|
||||
return data
|
||||
|
||||
def test_group_parameters_with_http_info(self, **kwargs): # noqa: E501
|
||||
def test_group_parameters_with_http_info(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501
|
||||
"""Fake endpoint to test group parameters (optional) # noqa: E501
|
||||
|
||||
Fake endpoint to test group parameters (optional) # 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_group_parameters_with_http_info(async_req=True)
|
||||
>>> thread = api.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, async_req=True)
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param int required_string_group: Required String in group parameters (required)
|
||||
:param bool required_boolean_group: Required Boolean in group parameters (required)
|
||||
:param int required_int64_group: Required Integer in group parameters (required)
|
||||
:param int string_group: String in group parameters
|
||||
:param bool boolean_group: Boolean in group parameters
|
||||
:param int int64_group: Integer in group parameters
|
||||
@@ -1053,7 +1059,7 @@ class FakeApi(object):
|
||||
|
||||
local_var_params = locals()
|
||||
|
||||
all_params = ['string_group', 'boolean_group', 'int64_group'] # noqa: E501
|
||||
all_params = ['required_string_group', 'required_boolean_group', 'required_int64_group', 'string_group', 'boolean_group', 'int64_group'] # noqa: E501
|
||||
all_params.append('async_req')
|
||||
all_params.append('_return_http_data_only')
|
||||
all_params.append('_preload_content')
|
||||
@@ -1067,18 +1073,36 @@ class FakeApi(object):
|
||||
)
|
||||
local_var_params[key] = val
|
||||
del local_var_params['kwargs']
|
||||
# verify the required parameter 'required_string_group' is set
|
||||
if ('required_string_group' not in local_var_params or
|
||||
local_var_params['required_string_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_boolean_group' is set
|
||||
if ('required_boolean_group' not in local_var_params or
|
||||
local_var_params['required_boolean_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_int64_group' is set
|
||||
if ('required_int64_group' not in local_var_params or
|
||||
local_var_params['required_int64_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
|
||||
query_params = []
|
||||
if 'required_string_group' in local_var_params:
|
||||
query_params.append(('required_string_group', local_var_params['required_string_group'])) # noqa: E501
|
||||
if 'required_int64_group' in local_var_params:
|
||||
query_params.append(('required_int64_group', local_var_params['required_int64_group'])) # noqa: E501
|
||||
if 'string_group' in local_var_params:
|
||||
query_params.append(('string_group', local_var_params['string_group'])) # noqa: E501
|
||||
if 'int64_group' in local_var_params:
|
||||
query_params.append(('int64_group', local_var_params['int64_group'])) # noqa: E501
|
||||
|
||||
header_params = {}
|
||||
if 'required_boolean_group' in local_var_params:
|
||||
header_params['required_boolean_group'] = local_var_params['required_boolean_group'] # noqa: E501
|
||||
if 'boolean_group' in local_var_params:
|
||||
header_params['boolean_group'] = local_var_params['boolean_group'] # noqa: E501
|
||||
|
||||
|
||||
Reference in New Issue
Block a user