use parameter name as description if not defined (#6557)

This commit is contained in:
wing328
2017-09-24 21:18:49 +08:00
committed by GitHub
parent c501103540
commit 2d44d7f291
41 changed files with 185 additions and 148 deletions

View File

@@ -1,6 +1,6 @@
<?php
/**
* AnotherfakeApi
* AnotherFakeApi
* PHP version 5
*
* @category Class
@@ -17,7 +17,6 @@
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
*/
/**
@@ -39,14 +38,14 @@ use Swagger\Client\HeaderSelector;
use Swagger\Client\ObjectSerializer;
/**
* AnotherfakeApi Class Doc Comment
* AnotherFakeApi Class Doc Comment
*
* @category Class
* @package Swagger\Client
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class AnotherfakeApi
class AnotherFakeApi
{
/**
* @var ClientInterface

View File

@@ -1533,8 +1533,8 @@ class FakeApi
'Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters'
);
}
if (!preg_match("/^[A-Z].*_/", $pattern_without_delimiter)) {
throw new \InvalidArgumentException("invalid value for \"pattern_without_delimiter\" when calling FakeApi.testEndpointParameters, must conform to the pattern /^[A-Z].*_/.");
if (!preg_match("/^[A-Z].*/", $pattern_without_delimiter)) {
throw new \InvalidArgumentException("invalid value for \"pattern_without_delimiter\" when calling FakeApi.testEndpointParameters, must conform to the pattern /^[A-Z].*/.");
}
// verify the required parameter 'byte' is set

View File

@@ -59,8 +59,8 @@ class FakeClassnameTags123Api
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param Configuration $config
* @param HeaderSelector $selector
*/
public function __construct(
ClientInterface $client = null,
@@ -85,7 +85,8 @@ class FakeClassnameTags123Api
*
* To test class name in snake case
*
* @param \Swagger\Client\Model\Client $body client model (required)
* @param \Swagger\Client\Model\Client $body client model (required)
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \Swagger\Client\Model\Client
@@ -101,7 +102,8 @@ class FakeClassnameTags123Api
*
* To test class name in snake case
*
* @param \Swagger\Client\Model\Client $body client model (required)
* @param \Swagger\Client\Model\Client $body client model (required)
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
@@ -127,7 +129,11 @@ class FakeClassnameTags123Api
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
"[$statusCode] Error connecting to the API ({$request->getUri()})",
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
@@ -153,7 +159,11 @@ class FakeClassnameTags123Api
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Client', $e->getResponseHeaders());
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Swagger\Client\Model\Client',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
@@ -166,15 +176,19 @@ class FakeClassnameTags123Api
*
* To test class name in snake case
*
* @param \Swagger\Client\Model\Client $body client model (required)
* @param \Swagger\Client\Model\Client $body client model (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testClassnameAsync($body)
{
return $this->testClassnameAsyncWithHttpInfo($body)->then(function ($response) {
return $response[0];
});
return $this->testClassnameAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
@@ -182,7 +196,8 @@ class FakeClassnameTags123Api
*
* To test class name in snake case
*
* @param \Swagger\Client\Model\Client $body client model (required)
* @param \Swagger\Client\Model\Client $body client model (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
@@ -191,38 +206,48 @@ class FakeClassnameTags123Api
$returnType = '\Swagger\Client\Model\Client';
$request = $this->testClassnameRequest($body);
return $this->client->sendAsync($request)->then(function ($response) use ($returnType) {
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return $this->client
->sendAsync($request)
->then(
function ($response) use ($returnType) {
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
}, function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
"[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})",
$statusCode,
$response->getHeaders(),
$response->getBody()
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
);
});
}
/**
* Create request for operation 'testClassname'
*
* @param \Swagger\Client\Model\Client $body client model (required)
* @param \Swagger\Client\Model\Client $body client model (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
@@ -230,7 +255,9 @@ class FakeClassnameTags123Api
{
// verify the required parameter 'body' is set
if ($body === null) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling testClassname');
throw new \InvalidArgumentException(
'Missing the required parameter $body when calling testClassname'
);
}
$resourcePath = '/fake_classname_test';
@@ -272,13 +299,15 @@ class FakeClassnameTags123Api
'contents' => $formParamValue
];
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}
@@ -288,9 +317,6 @@ class FakeClassnameTags123Api
$queryParams['api_key_query'] = $apiKey;
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
@@ -302,9 +328,10 @@ class FakeClassnameTags123Api
$headers
);
$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'PATCH',
$url,
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);

View File

@@ -305,7 +305,7 @@ class PetApi
* Deletes a pet
*
* @param int $pet_id Pet id to delete (required)
* @param string $api_key (optional)
* @param string $api_key api_key (optional)
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException