forked from loafle/openapi-generator-original
* [JaxRS-CXF][bug #4330] support containers in return types before this commit if a method returned a container (List or Map) of THING (i.e. List<THING> or Map<String, THING>) the generated return type would drop the container and only leave THING. this commit fixes this issue such that the container type is properly generated. * regenerate jaxrs-cxf petstore sample
This commit is contained in:
parent
90cf1cab53
commit
5867728724
@ -37,7 +37,7 @@ public interface {{classname}} {
|
||||
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} })
|
||||
{{/hasProduces}}
|
||||
@ApiOperation(value = "{{summary}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
||||
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
|
@ -28,7 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
public class {{classname}}ServiceImpl implements {{classname}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||
// TODO: Implement...
|
||||
|
||||
{{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}
|
||||
|
@ -103,7 +103,7 @@ public class {{classname}}Test {
|
||||
{{#allParams}}
|
||||
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
|
||||
{{/allParams}}
|
||||
//{{^vendorExtensions.x-java-is-response-void}}{{{returnType}}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
//{{^vendorExtensions.x-java-is-response-void}}{{>returnTypes}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{^vendorExtensions.x-java-is-response-void}}//assertNotNull(response);{{/vendorExtensions.x-java-is-response-void}}
|
||||
// TODO: test validations
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
{{#returnContainer}}{{#isMapContainer}}Map<String, {{{returnType}}}>{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
|
@ -1,8 +1,8 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import io.swagger.model.Pet;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -18,8 +18,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface PetApi {
|
||||
|
||||
@POST
|
||||
@ -39,13 +37,13 @@ public interface PetApi {
|
||||
@Path("/pet/findByStatus")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
|
||||
public Pet findPetsByStatus(@QueryParam("status")List<String> status);
|
||||
public List<Pet> findPetsByStatus(@QueryParam("status")List<String> status);
|
||||
|
||||
@GET
|
||||
@Path("/pet/findByTags")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
|
||||
public Pet findPetsByTags(@QueryParam("tags")List<String> tags);
|
||||
public List<Pet> findPetsByTags(@QueryParam("tags")List<String> tags);
|
||||
|
||||
@GET
|
||||
@Path("/pet/{petId}")
|
||||
|
@ -17,8 +17,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface StoreApi {
|
||||
|
||||
@DELETE
|
||||
@ -31,7 +29,7 @@ public interface StoreApi {
|
||||
@Path("/store/inventory")
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
|
||||
public Integer getInventory();
|
||||
public Map<String, Integer> getInventory();
|
||||
|
||||
@GET
|
||||
@Path("/store/order/{orderId}")
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
import io.swagger.model.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -17,8 +17,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface UserApi {
|
||||
|
||||
@POST
|
||||
|
@ -1,9 +1,9 @@
|
||||
package io.swagger.api.impl;
|
||||
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import io.swagger.model.Pet;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -31,13 +31,13 @@ public class PetApiServiceImpl implements PetApi {
|
||||
|
||||
}
|
||||
|
||||
public Pet findPetsByStatus(List<String> status) {
|
||||
public List<Pet> findPetsByStatus(List<String> status) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Pet findPetsByTags(List<String> tags) {
|
||||
public List<Pet> findPetsByTags(List<String> tags) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
|
@ -24,7 +24,7 @@ public class StoreApiServiceImpl implements StoreApi {
|
||||
|
||||
}
|
||||
|
||||
public Integer getInventory() {
|
||||
public Map<String, Integer> getInventory() {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.swagger.api.impl;
|
||||
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
import io.swagger.model.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
Loading…
x
Reference in New Issue
Block a user