From 75e354ed71779033d3e98b65c3921ce68f08339d Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Thu, 29 Mar 2018 20:46:22 +0900 Subject: [PATCH] Fix broken map --- .../codegen/languages/PhpClientCodegen.java | 2 +- .../php/SwaggerClient-php/docs/Api/FakeApi.md | 4 ++-- .../php/SwaggerClient-php/docs/Api/StoreApi.md | 4 ++-- .../docs/Model/AdditionalPropertiesClass.md | 4 ++-- .../php/SwaggerClient-php/docs/Model/MapTest.md | 4 ++-- .../MixedPropertiesAndAdditionalPropertiesClass.md | 2 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 10 +++++----- .../php/SwaggerClient-php/lib/Api/StoreApi.php | 10 +++++----- .../lib/Model/AdditionalPropertiesClass.php | 12 ++++++------ .../php/SwaggerClient-php/lib/Model/MapTest.php | 12 ++++++------ .../MixedPropertiesAndAdditionalPropertiesClass.php | 6 +++--- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java index 45721f9a824..92100d44385 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java @@ -371,7 +371,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { ArraySchema ap = (ArraySchema) p; Schema inner = ap.getItems(); return getTypeDeclaration(inner) + "[]"; - } else if (p instanceof MapSchema) { + } else if (p.getAdditionalProperties() != null) { Schema inner = (Schema) p.getAdditionalProperties(); return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]"; } else if (StringUtils.isNotBlank(p.get$ref())) { diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md index 8b11778fca6..f68855dfd30 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md @@ -382,7 +382,7 @@ $apiInstance = new Swagger\Client\Api\FakeApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$UNKNOWN_PARAM_NAME = new \Swagger\Client\Model\map(); // map | request body +$UNKNOWN_PARAM_NAME = new \Swagger\Client\Model\map(); // map[string,string] | request body try { $apiInstance->testInlineAdditionalProperties($UNKNOWN_PARAM_NAME); @@ -396,7 +396,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **UNKNOWN_PARAM_NAME** | [**map**](../Model/map.md)| request body | + **UNKNOWN_PARAM_NAME** | [**map[string,string]**](../Model/map.md)| request body | ### Return type diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md index fa280c5829c..7b6f76ae9c0 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md @@ -59,7 +59,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) # **getInventory** -> map getInventory() +> map[string,int] getInventory() Returns pet inventories by status @@ -96,7 +96,7 @@ This endpoint does not need any parameter. ### Return type -[**map**](../Model/map.md) +[**map[string,int]**](../Model/map.md) ### Authorization diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/AdditionalPropertiesClass.md index 803e7c38fdd..b162fe9595f 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/AdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/AdditionalPropertiesClass.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**map_property** | **map** | | [optional] -**map_of_map_property** | [**map**](map.md) | | [optional] +**map_property** | **map[string,string]** | | [optional] +**map_of_map_property** | [**map[string,map[string,string]]**](map.md) | | [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) diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md index 8eef844ad86..e2781ccc398 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MapTest.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**map_map_of_string** | [**map**](map.md) | | [optional] -**map_of_enum_string** | **map** | | [optional] +**map_map_of_string** | [**map[string,map[string,string]]**](map.md) | | [optional] +**map_of_enum_string** | **map[string,string]** | | [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) diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md index 44cf3b949e3..1e3c4f7bfe1 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **string** | | [optional] **date_time** | [**\DateTime**](\DateTime.md) | | [optional] -**map** | [**map**](Animal.md) | | [optional] +**map** | [**map[string,\Swagger\Client\Model\Animal]**](Animal.md) | | [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) diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 08a41df152f..0db5bde5f4b 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -1801,7 +1801,7 @@ class FakeApi * * test inline additionalProperties * - * @param map $UNKNOWN_PARAM_NAME request body (required) + * @param map[string,string] $UNKNOWN_PARAM_NAME request body (required) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1817,7 +1817,7 @@ class FakeApi * * test inline additionalProperties * - * @param map $UNKNOWN_PARAM_NAME request body (required) + * @param map[string,string] $UNKNOWN_PARAM_NAME request body (required) * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1870,7 +1870,7 @@ class FakeApi * * test inline additionalProperties * - * @param map $UNKNOWN_PARAM_NAME request body (required) + * @param map[string,string] $UNKNOWN_PARAM_NAME request body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1890,7 +1890,7 @@ class FakeApi * * test inline additionalProperties * - * @param map $UNKNOWN_PARAM_NAME request body (required) + * @param map[string,string] $UNKNOWN_PARAM_NAME request body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1926,7 +1926,7 @@ class FakeApi /** * Create request for operation 'testInlineAdditionalProperties' * - * @param map $UNKNOWN_PARAM_NAME request body (required) + * @param map[string,string] $UNKNOWN_PARAM_NAME request body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 167ba59abca..664c4bc6baa 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -320,7 +320,7 @@ class StoreApi * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return map + * @return map[string,int] */ public function getInventory() { @@ -336,11 +336,11 @@ class StoreApi * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of map, HTTP status code, HTTP response headers (array of strings) + * @return array of map[string,int], HTTP status code, HTTP response headers (array of strings) */ public function getInventoryWithHttpInfo() { - $returnType = 'map'; + $returnType = 'map[string,int]'; $request = $this->getInventoryRequest(); try { @@ -392,7 +392,7 @@ class StoreApi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - 'map', + 'map[string,int]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -432,7 +432,7 @@ class StoreApi */ public function getInventoryAsyncWithHttpInfo() { - $returnType = 'map'; + $returnType = 'map[string,int]'; $request = $this->getInventoryRequest(); return $this->client diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php index b3fe8a57c21..7512ca4e5e4 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/AdditionalPropertiesClass.php @@ -57,8 +57,8 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'map_property' => 'map', - 'map_of_map_property' => 'map' + 'map_property' => 'map[string,string]', + 'map_of_map_property' => 'map[string,map[string,string]]' ]; /** @@ -214,7 +214,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess /** * Gets map_property * - * @return map + * @return map[string,string] */ public function getMapProperty() { @@ -224,7 +224,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess /** * Sets map_property * - * @param map $map_property map_property + * @param map[string,string] $map_property map_property * * @return $this */ @@ -238,7 +238,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess /** * Gets map_of_map_property * - * @return map + * @return map[string,map[string,string]] */ public function getMapOfMapProperty() { @@ -248,7 +248,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess /** * Sets map_of_map_property * - * @param map $map_of_map_property map_of_map_property + * @param map[string,map[string,string]] $map_of_map_property map_of_map_property * * @return $this */ diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php index e2e5c98add1..d96af580b0d 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MapTest.php @@ -57,8 +57,8 @@ class MapTest implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'map_map_of_string' => 'map', - 'map_of_enum_string' => 'map' + 'map_map_of_string' => 'map[string,map[string,string]]', + 'map_of_enum_string' => 'map[string,string]' ]; /** @@ -229,7 +229,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Gets map_map_of_string * - * @return map + * @return map[string,map[string,string]] */ public function getMapMapOfString() { @@ -239,7 +239,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Sets map_map_of_string * - * @param map $map_map_of_string map_map_of_string + * @param map[string,map[string,string]] $map_map_of_string map_map_of_string * * @return $this */ @@ -253,7 +253,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Gets map_of_enum_string * - * @return map + * @return map[string,string] */ public function getMapOfEnumString() { @@ -263,7 +263,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Sets map_of_enum_string * - * @param map $map_of_enum_string map_of_enum_string + * @param map[string,string] $map_of_enum_string map_of_enum_string * * @return $this */ diff --git a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php index 8601a841ece..fac70fa65e7 100644 --- a/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php +++ b/samples/openapi3/client/petstore/php/SwaggerClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php @@ -59,7 +59,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr protected static $swaggerTypes = [ 'uuid' => 'string', 'date_time' => '\DateTime', - 'map' => 'map' + 'map' => 'map[string,\Swagger\Client\Model\Animal]' ]; /** @@ -268,7 +268,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr /** * Gets map * - * @return map + * @return map[string,\Swagger\Client\Model\Animal] */ public function getMap() { @@ -278,7 +278,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr /** * Sets map * - * @param map $map map + * @param map[string,\Swagger\Client\Model\Animal] $map map * * @return $this */