Fix missing default value (#257)

* Fix missing default value of form param

* Update php sample with OAS2

* Update php sample with OAS3
This commit is contained in:
Akihito Nakano
2018-04-30 17:24:07 +09:00
committed by William Cheng
parent 42aebe4367
commit aa5719e008
50 changed files with 121 additions and 470 deletions

View File

@@ -1104,6 +1104,10 @@ public class DefaultCodegen implements CodegenConfig {
*/
@SuppressWarnings("static-method")
public String toDefaultValue(Schema schema) {
if (schema.getDefault() != null) {
return schema.getDefault().toString();
}
if (ModelUtils.isBooleanSchema(schema)) {
return "null";
} else if (ModelUtils.isDateSchema(schema)) {
@@ -4112,6 +4116,7 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.description = escapeText(codegenProperty.description);
codegenParameter.unescapedDescription = codegenProperty.getDescription();
codegenParameter.jsonSchema = Json.pretty(propertySchema);
codegenParameter.defaultValue = codegenProperty.getDefaultValue();
if (codegenProperty.getVendorExtensions() != null && !codegenProperty.getVendorExtensions().isEmpty()) {

View File

@@ -1,5 +1,6 @@
package org.openapitools.codegen;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
@@ -8,11 +9,13 @@ import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -157,4 +160,15 @@ public class DefaultCodegenTest {
Assert.assertEquals(aliases.size(), 0);
}
@Test
public void testFormParameterHasDefaultValue() {
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml", null, new ParseOptions()).getOpenAPI();
final DefaultCodegen codegen = new DefaultCodegen();
Schema requestBodySchema = codegen.getSchemaFromBody(openAPI.getPaths().get("/fake").getGet().getRequestBody());
CodegenParameter codegenParameter = codegen.fromFormProperty("enum_form_string", (Schema) requestBodySchema.getProperties().get("enum_form_string"), new HashSet<String>());
Assert.assertEquals(codegenParameter.defaultValue, "-efg");
}
}

View File

@@ -414,7 +414,7 @@ $enum_query_string = "-efg"; // string | Query parameter enum test (string)
$enum_query_integer = 56; // int | Query parameter enum test (double)
$enum_query_double = 3.4; // 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_form_string = "'-efg'"; // string | Form parameter enum test (string)
try {
$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);
@@ -435,7 +435,7 @@ Name | Type | Description | Notes
**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_form_string** | **string**| Form parameter enum test (string) | [optional] [default to &#39;-efg&#39;]
### Return type

View File

@@ -1983,13 +1983,13 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function testEnumParameters($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParameters($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$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);
}
@@ -2006,13 +2006,13 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @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 = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$returnType = '';
$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);
@@ -2066,12 +2066,12 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
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(
@@ -2093,12 +2093,12 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$returnType = '';
$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);
@@ -2136,12 +2136,12 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$resourcePath = '/fake';

View File

@@ -140,11 +140,8 @@ Class | Method | HTTP request | Description
- [Name](docs/Model/Name.md)
- [NumberOnly](docs/Model/NumberOnly.md)
- [Order](docs/Model/Order.md)
- [OuterBoolean](docs/Model/OuterBoolean.md)
- [OuterComposite](docs/Model/OuterComposite.md)
- [OuterEnum](docs/Model/OuterEnum.md)
- [OuterNumber](docs/Model/OuterNumber.md)
- [OuterString](docs/Model/OuterString.md)
- [Pet](docs/Model/Pet.md)
- [ReadOnlyFirst](docs/Model/ReadOnlyFirst.md)
- [SpecialModelName](docs/Model/SpecialModelName.md)

View File

@@ -51,7 +51,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json
[[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)

View File

@@ -16,7 +16,7 @@ Method | HTTP request | Description
# **fakeOuterBooleanSerialize**
> \Swagger\Client\Model\OuterBoolean fakeOuterBooleanSerialize($body)
> bool fakeOuterBooleanSerialize($body)
@@ -51,7 +51,7 @@ Name | Type | Description | Notes
### Return type
[**\Swagger\Client\Model\OuterBoolean**](../Model/OuterBoolean.md)
**bool**
### Authorization
@@ -114,7 +114,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)
# **fakeOuterNumberSerialize**
> \Swagger\Client\Model\OuterNumber fakeOuterNumberSerialize($body)
> float fakeOuterNumberSerialize($body)
@@ -149,7 +149,7 @@ Name | Type | Description | Notes
### Return type
[**\Swagger\Client\Model\OuterNumber**](../Model/OuterNumber.md)
**float**
### Authorization
@@ -163,7 +163,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)
# **fakeOuterStringSerialize**
> \Swagger\Client\Model\OuterString fakeOuterStringSerialize($body)
> string fakeOuterStringSerialize($body)
@@ -198,7 +198,7 @@ Name | Type | Description | Notes
### Return type
[**\Swagger\Client\Model\OuterString**](../Model/OuterString.md)
**string**
### Authorization
@@ -255,7 +255,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json
[[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)
@@ -365,7 +365,7 @@ $enum_query_string = "-efg"; // string | Query parameter enum test (string)
$enum_query_integer = 56; // int | Query parameter enum test (double)
$enum_query_double = 3.4; // 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_form_string = "'-efg'"; // string | Form parameter enum test (string)
try {
$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);
@@ -386,7 +386,7 @@ Name | Type | Description | Notes
**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_form_string** | **string**| Form parameter enum test (string) | [optional] [default to &#39;-efg&#39;]
### Return type

View File

@@ -57,7 +57,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json
[[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)

View File

@@ -59,7 +59,7 @@ void (empty response body)
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json, application/xml
- **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)
@@ -322,7 +322,7 @@ void (empty response body)
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json, application/xml
- **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)

View File

@@ -103,7 +103,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **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)
@@ -149,7 +149,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **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)

View File

@@ -3,9 +3,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**my_number** | [**\Swagger\Client\Model\OuterNumber**](OuterNumber.md) | | [optional]
**my_string** | [**\Swagger\Client\Model\OuterString**](OuterString.md) | | [optional]
**my_boolean** | [**\Swagger\Client\Model\OuterBoolean**](OuterBoolean.md) | | [optional]
**my_number** | **float** | | [optional]
**my_string** | **string** | | [optional]
**my_boolean** | **bool** | | [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

@@ -290,7 +290,7 @@ class AnotherFakeApi
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
[]
['application/json']
);
}

View File

@@ -94,7 +94,7 @@ class FakeApi
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \Swagger\Client\Model\OuterBoolean
* @return bool
*/
public function fakeOuterBooleanSerialize($body = null)
{
@@ -109,11 +109,11 @@ class FakeApi
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \Swagger\Client\Model\OuterBoolean, HTTP status code, HTTP response headers (array of strings)
* @return array of bool, HTTP status code, HTTP response headers (array of strings)
*/
public function fakeOuterBooleanSerializeWithHttpInfo($body = null)
{
$returnType = '\Swagger\Client\Model\OuterBoolean';
$returnType = 'bool';
$request = $this->fakeOuterBooleanSerializeRequest($body);
try {
@@ -165,7 +165,7 @@ class FakeApi
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Swagger\Client\Model\OuterBoolean',
'bool',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -207,7 +207,7 @@ class FakeApi
*/
public function fakeOuterBooleanSerializeAsyncWithHttpInfo($body = null)
{
$returnType = '\Swagger\Client\Model\OuterBoolean';
$returnType = 'bool';
$request = $this->fakeOuterBooleanSerializeRequest($body);
return $this->client
@@ -588,7 +588,7 @@ class FakeApi
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \Swagger\Client\Model\OuterNumber
* @return float
*/
public function fakeOuterNumberSerialize($body = null)
{
@@ -603,11 +603,11 @@ class FakeApi
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \Swagger\Client\Model\OuterNumber, HTTP status code, HTTP response headers (array of strings)
* @return array of float, HTTP status code, HTTP response headers (array of strings)
*/
public function fakeOuterNumberSerializeWithHttpInfo($body = null)
{
$returnType = '\Swagger\Client\Model\OuterNumber';
$returnType = 'float';
$request = $this->fakeOuterNumberSerializeRequest($body);
try {
@@ -659,7 +659,7 @@ class FakeApi
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Swagger\Client\Model\OuterNumber',
'float',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -701,7 +701,7 @@ class FakeApi
*/
public function fakeOuterNumberSerializeAsyncWithHttpInfo($body = null)
{
$returnType = '\Swagger\Client\Model\OuterNumber';
$returnType = 'float';
$request = $this->fakeOuterNumberSerializeRequest($body);
return $this->client
@@ -835,7 +835,7 @@ class FakeApi
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \Swagger\Client\Model\OuterString
* @return string
*/
public function fakeOuterStringSerialize($body = null)
{
@@ -850,11 +850,11 @@ class FakeApi
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \Swagger\Client\Model\OuterString, HTTP status code, HTTP response headers (array of strings)
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function fakeOuterStringSerializeWithHttpInfo($body = null)
{
$returnType = '\Swagger\Client\Model\OuterString';
$returnType = 'string';
$request = $this->fakeOuterStringSerializeRequest($body);
try {
@@ -906,7 +906,7 @@ class FakeApi
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Swagger\Client\Model\OuterString',
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -948,7 +948,7 @@ class FakeApi
*/
public function fakeOuterStringSerializeAsyncWithHttpInfo($body = null)
{
$returnType = '\Swagger\Client\Model\OuterString';
$returnType = 'string';
$request = $this->fakeOuterStringSerializeRequest($body);
return $this->client
@@ -1278,7 +1278,7 @@ class FakeApi
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
[]
['application/json']
);
}
@@ -1744,13 +1744,13 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function testEnumParameters($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParameters($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$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);
}
@@ -1767,13 +1767,13 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @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 = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParametersWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$returnType = '';
$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);
@@ -1827,12 +1827,12 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParametersAsync($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
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(
@@ -1854,12 +1854,12 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
public function testEnumParametersAsyncWithHttpInfo($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$returnType = '';
$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);
@@ -1897,12 +1897,12 @@ class FakeApi
* @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 string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = null)
protected function testEnumParametersRequest($enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null, $enum_form_string_array = null, $enum_form_string = ''-efg'')
{
$resourcePath = '/fake';

View File

@@ -290,7 +290,7 @@ class FakeClassnameTags123Api
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
[]
['application/json']
);
}

View File

@@ -253,7 +253,7 @@ class PetApi
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
['application/json', 'application/xml']
);
}
@@ -1512,7 +1512,7 @@ class PetApi
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
['application/json', 'application/xml']
);
}

View File

@@ -473,7 +473,7 @@ class UserApi
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
['application/json']
);
}
@@ -693,7 +693,7 @@ class UserApi
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
['application/json']
);
}

View File

@@ -206,8 +206,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -213,11 +213,7 @@ class Animal implements ModelInterface, ArrayAccess
*/
public function valid()
{
if ($this->container['class_name'] === null) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -199,11 +199,7 @@ class AnimalFarm implements ModelInterface, ArrayAccess
*/
public function valid()
{
if (!parent::valid()) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}
/**

View File

@@ -212,8 +212,7 @@ class ApiResponse implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -200,8 +200,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -200,8 +200,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -212,8 +212,7 @@ class ArrayTest implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -230,8 +230,7 @@ class Capitalization implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -194,11 +194,7 @@ class Cat extends Animal
*/
public function valid()
{
if (!parent::valid()) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -206,8 +206,7 @@ class Category implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -201,8 +201,7 @@ class ClassModel implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -200,8 +200,7 @@ class Client implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -194,11 +194,7 @@ class Dog extends Animal
*/
public function valid()
{
if (!parent::valid()) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -244,12 +244,7 @@ class EnumArrays implements ModelInterface, ArrayAccess
*/
public function valid()
{
$allowedValues = $this->getJustSymbolAllowableValues();
if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -323,27 +323,7 @@ class EnumTest implements ModelInterface, ArrayAccess
*/
public function valid()
{
$allowedValues = $this->getEnumStringAllowableValues();
if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) {
return false;
}
if ($this->container['enum_string_required'] === null) {
return false;
}
$allowedValues = $this->getEnumStringRequiredAllowableValues();
if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues, true)) {
return false;
}
$allowedValues = $this->getEnumIntegerAllowableValues();
if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues, true)) {
return false;
}
$allowedValues = $this->getEnumNumberAllowableValues();
if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -332,56 +332,7 @@ class FormatTest implements ModelInterface, ArrayAccess
*/
public function valid()
{
if ($this->container['integer'] > 100) {
return false;
}
if ($this->container['integer'] < 10) {
return false;
}
if ($this->container['int32'] > 200) {
return false;
}
if ($this->container['int32'] < 20) {
return false;
}
if ($this->container['number'] === null) {
return false;
}
if ($this->container['number'] > 543.2) {
return false;
}
if ($this->container['number'] < 32.1) {
return false;
}
if ($this->container['float'] > 987.6) {
return false;
}
if ($this->container['float'] < 54.3) {
return false;
}
if ($this->container['double'] > 123.4) {
return false;
}
if ($this->container['double'] < 67.8) {
return false;
}
if ($this->container['byte'] === null) {
return false;
}
if ($this->container['date'] === null) {
return false;
}
if ($this->container['password'] === null) {
return false;
}
if (mb_strlen($this->container['password']) > 64) {
return false;
}
if (mb_strlen($this->container['password']) < 10) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -206,8 +206,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -221,8 +221,7 @@ class MapTest implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -212,8 +212,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -207,8 +207,7 @@ class Model200Response implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -200,8 +200,7 @@ class ModelList implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -201,8 +201,7 @@ class ModelReturn implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -222,11 +222,7 @@ class Name implements ModelInterface, ArrayAccess
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -200,8 +200,7 @@ class NumberOnly implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -255,12 +255,7 @@ class Order implements ModelInterface, ArrayAccess
*/
public function valid()
{
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -57,9 +57,9 @@ class OuterComposite implements ModelInterface, ArrayAccess
* @var string[]
*/
protected static $swaggerTypes = [
'my_number' => '\Swagger\Client\Model\OuterNumber',
'my_string' => '\Swagger\Client\Model\OuterString',
'my_boolean' => '\Swagger\Client\Model\OuterBoolean'
'my_number' => 'float',
'my_string' => 'string',
'my_boolean' => 'bool'
];
/**
@@ -212,15 +212,14 @@ class OuterComposite implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets my_number
*
* @return \Swagger\Client\Model\OuterNumber
* @return float
*/
public function getMyNumber()
{
@@ -230,7 +229,7 @@ class OuterComposite implements ModelInterface, ArrayAccess
/**
* Sets my_number
*
* @param \Swagger\Client\Model\OuterNumber $my_number my_number
* @param float $my_number my_number
*
* @return $this
*/
@@ -244,7 +243,7 @@ class OuterComposite implements ModelInterface, ArrayAccess
/**
* Gets my_string
*
* @return \Swagger\Client\Model\OuterString
* @return string
*/
public function getMyString()
{
@@ -254,7 +253,7 @@ class OuterComposite implements ModelInterface, ArrayAccess
/**
* Sets my_string
*
* @param \Swagger\Client\Model\OuterString $my_string my_string
* @param string $my_string my_string
*
* @return $this
*/
@@ -268,7 +267,7 @@ class OuterComposite implements ModelInterface, ArrayAccess
/**
* Gets my_boolean
*
* @return \Swagger\Client\Model\OuterBoolean
* @return bool
*/
public function getMyBoolean()
{
@@ -278,7 +277,7 @@ class OuterComposite implements ModelInterface, ArrayAccess
/**
* Sets my_boolean
*
* @param \Swagger\Client\Model\OuterBoolean $my_boolean my_boolean
* @param bool $my_boolean my_boolean
*
* @return $this
*/

View File

@@ -261,18 +261,7 @@ class Pet implements ModelInterface, ArrayAccess
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}
if ($this->container['photo_urls'] === null) {
return false;
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
return false;
}
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -206,8 +206,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -200,8 +200,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -206,8 +206,7 @@ class Tag implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -242,8 +242,7 @@ class User implements ModelInterface, ArrayAccess
*/
public function valid()
{
return true;
return count($this->listInvalidProperties()) === 0;
}

View File

@@ -1,78 +0,0 @@
<?php
/**
* OuterBooleanTest
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 3.0.0-SNAPSHOT
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Swagger\Client;
/**
* OuterBooleanTest Class Doc Comment
*
* @category Class
* @description OuterBoolean
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class OuterBooleanTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
{
}
/**
* Setup before running each test case
*/
public function setUp()
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{
}
/**
* Test "OuterBoolean"
*/
public function testOuterBoolean()
{
}
}

View File

@@ -1,78 +0,0 @@
<?php
/**
* OuterNumberTest
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 3.0.0-SNAPSHOT
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Swagger\Client;
/**
* OuterNumberTest Class Doc Comment
*
* @category Class
* @description OuterNumber
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class OuterNumberTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
{
}
/**
* Setup before running each test case
*/
public function setUp()
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{
}
/**
* Test "OuterNumber"
*/
public function testOuterNumber()
{
}
}

View File

@@ -1,78 +0,0 @@
<?php
/**
* OuterStringTest
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 3.0.0-SNAPSHOT
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Swagger\Client;
/**
* OuterStringTest Class Doc Comment
*
* @category Class
* @description OuterString
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class OuterStringTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
{
}
/**
* Setup before running each test case
*/
public function setUp()
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{
}
/**
* Test "OuterString"
*/
public function testOuterString()
{
}
}