forked from loafle/openapi-generator-original
* add ApiResponse/s to operation #4718 * use spaces instead of tabs #4718 * fix alignment issues #4920 * fix alignment issues #4920 * replace tabs with spaces #4920 * updated samples #4920
This commit is contained in:
parent
16adc7b373
commit
39eba39625
@ -21,7 +21,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
|||||||
protected String testResourcesFolder = "src/test/resources";
|
protected String testResourcesFolder = "src/test/resources";
|
||||||
protected String title = "Swagger Server";
|
protected String title = "Swagger Server";
|
||||||
|
|
||||||
protected boolean useBeanValidation = true;
|
protected boolean useBeanValidation = true;
|
||||||
|
|
||||||
static Logger LOGGER = LoggerFactory.getLogger(AbstractJavaJAXRSServerCodegen.class);
|
static Logger LOGGER = LoggerFactory.getLogger(AbstractJavaJAXRSServerCodegen.class);
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
|||||||
cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC));
|
||||||
cliOptions.add(new CliOption("title", "a title describing the application"));
|
cliOptions.add(new CliOption("title", "a title describing the application"));
|
||||||
|
|
||||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
|
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,13 +67,13 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
|||||||
implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER);
|
implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
|
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
|
||||||
this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
|
this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useBeanValidation) {
|
if (useBeanValidation) {
|
||||||
writePropertyBack(USE_BEANVALIDATION, useBeanValidation);
|
writePropertyBack(USE_BEANVALIDATION, useBeanValidation);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +153,12 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
|||||||
if ( "0".equals(resp.code) ) {
|
if ( "0".equals(resp.code) ) {
|
||||||
resp.code = "200";
|
resp.code = "200";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set vendorExtensions.x-java-is-response-void to true as dataType is set to "void"
|
||||||
|
if (resp.dataType == null) {
|
||||||
|
resp.vendorExtensions.put("x-java-is-response-void", true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,8 +226,8 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
|||||||
return outputFolder + "/" + output + "/" + apiPackage().replace('.', '/');
|
return outputFolder + "/" + output + "/" + apiPackage().replace('.', '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||||
this.useBeanValidation = useBeanValidation;
|
this.useBeanValidation = useBeanValidation;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
|
|||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.jaxrs.PATCH;
|
import io.swagger.jaxrs.PATCH;
|
||||||
{{#useBeanValidation}}
|
{{#useBeanValidation}}
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@ -38,6 +40,8 @@ public interface {{classname}} {
|
|||||||
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} })
|
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} })
|
||||||
{{/hasProduces}}
|
{{/hasProduces}}
|
||||||
@ApiOperation(value = "{{{summary}}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
@ApiOperation(value = "{{{summary}}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
||||||
|
@ApiResponses(value = { {{#responses}}
|
||||||
|
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{/vendorExtensions.x-java-is-response-void}}){{#hasMore}},{{/hasMore}}{{/responses}} })
|
||||||
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class {{classname}}Test {
|
|||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
|
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
|
||||||
{{/allParams}}
|
{{/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}}{{>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}}
|
{{^vendorExtensions.x-java-is-response-void}}//assertNotNull(response);{{/vendorExtensions.x-java-is-response-void}}
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
|
|||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.jaxrs.PATCH;
|
import io.swagger.jaxrs.PATCH;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@ -27,6 +29,8 @@ public interface FakeApi {
|
|||||||
@Consumes({ "application/json" })
|
@Consumes({ "application/json" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "To test \"client\" model", tags={ "fake", })
|
@ApiOperation(value = "To test \"client\" model", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Client.class) })
|
||||||
public Client testClientModel(Client body);
|
public Client testClientModel(Client body);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@ -34,6 +38,9 @@ public interface FakeApi {
|
|||||||
@Consumes({ "application/xml; charset=utf-8", "application/json; charset=utf-8" })
|
@Consumes({ "application/xml; charset=utf-8", "application/json; charset=utf-8" })
|
||||||
@Produces({ "application/xml; charset=utf-8", "application/json; charset=utf-8" })
|
@Produces({ "application/xml; charset=utf-8", "application/json; charset=utf-8" })
|
||||||
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", tags={ "fake", })
|
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", tags={ "fake", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
public void testEndpointParameters(@Multipart(value = "number") BigDecimal number, @Multipart(value = "double") Double _double, @Multipart(value = "pattern_without_delimiter") String patternWithoutDelimiter, @Multipart(value = "byte") byte[] _byte, @Multipart(value = "integer", required = false) Integer integer, @Multipart(value = "int32", required = false) Integer int32, @Multipart(value = "int64", required = false) Long int64, @Multipart(value = "float", required = false) Float _float, @Multipart(value = "string", required = false) String string, @Multipart(value = "binary", required = false) byte[] binary, @Multipart(value = "date", required = false) LocalDate date, @Multipart(value = "dateTime", required = false) javax.xml.datatype.XMLGregorianCalendar dateTime, @Multipart(value = "password", required = false) String password, @Multipart(value = "callback", required = false) String paramCallback);
|
public void testEndpointParameters(@Multipart(value = "number") BigDecimal number, @Multipart(value = "double") Double _double, @Multipart(value = "pattern_without_delimiter") String patternWithoutDelimiter, @Multipart(value = "byte") byte[] _byte, @Multipart(value = "integer", required = false) Integer integer, @Multipart(value = "int32", required = false) Integer int32, @Multipart(value = "int64", required = false) Long int64, @Multipart(value = "float", required = false) Float _float, @Multipart(value = "string", required = false) String string, @Multipart(value = "binary", required = false) byte[] binary, @Multipart(value = "date", required = false) LocalDate date, @Multipart(value = "dateTime", required = false) javax.xml.datatype.XMLGregorianCalendar dateTime, @Multipart(value = "password", required = false) String password, @Multipart(value = "callback", required = false) String paramCallback);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@ -41,6 +48,9 @@ public interface FakeApi {
|
|||||||
@Consumes({ "*/*" })
|
@Consumes({ "*/*" })
|
||||||
@Produces({ "*/*" })
|
@Produces({ "*/*" })
|
||||||
@ApiOperation(value = "To test enum parameters", tags={ "fake" })
|
@ApiOperation(value = "To test enum parameters", tags={ "fake" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid request"),
|
||||||
|
@ApiResponse(code = 404, message = "Not found") })
|
||||||
public void testEnumParameters(@Multipart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray, @Multipart(value = "enum_form_string", required = false) String enumFormString, @HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray, @HeaderParam("enum_header_string") String enumHeaderString, @QueryParam("enum_query_string_array") List<String> enumQueryStringArray, @QueryParam("enum_query_string") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @Multipart(value = "enum_query_double", required = false) Double enumQueryDouble);
|
public void testEnumParameters(@Multipart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray, @Multipart(value = "enum_form_string", required = false) String enumFormString, @HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray, @HeaderParam("enum_header_string") String enumHeaderString, @QueryParam("enum_query_string_array") List<String> enumQueryStringArray, @QueryParam("enum_query_string") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @Multipart(value = "enum_query_double", required = false) Double enumQueryDouble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
|
|||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.jaxrs.PATCH;
|
import io.swagger.jaxrs.PATCH;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@ -27,30 +29,44 @@ public interface PetApi {
|
|||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
|
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 405, message = "Invalid input") })
|
||||||
public void addPet(Pet body);
|
public void addPet(Pet body);
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/pet/{petId}")
|
@Path("/pet/{petId}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
|
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid pet value") })
|
||||||
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
|
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/pet/findByStatus")
|
@Path("/pet/findByStatus")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
|
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid status value") })
|
||||||
public List<Pet> findPetsByStatus(@QueryParam("status") @NotNull List<String> status);
|
public List<Pet> findPetsByStatus(@QueryParam("status") @NotNull List<String> status);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/pet/findByTags")
|
@Path("/pet/findByTags")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
|
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid tag value") })
|
||||||
public List<Pet> findPetsByTags(@QueryParam("tags") @NotNull List<String> tags);
|
public List<Pet> findPetsByTags(@QueryParam("tags") @NotNull List<String> tags);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/pet/{petId}")
|
@Path("/pet/{petId}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
|
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Pet not found") })
|
||||||
public Pet getPetById(@PathParam("petId") Long petId);
|
public Pet getPetById(@PathParam("petId") Long petId);
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@ -58,6 +74,10 @@ public interface PetApi {
|
|||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
|
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Pet not found"),
|
||||||
|
@ApiResponse(code = 405, message = "Validation exception") })
|
||||||
public void updatePet(Pet body);
|
public void updatePet(Pet body);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@ -65,6 +85,8 @@ public interface PetApi {
|
|||||||
@Consumes({ "application/x-www-form-urlencoded" })
|
@Consumes({ "application/x-www-form-urlencoded" })
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
|
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 405, message = "Invalid input") })
|
||||||
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
|
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@ -72,6 +94,8 @@ public interface PetApi {
|
|||||||
@Consumes({ "multipart/form-data" })
|
@Consumes({ "multipart/form-data" })
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "uploads an image", tags={ "pet" })
|
@ApiOperation(value = "uploads an image", tags={ "pet" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||||
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
|
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
|
|||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.jaxrs.PATCH;
|
import io.swagger.jaxrs.PATCH;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@ -25,24 +27,36 @@ public interface StoreApi {
|
|||||||
@Path("/store/order/{orderId}")
|
@Path("/store/order/{orderId}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
|
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Order not found") })
|
||||||
public void deleteOrder(@PathParam("orderId") String orderId);
|
public void deleteOrder(@PathParam("orderId") String orderId);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/store/inventory")
|
@Path("/store/inventory")
|
||||||
@Produces({ "application/json" })
|
@Produces({ "application/json" })
|
||||||
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
|
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
|
||||||
public Map<String, Integer> getInventory();
|
public Map<String, Integer> getInventory();
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/store/order/{orderId}")
|
@Path("/store/order/{orderId}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
|
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "Order not found") })
|
||||||
public Order getOrderById(@PathParam("orderId") @Min(1) @Max(5) Long orderId);
|
public Order getOrderById(@PathParam("orderId") @Min(1) @Max(5) Long orderId);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/store/order")
|
@Path("/store/order")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
|
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid Order") })
|
||||||
public Order placeOrder(Order body);
|
public Order placeOrder(Order body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
|
|||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.jaxrs.PATCH;
|
import io.swagger.jaxrs.PATCH;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@ -25,48 +27,69 @@ public interface UserApi {
|
|||||||
@Path("/user")
|
@Path("/user")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Create user", tags={ "user", })
|
@ApiOperation(value = "Create user", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
public void createUser(User body);
|
public void createUser(User body);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/user/createWithArray")
|
@Path("/user/createWithArray")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
public void createUsersWithArrayInput(List<User> body);
|
public void createUsersWithArrayInput(List<User> body);
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/user/createWithList")
|
@Path("/user/createWithList")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
public void createUsersWithListInput(List<User> body);
|
public void createUsersWithListInput(List<User> body);
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/user/{username}")
|
@Path("/user/{username}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Delete user", tags={ "user", })
|
@ApiOperation(value = "Delete user", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
public void deleteUser(@PathParam("username") String username);
|
public void deleteUser(@PathParam("username") String username);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/user/{username}")
|
@Path("/user/{username}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Get user by user name", tags={ "user", })
|
@ApiOperation(value = "Get user by user name", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = User.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
public User getUserByName(@PathParam("username") String username);
|
public User getUserByName(@PathParam("username") String username);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/user/login")
|
@Path("/user/login")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Logs user into the system", tags={ "user", })
|
@ApiOperation(value = "Logs user into the system", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||||
|
@ApiResponse(code = 400, message = "Invalid username/password supplied") })
|
||||||
public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password);
|
public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/user/logout")
|
@Path("/user/logout")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
|
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "successful operation") })
|
||||||
public void logoutUser();
|
public void logoutUser();
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/user/{username}")
|
@Path("/user/{username}")
|
||||||
@Produces({ "application/xml", "application/json" })
|
@Produces({ "application/xml", "application/json" })
|
||||||
@ApiOperation(value = "Updated user", tags={ "user" })
|
@ApiOperation(value = "Updated user", tags={ "user" })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 400, message = "Invalid user supplied"),
|
||||||
|
@ApiResponse(code = 404, message = "User not found") })
|
||||||
public void updateUser(@PathParam("username") String username, User body);
|
public void updateUser(@PathParam("username") String username, User body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class FakeApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testClientModelTest() {
|
public void testClientModelTest() {
|
||||||
Client body = null;
|
Client body = null;
|
||||||
//Client response = api.testClientModel(body);
|
//Client response = api.testClientModel(body);
|
||||||
//assertNotNull(response);
|
//assertNotNull(response);
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public class FakeApiTest {
|
|||||||
javax.xml.datatype.XMLGregorianCalendar dateTime = null;
|
javax.xml.datatype.XMLGregorianCalendar dateTime = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
String paramCallback = null;
|
String paramCallback = null;
|
||||||
//api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
//api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public class FakeApiTest {
|
|||||||
String enumQueryString = null;
|
String enumQueryString = null;
|
||||||
Integer enumQueryInteger = null;
|
Integer enumQueryInteger = null;
|
||||||
Double enumQueryDouble = null;
|
Double enumQueryDouble = null;
|
||||||
//api.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
//api.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* Swagger Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
* Contact: apiteam@swagger.io
|
||||||
@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import io.swagger.model.Pet;
|
|
||||||
import io.swagger.model.ModelApiResponse;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import io.swagger.model.ModelApiResponse;
|
||||||
|
import io.swagger.model.Pet;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
@ -117,7 +117,7 @@ public class PetApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void findPetsByStatusTest() {
|
public void findPetsByStatusTest() {
|
||||||
List<String> status = null;
|
List<String> status = null;
|
||||||
//Pet response = api.findPetsByStatus(status);
|
//List<Pet> response = api.findPetsByStatus(status);
|
||||||
//assertNotNull(response);
|
//assertNotNull(response);
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ public class PetApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void findPetsByTagsTest() {
|
public void findPetsByTagsTest() {
|
||||||
List<String> tags = null;
|
List<String> tags = null;
|
||||||
//Pet response = api.findPetsByTags(tags);
|
//List<Pet> response = api.findPetsByTags(tags);
|
||||||
//assertNotNull(response);
|
//assertNotNull(response);
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* Swagger Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
* Contact: apiteam@swagger.io
|
||||||
@ -96,7 +96,7 @@ public class StoreApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void getInventoryTest() {
|
public void getInventoryTest() {
|
||||||
//Integer response = api.getInventory();
|
//Map<String, Integer> response = api.getInventory();
|
||||||
//assertNotNull(response);
|
//assertNotNull(response);
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Swagger Petstore
|
* Swagger Petstore
|
||||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
* Contact: apiteam@swagger.io
|
||||||
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import io.swagger.model.User;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import io.swagger.model.User;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user