Skip to content

Commit

Permalink
Fix an issue in Play Framework generator where a CSV is empty and tra…
Browse files Browse the repository at this point in the history
…nsfered to the controllerImp with an empty item. (#7496)
  • Loading branch information
JFCote authored and wing328 committed Jan 25, 2018
1 parent d1a2964 commit e33b350
Show file tree
Hide file tree
Showing 21 changed files with 150 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ public class {{classname}}Controller extends Controller {
List<String> {{paramName}}List = SwaggerUtils.parametersToList("{{collectionFormat}}", {{paramName}}Array);
{{{dataType}}} {{paramName}} = new Array{{{dataType}}}();
for (String curParam : {{paramName}}List) {
//noinspection UseBulkOperation
{{paramName}}.add({{>itemConversionBegin}}curParam{{>itemConversionEnd}});
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
{{paramName}}.add({{>itemConversionBegin}}curParam{{>itemConversionEnd}});
}
}
{{/collectionFormat}}
{{^collectionFormat}}
Expand Down Expand Up @@ -138,8 +140,10 @@ public class {{classname}}Controller extends Controller {
List<String> {{paramName}}List = SwaggerUtils.parametersToList("{{collectionFormat}}", {{paramName}}Array);
{{{dataType}}} {{paramName}} = new Array{{{dataType}}}();
for (String curParam : {{paramName}}List) {
//noinspection UseBulkOperation
{{paramName}}.add({{>itemConversionBegin}}curParam{{>itemConversionEnd}});
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
{{paramName}}.add({{>itemConversionBegin}}curParam{{>itemConversionEnd}});
}
}
{{/collectionFormat}}
{{^collectionFormat}}
Expand Down Expand Up @@ -169,8 +173,10 @@ public class {{classname}}Controller extends Controller {
List<String> {{paramName}}List = SwaggerUtils.parametersToList("{{collectionFormat}}", {{paramName}}Array);
{{{dataType}}} {{paramName}} = new Array{{{dataType}}}();
for (String curParam : {{paramName}}List) {
//noinspection UseBulkOperation
{{paramName}}.add({{>itemConversionBegin}}curParam{{>itemConversionEnd}});
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
{{paramName}}.add({{>itemConversionBegin}}curParam{{>itemConversionEnd}});
}
}
{{/collectionFormat}}
{{^collectionFormat}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public Result findPetsByStatus() throws Exception {
List<String> statusList = SwaggerUtils.parametersToList("csv", statusArray);
List<String> status = new ArrayList<String>();
for (String curParam : statusList) {
//noinspection UseBulkOperation
status.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
status.add(curParam);
}
}
List<Pet> obj = imp.findPetsByStatus(status);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand All @@ -97,8 +99,10 @@ public Result findPetsByTags() throws Exception {
List<String> tagsList = SwaggerUtils.parametersToList("csv", tagsArray);
List<String> tags = new ArrayList<String>();
for (String curParam : tagsList) {
//noinspection UseBulkOperation
tags.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
tags.add(curParam);
}
}
List<Pet> obj = imp.findPetsByTags(tags);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ public Result findPetsByStatus() throws Exception {
List<String> statusList = SwaggerUtils.parametersToList("csv", statusArray);
List<String> status = new ArrayList<String>();
for (String curParam : statusList) {
//noinspection UseBulkOperation
status.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
status.add(curParam);
}
}
return ok();
}
Expand All @@ -86,8 +88,10 @@ public Result findPetsByTags() throws Exception {
List<String> tagsList = SwaggerUtils.parametersToList("csv", tagsArray);
List<String> tags = new ArrayList<String>();
for (String curParam : tagsList) {
//noinspection UseBulkOperation
tags.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
tags.add(curParam);
}
}
return ok();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,10 @@ public Result testEnumParameters() throws Exception {
List<String> enumQueryStringArrayList = SwaggerUtils.parametersToList("csv", enumQueryStringArrayArray);
List<String> enumQueryStringArray = new ArrayList<String>();
for (String curParam : enumQueryStringArrayList) {
//noinspection UseBulkOperation
enumQueryStringArray.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
enumQueryStringArray.add(curParam);
}
}
String valueenumQueryString = request().getQueryString("enum_query_string");
String enumQueryString;
Expand All @@ -264,8 +266,10 @@ public Result testEnumParameters() throws Exception {
List<String> enumFormStringArrayList = SwaggerUtils.parametersToList("csv", enumFormStringArrayArray);
List<String> enumFormStringArray = new ArrayList<String>();
for (String curParam : enumFormStringArrayList) {
//noinspection UseBulkOperation
enumFormStringArray.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
enumFormStringArray.add(curParam);
}
}
String valueenumFormString = (request().body().asMultipartFormData().asFormUrlEncoded().get("enum_form_string"))[0];
String enumFormString;
Expand All @@ -285,8 +289,10 @@ public Result testEnumParameters() throws Exception {
List<String> enumHeaderStringArrayList = SwaggerUtils.parametersToList("csv", enumHeaderStringArrayArray);
List<String> enumHeaderStringArray = new ArrayList<String>();
for (String curParam : enumHeaderStringArrayList) {
//noinspection UseBulkOperation
enumHeaderStringArray.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
enumHeaderStringArray.add(curParam);
}
}
String valueenumHeaderString = request().getHeader("enum_header_string");
String enumHeaderString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public Result findPetsByStatus() throws Exception {
List<String> statusList = SwaggerUtils.parametersToList("csv", statusArray);
List<String> status = new ArrayList<String>();
for (String curParam : statusList) {
//noinspection UseBulkOperation
status.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
status.add(curParam);
}
}
List<Pet> obj = imp.findPetsByStatus(status);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand All @@ -97,8 +99,10 @@ public Result findPetsByTags() throws Exception {
List<String> tagsList = SwaggerUtils.parametersToList("csv", tagsArray);
List<String> tags = new ArrayList<String>();
for (String curParam : tagsList) {
//noinspection UseBulkOperation
tags.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
tags.add(curParam);
}
}
List<Pet> obj = imp.findPetsByTags(tags);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,51 @@
# This file defines all application routes (Higher priority routes first)
# ~~~~

GET /api controllers.ApiDocController.api


#Functions for AnotherFake API
PATCH /v2/another-fake/dummy controllers.AnotherFakeApiController.testSpecialTags()

#Functions for Fake API
POST /v2/fake/outer/boolean controllers.FakeApiController.fakeOuterBooleanSerialize()
POST /v2/fake/outer/composite controllers.FakeApiController.fakeOuterCompositeSerialize()
POST /v2/fake/outer/number controllers.FakeApiController.fakeOuterNumberSerialize()
POST /v2/fake/outer/string controllers.FakeApiController.fakeOuterStringSerialize()
PATCH /v2/fake controllers.FakeApiController.testClientModel()
POST /v2/fake controllers.FakeApiController.testEndpointParameters()
GET /v2/fake controllers.FakeApiController.testEnumParameters()
POST /v2/fake/inline-additionalProperties controllers.FakeApiController.testInlineAdditionalProperties()
GET /v2/fake/jsonFormData controllers.FakeApiController.testJsonFormData()

#Functions for FakeClassnameTags123 API
PATCH /v2/fake_classname_test controllers.FakeClassnameTags123ApiController.testClassname()

#Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet()
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus()
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags()
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet()
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long)

#Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory()
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder()

#Functions for User API
POST /v2/user controllers.UserApiController.createUser()
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput()
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput()
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String)
GET /v2/user/login controllers.UserApiController.loginUser()
GET /v2/user/logout controllers.UserApiController.logoutUser()
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String)
GET /api controllers.ApiDocController.api


#Functions for AnotherFake API
PATCH /v2/another-fake/dummy controllers.AnotherFakeApiController.testSpecialTags()

#Functions for Fake API
POST /v2/fake/outer/boolean controllers.FakeApiController.fakeOuterBooleanSerialize()
POST /v2/fake/outer/composite controllers.FakeApiController.fakeOuterCompositeSerialize()
POST /v2/fake/outer/number controllers.FakeApiController.fakeOuterNumberSerialize()
POST /v2/fake/outer/string controllers.FakeApiController.fakeOuterStringSerialize()
PATCH /v2/fake controllers.FakeApiController.testClientModel()
POST /v2/fake controllers.FakeApiController.testEndpointParameters()
GET /v2/fake controllers.FakeApiController.testEnumParameters()
POST /v2/fake/inline-additionalProperties controllers.FakeApiController.testInlineAdditionalProperties()
GET /v2/fake/jsonFormData controllers.FakeApiController.testJsonFormData()

#Functions for FakeClassnameTags123 API
PATCH /v2/fake_classname_test controllers.FakeClassnameTags123ApiController.testClassname()

#Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet()
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus()
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags()
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet()
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long)

#Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory()
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder()

#Functions for User API
POST /v2/user controllers.UserApiController.createUser()
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput()
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput()
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String)
GET /v2/user/login controllers.UserApiController.loginUser()
GET /v2/user/logout controllers.UserApiController.logoutUser()
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String)

# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ public Result findPetsByStatus() throws Exception {
List<String> statusList = SwaggerUtils.parametersToList("csv", statusArray);
List<String> status = new ArrayList<String>();
for (String curParam : statusList) {
//noinspection UseBulkOperation
status.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
status.add(curParam);
}
}
List<Pet> obj = imp.findPetsByStatus(status);
JsonNode result = mapper.valueToTree(obj);
Expand All @@ -85,8 +87,10 @@ public Result findPetsByTags() throws Exception {
List<String> tagsList = SwaggerUtils.parametersToList("csv", tagsArray);
List<String> tags = new ArrayList<String>();
for (String curParam : tagsList) {
//noinspection UseBulkOperation
tags.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
tags.add(curParam);
}
}
List<Pet> obj = imp.findPetsByTags(tags);
JsonNode result = mapper.valueToTree(obj);
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ public Result findPetsByStatus() {
List<String> statusList = SwaggerUtils.parametersToList("csv", statusArray);
List<String> status = new ArrayList<String>();
for (String curParam : statusList) {
//noinspection UseBulkOperation
status.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
status.add(curParam);
}
}
List<Pet> obj = imp.findPetsByStatus(status);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand All @@ -98,8 +100,10 @@ public Result findPetsByTags() {
List<String> tagsList = SwaggerUtils.parametersToList("csv", tagsArray);
List<String> tags = new ArrayList<String>();
for (String curParam : tagsList) {
//noinspection UseBulkOperation
tags.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
tags.add(curParam);
}
}
List<Pet> obj = imp.findPetsByTags(tags);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public Result findPetsByStatus() throws Exception {
List<String> statusList = SwaggerUtils.parametersToList("csv", statusArray);
List<String> status = new ArrayList<String>();
for (String curParam : statusList) {
//noinspection UseBulkOperation
status.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
status.add(curParam);
}
}
List<Pet> obj = imp.findPetsByStatus(status);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand All @@ -97,8 +99,10 @@ public Result findPetsByTags() throws Exception {
List<String> tagsList = SwaggerUtils.parametersToList("csv", tagsArray);
List<String> tags = new ArrayList<String>();
for (String curParam : tagsList) {
//noinspection UseBulkOperation
tags.add(curParam);
if (!curParam.isEmpty()) {
//noinspection UseBulkOperation
tags.add(curParam);
}
}
List<Pet> obj = imp.findPetsByTags(tags);
if (configuration.getBoolean("useOutputBeanValidation")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0-SNAPSHOT
Loading

0 comments on commit e33b350

Please sign in to comment.