Merge pull request #24 from ackintosh/fix-enum_query_double

Fix 'enum_query_double' definition
This commit is contained in:
William Cheng 2018-04-08 16:57:10 +08:00 committed by GitHub
commit 113e8ad9fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 111 deletions

View File

@ -690,7 +690,7 @@ paths:
enum:
- 1.1
- -1.2
in: formData
in: query
description: Query parameter enum test (double)
responses:
'400':

View File

@ -629,6 +629,15 @@ paths:
enum:
- 1
- -2
- name: enum_query_double
in: query
description: Query parameter enum test (double)
schema:
type: number
format: double
enum:
- 1.1
- -1.2
responses:
'400':
description: Invalid request
@ -657,13 +666,6 @@ paths:
- '-efg'
- (xyz)
default: '-efg'
enum_query_double:
description: Query parameter enum test (double)
type: number
format: double
enum:
- 1.1
- -1.2
post:
tags:
- fake

View File

@ -342,7 +342,7 @@ void (empty response body)
[[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)
# **testEnumParameters**
> testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double)
> testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string)
To test enum parameters
@ -363,12 +363,12 @@ $enum_header_string = "enum_header_string_example"; // string | Header parameter
$enum_query_string_array = array("enum_query_string_array_example"); // string[] | Query parameter enum test (string array)
$enum_query_string = "enum_query_string_example"; // string | Query parameter enum test (string)
$enum_query_integer = 56; // int | Query parameter enum test (double)
$enum_query_double = 1.2; // double | Query parameter enum test (double)
$enum_form_string_array = new \Swagger\Client\Model\array(); // string[] | Form parameter enum test (string array)
$enum_form_string = "enum_form_string_example"; // string | Form parameter enum test (string)
$enum_query_double = 3.4; // double | Query parameter enum test (double)
try {
$apiInstance->testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double);
$apiInstance->testEnumParameters($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->testEnumParameters: ', $e->getMessage(), PHP_EOL;
}
@ -384,9 +384,9 @@ Name | Type | Description | Notes
**enum_query_string_array** | [**string[]**](../Model/string.md)| Query parameter enum test (string array) | [optional]
**enum_query_string** | **string**| Query parameter enum test (string) | [optional]
**enum_query_integer** | **int**| Query parameter enum test (double) | [optional]
**enum_query_double** | **double**| Query parameter enum test (double) | [optional]
**enum_form_string_array** | [**string[]**](../Model/array.md)| Form parameter enum test (string array) | [optional]
**enum_form_string** | **string**| Form parameter enum test (string) | [optional]
**enum_query_double** | **double**| Query parameter enum test (double) | [optional]
### Return type

View File

@ -5,7 +5,6 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enum_form_string_array** | **string[]** | Form parameter enum test (string array) | [optional]
**enum_form_string** | **string** | Form parameter enum test (string) | [optional] [default to '-efg']
**enum_query_double** | **double** | Query parameter enum test (double) | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1743,17 +1743,17 @@ class FakeApi
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
* @param string $enum_query_string Query parameter enum test (string) (optional)
* @param int $enum_query_integer Query parameter enum test (double) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
* @param string[] $enum_form_string_array Form parameter enum test (string array) (optional)
* @param string $enum_form_string Form parameter enum test (string) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function testEnumParameters($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null)
public function testEnumParameters($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
{
$this->testEnumParametersWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double);
$this->testEnumParametersWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string);
}
/**
@ -1766,18 +1766,18 @@ class FakeApi
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
* @param string $enum_query_string Query parameter enum test (string) (optional)
* @param int $enum_query_integer Query parameter enum test (double) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
* @param string[] $enum_form_string_array Form parameter enum test (string array) (optional)
* @param string $enum_form_string Form parameter enum test (string) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null)
public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
{
$returnType = '';
$request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double);
$request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string);
try {
$options = $this->createHttpClientOption();
@ -1826,16 +1826,16 @@ class FakeApi
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
* @param string $enum_query_string Query parameter enum test (string) (optional)
* @param int $enum_query_integer Query parameter enum test (double) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
* @param string[] $enum_form_string_array Form parameter enum test (string array) (optional)
* @param string $enum_form_string Form parameter enum test (string) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null)
public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
{
return $this->testEnumParametersAsyncWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double)
return $this->testEnumParametersAsyncWithHttpInfo($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string)
->then(
function ($response) {
return $response[0];
@ -1853,17 +1853,17 @@ class FakeApi
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
* @param string $enum_query_string Query parameter enum test (string) (optional)
* @param int $enum_query_integer Query parameter enum test (double) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
* @param string[] $enum_form_string_array Form parameter enum test (string array) (optional)
* @param string $enum_form_string Form parameter enum test (string) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null)
public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
{
$returnType = '';
$request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_form_string_array, $enum_form_string, $enum_query_double);
$request = $this->testEnumParametersRequest($enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double, $enum_form_string_array, $enum_form_string);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
@ -1896,14 +1896,14 @@ class FakeApi
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
* @param string $enum_query_string Query parameter enum test (string) (optional)
* @param int $enum_query_integer Query parameter enum test (double) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
* @param string[] $enum_form_string_array Form parameter enum test (string array) (optional)
* @param string $enum_form_string Form parameter enum test (string) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_form_string_array = null, $enum_form_string = null, $enum_query_double = null)
protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
{
$resourcePath = '/fake';
@ -1928,6 +1928,10 @@ class FakeApi
if ($enum_query_integer !== null) {
$queryParams['enum_query_integer'] = ObjectSerializer::toQueryValue($enum_query_integer);
}
// query params
if ($enum_query_double !== null) {
$queryParams['enum_query_double'] = ObjectSerializer::toQueryValue($enum_query_double);
}
// header params
if ($enum_header_string_array !== null) {
$headerParams['enum_header_string_array'] = ObjectSerializer::toHeaderValue($enum_header_string_array);
@ -1946,10 +1950,6 @@ class FakeApi
if ($enum_form_string !== null) {
$formParams['enum_form_string'] = ObjectSerializer::toFormValue($enum_form_string);
}
// form params
if ($enum_query_double !== null) {
$formParams['enum_query_double'] = ObjectSerializer::toFormValue($enum_query_double);
}
// body params
$_tempBody = null;

View File

@ -58,8 +58,7 @@ class Body2 implements ModelInterface, ArrayAccess
*/
protected static $swaggerTypes = [
'enum_form_string_array' => 'string[]',
'enum_form_string' => 'string',
'enum_query_double' => 'double'
'enum_form_string' => 'string'
];
/**
@ -69,8 +68,7 @@ class Body2 implements ModelInterface, ArrayAccess
*/
protected static $swaggerFormats = [
'enum_form_string_array' => null,
'enum_form_string' => null,
'enum_query_double' => 'double'
'enum_form_string' => null
];
/**
@ -101,8 +99,7 @@ class Body2 implements ModelInterface, ArrayAccess
*/
protected static $attributeMap = [
'enum_form_string_array' => 'enum_form_string_array',
'enum_form_string' => 'enum_form_string',
'enum_query_double' => 'enum_query_double'
'enum_form_string' => 'enum_form_string'
];
/**
@ -112,8 +109,7 @@ class Body2 implements ModelInterface, ArrayAccess
*/
protected static $setters = [
'enum_form_string_array' => 'setEnumFormStringArray',
'enum_form_string' => 'setEnumFormString',
'enum_query_double' => 'setEnumQueryDouble'
'enum_form_string' => 'setEnumFormString'
];
/**
@ -123,8 +119,7 @@ class Body2 implements ModelInterface, ArrayAccess
*/
protected static $getters = [
'enum_form_string_array' => 'getEnumFormStringArray',
'enum_form_string' => 'getEnumFormString',
'enum_query_double' => 'getEnumQueryDouble'
'enum_form_string' => 'getEnumFormString'
];
/**
@ -173,8 +168,6 @@ class Body2 implements ModelInterface, ArrayAccess
const ENUM_FORM_STRING_ABC = '_abc';
const ENUM_FORM_STRING_EFG = '-efg';
const ENUM_FORM_STRING_XYZ = '(xyz)';
const ENUM_QUERY_DOUBLE_1_DOT_1 = 1.1;
const ENUM_QUERY_DOUBLE_MINUS_1_DOT_2 = -1.2;
@ -205,19 +198,6 @@ class Body2 implements ModelInterface, ArrayAccess
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEnumQueryDoubleAllowableValues()
{
return [
self::ENUM_QUERY_DOUBLE_1_DOT_1,
self::ENUM_QUERY_DOUBLE_MINUS_1_DOT_2,
];
}
/**
* Associative array for storing property values
@ -236,7 +216,6 @@ class Body2 implements ModelInterface, ArrayAccess
{
$this->container['enum_form_string_array'] = isset($data['enum_form_string_array']) ? $data['enum_form_string_array'] : null;
$this->container['enum_form_string'] = isset($data['enum_form_string']) ? $data['enum_form_string'] : '-efg';
$this->container['enum_query_double'] = isset($data['enum_query_double']) ? $data['enum_query_double'] : null;
}
/**
@ -256,14 +235,6 @@ class Body2 implements ModelInterface, ArrayAccess
);
}
$allowedValues = $this->getEnumQueryDoubleAllowableValues();
if (!is_null($this->container['enum_query_double']) && !in_array($this->container['enum_query_double'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value for 'enum_query_double', must be one of '%s'",
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
@ -280,10 +251,6 @@ class Body2 implements ModelInterface, ArrayAccess
if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues, true)) {
return false;
}
$allowedValues = $this->getEnumQueryDoubleAllowableValues();
if (!is_null($this->container['enum_query_double']) && !in_array($this->container['enum_query_double'], $allowedValues, true)) {
return false;
}
return true;
}
@ -353,39 +320,6 @@ class Body2 implements ModelInterface, ArrayAccess
return $this;
}
/**
* Gets enum_query_double
*
* @return double
*/
public function getEnumQueryDouble()
{
return $this->container['enum_query_double'];
}
/**
* Sets enum_query_double
*
* @param double $enum_query_double Query parameter enum test (double)
*
* @return $this
*/
public function setEnumQueryDouble($enum_query_double)
{
$allowedValues = $this->getEnumQueryDoubleAllowableValues();
if (!is_null($enum_query_double) && !in_array($enum_query_double, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'enum_query_double', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
$this->container['enum_query_double'] = $enum_query_double;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*

View File

@ -89,11 +89,4 @@ class Body2Test extends \PHPUnit_Framework_TestCase
public function testPropertyEnumFormString()
{
}
/**
* Test attribute "enum_query_double"
*/
public function testPropertyEnumQueryDouble()
{
}
}

View File

@ -25,7 +25,7 @@ class ParametersTest extends \PHPUnit_Framework_TestCase
public function testHeaderParam()
{
$this->fakeApi->testEnumParameters([], [], [], 'something');
$this->fakeApi->testEnumParameters([], 'something');
$request = $this->fakeHttpClient->getLastRequest();
$headers = $request->getHeaders();
@ -36,7 +36,7 @@ class ParametersTest extends \PHPUnit_Framework_TestCase
public function testHeaderParamCollection()
{
$this->fakeApi->testEnumParameters([], [], ['string1', 'string2']);
$this->fakeApi->testEnumParameters(['string1', 'string2']);
$request = $this->fakeHttpClient->getLastRequest();
$headers = $request->getHeaders();