forked from loafle/openapi-generator-original
php remove duplicated type mapping
This commit is contained in:
@@ -85,14 +85,13 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
typeMapping.put("string", "string");
|
typeMapping.put("string", "string");
|
||||||
typeMapping.put("byte", "int");
|
typeMapping.put("byte", "int");
|
||||||
typeMapping.put("boolean", "bool");
|
typeMapping.put("boolean", "bool");
|
||||||
typeMapping.put("date", "\\DateTime");
|
typeMapping.put("Date", "\\Date");
|
||||||
typeMapping.put("datetime", "\\DateTime");
|
typeMapping.put("DateTime", "\\DateTime");
|
||||||
typeMapping.put("file", "\\SplFileObject");
|
typeMapping.put("file", "\\SplFileObject");
|
||||||
typeMapping.put("map", "map");
|
typeMapping.put("map", "map");
|
||||||
typeMapping.put("array", "array");
|
typeMapping.put("array", "array");
|
||||||
typeMapping.put("list", "array");
|
typeMapping.put("list", "array");
|
||||||
typeMapping.put("object", "object");
|
typeMapping.put("object", "object");
|
||||||
typeMapping.put("DateTime", "\\DateTime");
|
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||||
|
|||||||
@@ -738,86 +738,6 @@ class PetApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* downloadFile
|
|
||||||
*
|
|
||||||
* downloads an image
|
|
||||||
*
|
|
||||||
* @return \Swagger\Client\Model\File
|
|
||||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
|
||||||
*/
|
|
||||||
public function downloadFile()
|
|
||||||
{
|
|
||||||
list($response, $statusCode, $httpHeader) = $this->downloadFileWithHttpInfo ();
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* downloadFileWithHttpInfo
|
|
||||||
*
|
|
||||||
* downloads an image
|
|
||||||
*
|
|
||||||
* @return Array of \Swagger\Client\Model\File, HTTP status code, HTTP response headers (array of strings)
|
|
||||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
|
||||||
*/
|
|
||||||
public function downloadFileWithHttpInfo()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
|
||||||
$resourcePath = "/pet/{petId}/downloadImage";
|
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
||||||
$method = "GET";
|
|
||||||
$httpBody = '';
|
|
||||||
$queryParams = array();
|
|
||||||
$headerParams = array();
|
|
||||||
$formParams = array();
|
|
||||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/octet-stream'));
|
|
||||||
if (!is_null($_header_accept)) {
|
|
||||||
$headerParams['Accept'] = $_header_accept;
|
|
||||||
}
|
|
||||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// for model (json/xml)
|
|
||||||
if (isset($_tempBody)) {
|
|
||||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
|
||||||
} elseif (count($formParams) > 0) {
|
|
||||||
$httpBody = $formParams; // for HTTP post (form)
|
|
||||||
}
|
|
||||||
|
|
||||||
// make the API Call
|
|
||||||
try {
|
|
||||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
|
||||||
$resourcePath, $method,
|
|
||||||
$queryParams, $httpBody,
|
|
||||||
$headerParams, '\Swagger\Client\Model\File'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\File', $httpHeader), $statusCode, $httpHeader);
|
|
||||||
|
|
||||||
} catch (ApiException $e) {
|
|
||||||
switch ($e->getCode()) {
|
|
||||||
case 200:
|
|
||||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\File', $e->getResponseHeaders());
|
|
||||||
$e->setResponseObject($data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uploadFile
|
* uploadFile
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class ObjectSerializer
|
|||||||
$deserialized = $values;
|
$deserialized = $values;
|
||||||
} elseif ($class === '\DateTime') {
|
} elseif ($class === '\DateTime') {
|
||||||
$deserialized = new \DateTime($data);
|
$deserialized = new \DateTime($data);
|
||||||
} elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
|
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||||
settype($data, $class);
|
settype($data, $class);
|
||||||
$deserialized = $data;
|
$deserialized = $data;
|
||||||
} elseif ($class === '\SplFileObject') {
|
} elseif ($class === '\SplFileObject') {
|
||||||
|
|||||||
Reference in New Issue
Block a user