diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java index cadd7a1d85f..1d92c923c5c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java @@ -69,6 +69,7 @@ public abstract class AbstractGenerator { * * @param config Codegen config * @param templateFile Template file + * @return String Full template file path */ public String getFullTemplateFile(CodegenConfig config, String templateFile) { String library = config.getLibrary(); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java index a1b299f818c..d386b4c4dca 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java @@ -8,7 +8,7 @@ import java.util.List; public class CodegenParameter { public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, isContainer, - secondaryParam, isCollectionFormatMulti; + secondaryParam, isCollectionFormatMulti, isPrimitiveType; public String baseName, paramName, dataType, datatypeWithEnum, collectionFormat, description, baseType, defaultValue; public String example; // example value (x-example) public String jsonSchema; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 6f4987669bb..001de63baea 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1499,6 +1499,14 @@ public class DefaultCodegen { } } } + + // set isPrimitiveType and baseType for allParams + /*if (languageSpecificPrimitives.contains(p.baseType)) { + p.isPrimitiveType = true; + p.baseType = getSwaggerType(p); + }*/ + + allParams.add(p); if (param instanceof QueryParameter) { p.isQueryParam = new Boolean(true); @@ -1770,7 +1778,9 @@ public class DefaultCodegen { prop.setRequired(bp.getRequired()); CodegenProperty cp = fromProperty("property", prop); if (cp != null) { + p.baseType = cp.baseType; p.dataType = cp.datatype; + p.isPrimitiveType = cp.isPrimitiveType; p.isBinary = cp.datatype.toLowerCase().startsWith("byte"); } @@ -1790,6 +1800,8 @@ public class DefaultCodegen { } imports.add(cp.baseType); p.dataType = cp.datatype; + p.baseType = cp.complexType; + p.isPrimitiveType = cp.isPrimitiveType; p.isContainer = true; p.isListContainer = true; @@ -1810,6 +1822,7 @@ public class DefaultCodegen { name = getTypeDeclaration(name); } p.dataType = name; + p.baseType = name; } } p.paramName = toParamName(bp.getName()); @@ -2456,24 +2469,34 @@ public class DefaultCodegen { if (Boolean.TRUE.equals(property.isString)) { parameter.isString = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isBoolean)) { parameter.isBoolean = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isLong)) { parameter.isLong = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isInteger)) { parameter.isInteger = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isDouble)) { parameter.isDouble = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isFloat)) { parameter.isFloat = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isByteArray)) { parameter.isByteArray = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isBinary)) { parameter.isByteArray = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isDate)) { parameter.isDate = true; + parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isDateTime)) { parameter.isDateTime = true; + parameter.isPrimitiveType = true; } else { LOGGER.debug("Property type is not primitive: " + property.datatype); } diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 07d25457a2d..3833861dfc6 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore Automatically generated by the Perl Swagger Codegen project: -- Build date: 2016-03-06T14:25:02.405+08:00 +- Build date: 2016-03-06T15:35:17.711+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen - Codegen version: diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index 6d34a53b5c1..a40ed16c882 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -40,7 +40,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](docs/.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -82,7 +82,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](docs/.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -124,7 +124,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**ARRAY[string]**](docs/.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for query | [optional] [default to available] ### Return type @@ -166,7 +166,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**ARRAY[string]**](docs/.md)| Tags to filter by | [optional] + **tags** | [**ARRAY[string]**](string.md)| Tags to filter by | [optional] ### Return type @@ -208,7 +208,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | [**int**](docs/.md)| ID of pet that needs to be fetched | + **pet_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -252,9 +252,9 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | [**string**](docs/.md)| ID of pet that needs to be updated | - **name** | [**string**](docs/.md)| Updated name of the pet | [optional] - **status** | [**string**](docs/.md)| Updated status of the pet | [optional] + **pet_id** | **string**| ID of pet that needs to be updated | + **name** | **string**| Updated name of the pet | [optional] + **status** | **string**| Updated status of the pet | [optional] ### Return type @@ -297,8 +297,8 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | [**int**](docs/.md)| Pet id to delete | - **api_key** | [**string**](docs/.md)| | [optional] + **pet_id** | **int**| Pet id to delete | + **api_key** | **string**| | [optional] ### Return type @@ -342,9 +342,9 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | [**int**](docs/.md)| ID of pet to update | - **additional_metadata** | [**string**](docs/.md)| Additional data to pass to server | [optional] - **file** | [**File**](docs/.md)| file to upload | [optional] + **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **string**| Additional data to pass to server | [optional] + **file** | [**File**](.md)| file to upload | [optional] ### Return type @@ -386,7 +386,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | [**int**](docs/.md)| ID of pet that needs to be fetched | + **pet_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -428,7 +428,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | [**int**](docs/.md)| ID of pet that needs to be fetched | + **pet_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -470,7 +470,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**string**](docs/.md)| Pet object in the form of byte array | [optional] + **body** | **string**| Pet object in the form of byte array | [optional] ### Return type diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index 4ec81cd9b62..32326780dd2 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -35,7 +35,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**string**](docs/.md)| Status value that needs to be considered for query | [optional] [default to placed] + **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] ### Return type @@ -157,7 +157,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](docs/.md)| order placed for purchasing the pet | [optional] + **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] ### Return type @@ -199,7 +199,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | [**string**](docs/.md)| ID of pet that needs to be fetched | + **order_id** | **string**| ID of pet that needs to be fetched | ### Return type @@ -241,7 +241,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | [**string**](docs/.md)| ID of the order that needs to be deleted | + **order_id** | **string**| ID of the order that needs to be deleted | ### Return type diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index 98ec34cc0a0..33f8a7332c5 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -37,7 +37,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](docs/.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | [optional] ### Return type @@ -79,7 +79,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](docs/.md)| List of user object | [optional] + **body** | [**ARRAY[User]**](User.md)| List of user object | [optional] ### Return type @@ -121,7 +121,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](docs/.md)| List of user object | [optional] + **body** | [**ARRAY[User]**](User.md)| List of user object | [optional] ### Return type @@ -164,8 +164,8 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | [**string**](docs/.md)| The user name for login | [optional] - **password** | [**string**](docs/.md)| The password for login in clear text | [optional] + **username** | **string**| The user name for login | [optional] + **password** | **string**| The password for login in clear text | [optional] ### Return type @@ -247,7 +247,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | [**string**](docs/.md)| The name that needs to be fetched. Use user1 for testing. | + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | ### Return type @@ -290,8 +290,8 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | [**string**](docs/.md)| name that need to be deleted | - **body** | [**User**](docs/.md)| Updated user object | [optional] + **username** | **string**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | [optional] ### Return type @@ -333,7 +333,7 @@ if ($@) { ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | [**string**](docs/.md)| The name that needs to be deleted | + **username** | **string**| The name that needs to be deleted | ### Return type diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 88a3a36e9e0..0e709d87a59 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -37,7 +37,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-03-06T14:25:02.405+08:00', + generated_date => '2016-03-06T15:35:17.711+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-03-06T14:25:02.405+08:00 +=item Build date: 2016-03-06T15:35:17.711+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen