mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
Update the for play 2.7 (#7398)
* Fix the new package that deal with Configuration (the old one is depecrated) * First version to support Play Framework 2.7 * Fix small problems that prevent compilation of each samples. Now everything is compiling perfectly
This commit is contained in:
parent
684b77166b
commit
09200eb04e
@ -7,7 +7,7 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
{{#useSwaggerUI}}
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
{{/useSwaggerUI}}
|
||||
{{#useBeanValidation}}
|
||||
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -9,6 +9,10 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.io.FileInputStream;
|
||||
{{#supportAsync}}
|
||||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
{{/supportAsync}}
|
||||
{{#useBeanValidation}}
|
||||
import javax.validation.constraints.*;
|
||||
{{/useBeanValidation}}
|
||||
@ -17,7 +21,7 @@ import javax.validation.constraints.*;
|
||||
public class {{classname}}ControllerImp {{#useInterfaces}}implements {{classname}}ControllerImpInterface{{/useInterfaces}} {
|
||||
{{#operation}}
|
||||
{{#useInterfaces}}@Override{{/useInterfaces}}
|
||||
public {{^returnType}}void{{/returnType}}{{#returnType}}{{#supportAsync}}CompletionStage<{{/supportAsync}}{{>returnTypesNoVoid}}{{#supportAsync}}>{{/supportAsync}}{{/returnType}} {{operationId}}({{#allParams}}{{>pathParams}}{{>queryParams}}{{>bodyParams}}{{>formParams}}{{>headerParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#handleExceptions}}throws Exception{{/handleExceptions}} {
|
||||
public {{^returnType}}void{{/returnType}}{{#returnType}}{{#supportAsync}}CompletionStage<{{/supportAsync}}{{>returnTypesNoVoid}}{{#supportAsync}}>{{/supportAsync}}{{/returnType}} {{operationId}}(Http.Request request{{#hasParams}}, {{/hasParams}}{{#allParams}}{{>pathParams}}{{>queryParams}}{{>bodyParams}}{{>formParams}}{{>headerParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#handleExceptions}}throws Exception{{/handleExceptions}} {
|
||||
//Do your magic!!!
|
||||
{{#returnType}}
|
||||
{{#supportAsync}}
|
||||
|
@ -61,10 +61,10 @@ public class {{classname}}Controller extends Controller {
|
||||
{{#operation}}
|
||||
|
||||
{{#wrapCalls}}@ApiAction{{/wrapCalls}}
|
||||
public {{#supportAsync}}CompletionStage<{{/supportAsync}}Result{{#supportAsync}}>{{/supportAsync}} {{operationId}}({{#pathParams}}{{>pathParams}}{{#hasMore}},{{/hasMore}}{{/pathParams}}) {{^handleExceptions}}{{#bodyParams}}throws IOException{{/bodyParams}}{{/handleExceptions}}{{#handleExceptions}}throws Exception{{/handleExceptions}} {
|
||||
public {{#supportAsync}}CompletionStage<{{/supportAsync}}Result{{#supportAsync}}>{{/supportAsync}} {{operationId}}(Http.Request request{{#hasPathParams}}, {{/hasPathParams}}{{#pathParams}}{{>pathParams}}{{#hasMore}},{{/hasMore}}{{/pathParams}}) {{^handleExceptions}}{{#bodyParams}}throws IOException{{/bodyParams}}{{/handleExceptions}}{{#handleExceptions}}throws Exception{{/handleExceptions}} {
|
||||
{{#bodyParams}}
|
||||
{{^collectionFormat}}
|
||||
JsonNode node{{paramName}} = request().body().asJson();
|
||||
JsonNode node{{paramName}} = request.body().asJson();
|
||||
{{{dataType}}} {{paramName}};
|
||||
if (node{{paramName}} != null) {
|
||||
{{paramName}} = mapper.readValue(node{{paramName}}.toString(), {{#isContainer}}new TypeReference<{{{dataType}}}>(){}{{/isContainer}}{{^isContainer}}{{{dataType}}}.class{{/isContainer}});
|
||||
@ -97,7 +97,7 @@ public class {{classname}}Controller extends Controller {
|
||||
{{/bodyParams}}
|
||||
{{#queryParams}}
|
||||
{{#collectionFormat}}
|
||||
String[] {{paramName}}Array = request().queryString().get("{{baseName}}");
|
||||
String[] {{paramName}}Array = request.queryString().get("{{baseName}}");
|
||||
{{#required}}
|
||||
if ({{paramName}}Array == null) {
|
||||
throw new IllegalArgumentException("'{{baseName}}' parameter is required");
|
||||
@ -113,7 +113,7 @@ public class {{classname}}Controller extends Controller {
|
||||
}
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}
|
||||
String value{{paramName}} = request().getQueryString("{{baseName}}");
|
||||
String value{{paramName}} = request.getQueryString("{{baseName}}");
|
||||
{{{dataType}}} {{paramName}};
|
||||
if (value{{paramName}} != null) {
|
||||
{{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}};
|
||||
@ -129,7 +129,7 @@ public class {{classname}}Controller extends Controller {
|
||||
{{/queryParams}}
|
||||
{{#formParams}}
|
||||
{{#isFile}}
|
||||
{{{dataType}}} {{paramName}} = request().body().asMultipartFormData().getFile("{{baseName}}");
|
||||
{{{dataType}}} {{paramName}} = request.body().asMultipartFormData().getFile("{{baseName}}");
|
||||
{{#required}}
|
||||
if (({{paramName}} == null || ((File) {{paramName}}.getFile()).length() == 0)) {
|
||||
throw new IllegalArgumentException("'{{baseName}}' file cannot be empty");
|
||||
@ -138,7 +138,7 @@ public class {{classname}}Controller extends Controller {
|
||||
{{/isFile}}
|
||||
{{^isFile}}
|
||||
{{#collectionFormat}}
|
||||
String[] {{paramName}}Array = request().body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}");
|
||||
String[] {{paramName}}Array = request.body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}");
|
||||
{{#required}}
|
||||
if ({{paramName}}Array == null) {
|
||||
throw new IllegalArgumentException("'{{baseName}}' parameter is required");
|
||||
@ -154,7 +154,7 @@ public class {{classname}}Controller extends Controller {
|
||||
}
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}
|
||||
String value{{paramName}} = (request().body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}"))[0];
|
||||
String value{{paramName}} = (request.body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}"))[0];
|
||||
{{{dataType}}} {{paramName}};
|
||||
if (value{{paramName}} != null) {
|
||||
{{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}};
|
||||
@ -171,7 +171,7 @@ public class {{classname}}Controller extends Controller {
|
||||
{{/formParams}}
|
||||
{{#headerParams}}
|
||||
{{#collectionFormat}}
|
||||
String[] {{paramName}}Array = request().headers().get("{{baseName}}");
|
||||
String[] {{paramName}}Array = request.getHeaders().getAll("{{baseName}}").toArray(new String[0]);
|
||||
{{#required}}
|
||||
if ({{paramName}}Array == null) {
|
||||
throw new IllegalArgumentException("'{{baseName}}' parameter is required");
|
||||
@ -187,7 +187,7 @@ public class {{classname}}Controller extends Controller {
|
||||
}
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}
|
||||
String value{{paramName}} = request().getHeader("{{baseName}}");
|
||||
String value{{paramName}} = request.header("{{baseName}}").get();
|
||||
{{{dataType}}} {{paramName}};
|
||||
if (value{{paramName}} != null) {
|
||||
{{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}};
|
||||
@ -207,7 +207,7 @@ public class {{classname}}Controller extends Controller {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
{{/supportAsync}}
|
||||
{{/returnType}}
|
||||
{{#returnType}}{{#supportAsync}}CompletionStage<{{>returnTypesNoVoid}}> stage = {{/supportAsync}}{{^supportAsync}}{{>returnTypesNoVoid}} obj = {{/supportAsync}}{{/returnType}}{{^returnType}}{{#supportAsync}} {{/supportAsync}}{{/returnType}}imp.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}{{#supportAsync}}.thenApply(obj -> { {{/supportAsync}}{{/returnType}}{{^supportAsync}};{{/supportAsync}}
|
||||
{{#returnType}}{{#supportAsync}}CompletionStage<{{>returnTypesNoVoid}}> stage = {{/supportAsync}}{{^supportAsync}}{{>returnTypesNoVoid}} obj = {{/supportAsync}}{{/returnType}}{{^returnType}}{{#supportAsync}} {{/supportAsync}}{{/returnType}}imp.{{operationId}}(request{{#hasParams}}, {{/hasParams}}{{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}{{#supportAsync}}.thenApply(obj -> { {{/supportAsync}}{{/returnType}}{{^supportAsync}};{{/supportAsync}}{{#supportAsync}}{{^returnType}};{{/returnType}}{{/supportAsync}}
|
||||
{{#returnType}}
|
||||
{{^isResponseFile}}
|
||||
{{^returnTypeIsPrimitive}}
|
||||
|
@ -20,7 +20,7 @@ import javax.validation.constraints.*;
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface {{classname}}ControllerImpInterface {
|
||||
{{#operation}}
|
||||
{{^returnType}}void{{/returnType}}{{#returnType}}{{#supportAsync}}CompletionStage<{{/supportAsync}}{{>returnTypesNoVoid}}{{#supportAsync}}>{{/supportAsync}}{{/returnType}} {{operationId}}({{#allParams}}{{>pathParams}}{{>queryParams}}{{>bodyParams}}{{>formParams}}{{>headerParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#handleExceptions}}throws Exception{{/handleExceptions}};
|
||||
{{^returnType}}void{{/returnType}}{{#returnType}}{{#supportAsync}}CompletionStage<{{/supportAsync}}{{>returnTypesNoVoid}}{{#supportAsync}}>{{/supportAsync}}{{/returnType}} {{operationId}}(Http.Request request{{#hasParams}}, {{/hasParams}}{{#allParams}}{{>pathParams}}{{>queryParams}}{{>bodyParams}}{{>formParams}}{{>headerParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#handleExceptions}}throws Exception{{/handleExceptions}};
|
||||
|
||||
{{/operation}}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -12,7 +12,7 @@ GET /api {{apiPackage}}.ApiDocController.api
|
||||
#Functions for {{{baseName}}} API
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{httpMethod}} {{{contextPath}}}{{{path}}} {{apiPackage}}.{{classname}}Controller.{{operationId}}({{#pathParams}}{{paramName}}: {{#isUuid}}java.util.UUID{{/isUuid}}{{^isUuid}}{{{dataType}}}{{/isUuid}}{{#hasMore}}, {{/hasMore}}{{/pathParams}})
|
||||
{{httpMethod}} {{{contextPath}}}{{{path}}} {{apiPackage}}.{{classname}}Controller.{{operationId}}(request: Request{{#hasPathParams}}, {{/hasPathParams}}{{#pathParams}}{{paramName}}: {{#isUuid}}java.util.UUID{{/isUuid}}{{^isUuid}}{{{dataType}}}{{/isUuid}}{{#hasMore}}, {{/hasMore}}{{/pathParams}})
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
|
@ -40,8 +40,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -51,26 +51,26 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.addPet(body);
|
||||
imp.addPet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
} else {
|
||||
apiKey = null;
|
||||
}
|
||||
imp.deletePet(petId, apiKey);
|
||||
imp.deletePet(request, petId, apiKey);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class PetApiController extends Controller {
|
||||
status.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByStatus(status);
|
||||
List<Pet> obj = imp.findPetsByStatus(request, status);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -93,8 +93,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class PetApiController extends Controller {
|
||||
tags.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByTags(tags);
|
||||
List<Pet> obj = imp.findPetsByTags(request, tags);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -117,8 +117,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(petId);
|
||||
public Result getPetById(Http.Request request, Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(request, petId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -127,8 +127,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -138,41 +138,41 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updatePet(body);
|
||||
imp.updatePet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
} else {
|
||||
status = null;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
imp.updatePetWithForm(request, petId, name, status);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -14,45 +14,45 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public void addPet(Pet body) throws Exception {
|
||||
public void addPet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePet(Long petId, String apiKey) throws Exception {
|
||||
public void deletePet(Http.Request request, Long petId, String apiKey) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByStatus( @NotNull List<String> status) throws Exception {
|
||||
public List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByTags( @NotNull List<String> tags) throws Exception {
|
||||
public List<Pet> findPetsByTags(Http.Request request, @NotNull List<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getPetById(Long petId) throws Exception {
|
||||
public Pet getPetById(Http.Request request, Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePet(Pet body) throws Exception {
|
||||
public void updatePet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePetWithForm(Long petId, String name, String status) throws Exception {
|
||||
public void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
public ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
@ -13,20 +13,20 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PetApiControllerImpInterface {
|
||||
void addPet(Pet body) throws Exception;
|
||||
void addPet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void deletePet(Long petId, String apiKey) throws Exception;
|
||||
void deletePet(Http.Request request, Long petId, String apiKey) throws Exception;
|
||||
|
||||
List<Pet> findPetsByStatus( @NotNull List<String> status) throws Exception;
|
||||
List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception;
|
||||
|
||||
List<Pet> findPetsByTags( @NotNull List<String> tags) throws Exception;
|
||||
List<Pet> findPetsByTags(Http.Request request, @NotNull List<String> tags) throws Exception;
|
||||
|
||||
Pet getPetById(Long petId) throws Exception;
|
||||
Pet getPetById(Http.Request request, Long petId) throws Exception;
|
||||
|
||||
void updatePet(Pet body) throws Exception;
|
||||
void updatePet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void updatePetWithForm(Long petId, String name, String status) throws Exception;
|
||||
void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception;
|
||||
|
||||
ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -39,21 +39,21 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) throws Exception {
|
||||
imp.deleteOrder(orderId);
|
||||
public Result deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
imp.deleteOrder(request, orderId);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getInventory() throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory();
|
||||
public Result getInventory(Http.Request request) throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory(request);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(orderId);
|
||||
public Result getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(request, orderId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -62,8 +62,8 @@ public class StoreApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result placeOrder(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
@ -73,7 +73,7 @@ public class StoreApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Order obj = imp.placeOrder(body);
|
||||
Order obj = imp.placeOrder(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -13,24 +13,24 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
@Override
|
||||
public void deleteOrder(String orderId) throws Exception {
|
||||
public void deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getInventory() throws Exception {
|
||||
public Map<String, Integer> getInventory(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
public Order getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order placeOrder(Order body) throws Exception {
|
||||
public Order placeOrder(Http.Request request, Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface StoreApiControllerImpInterface {
|
||||
void deleteOrder(String orderId) throws Exception;
|
||||
void deleteOrder(Http.Request request, String orderId) throws Exception;
|
||||
|
||||
Map<String, Integer> getInventory() throws Exception;
|
||||
Map<String, Integer> getInventory(Http.Request request) throws Exception;
|
||||
|
||||
Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception;
|
||||
Order getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception;
|
||||
|
||||
Order placeOrder(Order body) throws Exception;
|
||||
Order placeOrder(Http.Request request, Order body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -50,13 +50,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUser(body);
|
||||
imp.createUser(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithArrayInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -68,13 +68,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithArrayInput(body);
|
||||
imp.createUsersWithArrayInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithListInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -86,19 +86,19 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithListInput(body);
|
||||
imp.createUsersWithListInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) throws Exception {
|
||||
imp.deleteUser(username);
|
||||
public Result deleteUser(Http.Request request, String username) throws Exception {
|
||||
imp.deleteUser(request, username);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getUserByName(String username) throws Exception {
|
||||
User obj = imp.getUserByName(username);
|
||||
public Result getUserByName(Http.Request request, String username) throws Exception {
|
||||
User obj = imp.getUserByName(request, username);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -107,35 +107,35 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result loginUser() throws Exception {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public Result loginUser(Http.Request request) throws Exception {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'password' parameter is required");
|
||||
}
|
||||
String obj = imp.loginUser(username, password);
|
||||
String obj = imp.loginUser(request, username, password);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() throws Exception {
|
||||
imp.logoutUser();
|
||||
public Result logoutUser(Http.Request request) throws Exception {
|
||||
imp.logoutUser(request);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updateUser(Http.Request request, String username) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -145,7 +145,7 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updateUser(username, body);
|
||||
imp.updateUser(request, username, body);
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
@ -13,44 +13,44 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public void createUser(User body) throws Exception {
|
||||
public void createUser(Http.Request request, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithArrayInput(List<User> body) throws Exception {
|
||||
public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithListInput(List<User> body) throws Exception {
|
||||
public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(String username) throws Exception {
|
||||
public void deleteUser(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUserByName(String username) throws Exception {
|
||||
public User getUserByName(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new User();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String loginUser( @NotNull String username, @NotNull String password) throws Exception {
|
||||
public String loginUser(Http.Request request, @NotNull String username, @NotNull String password) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new String();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutUser() throws Exception {
|
||||
public void logoutUser(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(String username, User body) throws Exception {
|
||||
public void updateUser(Http.Request request, String username, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
@ -12,20 +12,20 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface UserApiControllerImpInterface {
|
||||
void createUser(User body) throws Exception;
|
||||
void createUser(Http.Request request, User body) throws Exception;
|
||||
|
||||
void createUsersWithArrayInput(List<User> body) throws Exception;
|
||||
void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void createUsersWithListInput(List<User> body) throws Exception;
|
||||
void createUsersWithListInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void deleteUser(String username) throws Exception;
|
||||
void deleteUser(Http.Request request, String username) throws Exception;
|
||||
|
||||
User getUserByName(String username) throws Exception;
|
||||
User getUserByName(Http.Request request, String username) throws Exception;
|
||||
|
||||
String loginUser( @NotNull String username, @NotNull String password) throws Exception;
|
||||
String loginUser(Http.Request request, @NotNull String username, @NotNull String password) throws Exception;
|
||||
|
||||
void logoutUser() throws Exception;
|
||||
void logoutUser(Http.Request request) throws Exception;
|
||||
|
||||
void updateUser(String username, User body) throws Exception;
|
||||
void updateUser(Http.Request request, String username, User body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
|
||||
libraryDependencies += guice
|
||||
|
@ -6,30 +6,30 @@ GET /api com.puppies.store.apis.ApiDocController.api
|
||||
|
||||
|
||||
#Functions for Pet API
|
||||
POST /v2/pet com.puppies.store.apis.PetApiController.addPet()
|
||||
DELETE /v2/pet/:petId com.puppies.store.apis.PetApiController.deletePet(petId: Long)
|
||||
GET /v2/pet/findByStatus com.puppies.store.apis.PetApiController.findPetsByStatus()
|
||||
GET /v2/pet/findByTags com.puppies.store.apis.PetApiController.findPetsByTags()
|
||||
GET /v2/pet/:petId com.puppies.store.apis.PetApiController.getPetById(petId: Long)
|
||||
PUT /v2/pet com.puppies.store.apis.PetApiController.updatePet()
|
||||
POST /v2/pet/:petId com.puppies.store.apis.PetApiController.updatePetWithForm(petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage com.puppies.store.apis.PetApiController.uploadFile(petId: Long)
|
||||
POST /v2/pet com.puppies.store.apis.PetApiController.addPet(request: Request)
|
||||
DELETE /v2/pet/:petId com.puppies.store.apis.PetApiController.deletePet(request: Request, petId: Long)
|
||||
GET /v2/pet/findByStatus com.puppies.store.apis.PetApiController.findPetsByStatus(request: Request)
|
||||
GET /v2/pet/findByTags com.puppies.store.apis.PetApiController.findPetsByTags(request: Request)
|
||||
GET /v2/pet/:petId com.puppies.store.apis.PetApiController.getPetById(request: Request, petId: Long)
|
||||
PUT /v2/pet com.puppies.store.apis.PetApiController.updatePet(request: Request)
|
||||
POST /v2/pet/:petId com.puppies.store.apis.PetApiController.updatePetWithForm(request: Request, petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage com.puppies.store.apis.PetApiController.uploadFile(request: Request, petId: Long)
|
||||
|
||||
#Functions for Store API
|
||||
DELETE /v2/store/order/:orderId com.puppies.store.apis.StoreApiController.deleteOrder(orderId: String)
|
||||
GET /v2/store/inventory com.puppies.store.apis.StoreApiController.getInventory()
|
||||
GET /v2/store/order/:orderId com.puppies.store.apis.StoreApiController.getOrderById(orderId: Long)
|
||||
POST /v2/store/order com.puppies.store.apis.StoreApiController.placeOrder()
|
||||
DELETE /v2/store/order/:orderId com.puppies.store.apis.StoreApiController.deleteOrder(request: Request, orderId: String)
|
||||
GET /v2/store/inventory com.puppies.store.apis.StoreApiController.getInventory(request: Request)
|
||||
GET /v2/store/order/:orderId com.puppies.store.apis.StoreApiController.getOrderById(request: Request, orderId: Long)
|
||||
POST /v2/store/order com.puppies.store.apis.StoreApiController.placeOrder(request: Request)
|
||||
|
||||
#Functions for User API
|
||||
POST /v2/user com.puppies.store.apis.UserApiController.createUser()
|
||||
POST /v2/user/createWithArray com.puppies.store.apis.UserApiController.createUsersWithArrayInput()
|
||||
POST /v2/user/createWithList com.puppies.store.apis.UserApiController.createUsersWithListInput()
|
||||
DELETE /v2/user/:username com.puppies.store.apis.UserApiController.deleteUser(username: String)
|
||||
GET /v2/user/:username com.puppies.store.apis.UserApiController.getUserByName(username: String)
|
||||
GET /v2/user/login com.puppies.store.apis.UserApiController.loginUser()
|
||||
GET /v2/user/logout com.puppies.store.apis.UserApiController.logoutUser()
|
||||
PUT /v2/user/:username com.puppies.store.apis.UserApiController.updateUser(username: String)
|
||||
POST /v2/user com.puppies.store.apis.UserApiController.createUser(request: Request)
|
||||
POST /v2/user/createWithArray com.puppies.store.apis.UserApiController.createUsersWithArrayInput(request: Request)
|
||||
POST /v2/user/createWithList com.puppies.store.apis.UserApiController.createUsersWithListInput(request: Request)
|
||||
DELETE /v2/user/:username com.puppies.store.apis.UserApiController.deleteUser(request: Request, username: String)
|
||||
GET /v2/user/:username com.puppies.store.apis.UserApiController.getUserByName(request: Request, username: String)
|
||||
GET /v2/user/login com.puppies.store.apis.UserApiController.loginUser(request: Request)
|
||||
GET /v2/user/logout com.puppies.store.apis.UserApiController.logoutUser(request: Request)
|
||||
PUT /v2/user/:username com.puppies.store.apis.UserApiController.updateUser(request: Request, username: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(file)
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -43,8 +43,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public CompletionStage<Result> addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -55,14 +55,14 @@ public class PetApiController extends Controller {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.addPet(body)
|
||||
imp.addPet(request, body);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public CompletionStage<Result> deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
@ -70,14 +70,14 @@ public class PetApiController extends Controller {
|
||||
apiKey = null;
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.deletePet(petId, apiKey)
|
||||
imp.deletePet(request, petId, apiKey);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public CompletionStage<Result> findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class PetApiController extends Controller {
|
||||
status.add(curParam);
|
||||
}
|
||||
}
|
||||
CompletionStage<List<Pet>> stage = imp.findPetsByStatus(status).thenApply(obj -> {
|
||||
CompletionStage<List<Pet>> stage = imp.findPetsByStatus(request, status).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -104,8 +104,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public CompletionStage<Result> findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -117,7 +117,7 @@ public class PetApiController extends Controller {
|
||||
tags.add(curParam);
|
||||
}
|
||||
}
|
||||
CompletionStage<List<Pet>> stage = imp.findPetsByTags(tags).thenApply(obj -> {
|
||||
CompletionStage<List<Pet>> stage = imp.findPetsByTags(request, tags).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -132,8 +132,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> getPetById(Long petId) throws Exception {
|
||||
CompletionStage<Pet> stage = imp.getPetById(petId).thenApply(obj -> {
|
||||
public CompletionStage<Result> getPetById(Http.Request request, Long petId) throws Exception {
|
||||
CompletionStage<Pet> stage = imp.getPetById(request, petId).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -146,8 +146,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public CompletionStage<Result> updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -158,21 +158,21 @@ public class PetApiController extends Controller {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.updatePet(body)
|
||||
imp.updatePet(request, body);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public CompletionStage<Result> updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
@ -180,22 +180,22 @@ public class PetApiController extends Controller {
|
||||
status = null;
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.updatePetWithForm(petId, name, status)
|
||||
imp.updatePetWithForm(request, petId, name, status);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public CompletionStage<Result> uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
CompletionStage<ModelApiResponse> stage = imp.uploadFile(petId, additionalMetadata, file).thenApply(obj -> {
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
CompletionStage<ModelApiResponse> stage = imp.uploadFile(request, petId, additionalMetadata, file).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -10,21 +10,23 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public void addPet(Pet body) throws Exception {
|
||||
public void addPet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePet(Long petId, String apiKey) throws Exception {
|
||||
public void deletePet(Http.Request request, Long petId, String apiKey) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<List<Pet>> findPetsByStatus( @NotNull List<String> status) throws Exception {
|
||||
public CompletionStage<List<Pet>> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new ArrayList<Pet>();
|
||||
@ -32,7 +34,7 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<List<Pet>> findPetsByTags( @NotNull List<String> tags) throws Exception {
|
||||
public CompletionStage<List<Pet>> findPetsByTags(Http.Request request, @NotNull List<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new ArrayList<Pet>();
|
||||
@ -40,7 +42,7 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<Pet> getPetById(Long petId) throws Exception {
|
||||
public CompletionStage<Pet> getPetById(Http.Request request, Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new Pet();
|
||||
@ -48,17 +50,17 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePet(Pet body) throws Exception {
|
||||
public void updatePet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePetWithForm(Long petId, String name, String status) throws Exception {
|
||||
public void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<ModelApiResponse> uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
public CompletionStage<ModelApiResponse> uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new ModelApiResponse();
|
||||
|
@ -15,20 +15,20 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PetApiControllerImpInterface {
|
||||
void addPet(Pet body) throws Exception;
|
||||
void addPet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void deletePet(Long petId, String apiKey) throws Exception;
|
||||
void deletePet(Http.Request request, Long petId, String apiKey) throws Exception;
|
||||
|
||||
CompletionStage<List<Pet>> findPetsByStatus( @NotNull List<String> status) throws Exception;
|
||||
CompletionStage<List<Pet>> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception;
|
||||
|
||||
CompletionStage<List<Pet>> findPetsByTags( @NotNull List<String> tags) throws Exception;
|
||||
CompletionStage<List<Pet>> findPetsByTags(Http.Request request, @NotNull List<String> tags) throws Exception;
|
||||
|
||||
CompletionStage<Pet> getPetById(Long petId) throws Exception;
|
||||
CompletionStage<Pet> getPetById(Http.Request request, Long petId) throws Exception;
|
||||
|
||||
void updatePet(Pet body) throws Exception;
|
||||
void updatePet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void updatePetWithForm(Long petId, String name, String status) throws Exception;
|
||||
void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception;
|
||||
|
||||
CompletionStage<ModelApiResponse> uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
CompletionStage<ModelApiResponse> uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -42,16 +42,16 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> deleteOrder(String orderId) throws Exception {
|
||||
public CompletionStage<Result> deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.deleteOrder(orderId)
|
||||
imp.deleteOrder(request, orderId);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> getInventory() throws Exception {
|
||||
CompletionStage<Map<String, Integer>> stage = imp.getInventory().thenApply(obj -> {
|
||||
public CompletionStage<Result> getInventory(Http.Request request) throws Exception {
|
||||
CompletionStage<Map<String, Integer>> stage = imp.getInventory(request).thenApply(obj -> {
|
||||
return obj;
|
||||
});
|
||||
stage.thenApply(obj -> {
|
||||
@ -61,8 +61,8 @@ public class StoreApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
CompletionStage<Order> stage = imp.getOrderById(orderId).thenApply(obj -> {
|
||||
public CompletionStage<Result> getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
CompletionStage<Order> stage = imp.getOrderById(request, orderId).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -75,8 +75,8 @@ public class StoreApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> placeOrder() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public CompletionStage<Result> placeOrder(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
@ -86,7 +86,7 @@ public class StoreApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
CompletionStage<Order> stage = imp.placeOrder(body).thenApply(obj -> {
|
||||
CompletionStage<Order> stage = imp.placeOrder(request, body).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -9,16 +9,18 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
@Override
|
||||
public void deleteOrder(String orderId) throws Exception {
|
||||
public void deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<Map<String, Integer>> getInventory() throws Exception {
|
||||
public CompletionStage<Map<String, Integer>> getInventory(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new HashMap<String, Integer>();
|
||||
@ -26,7 +28,7 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<Order> getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
public CompletionStage<Order> getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new Order();
|
||||
@ -34,7 +36,7 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<Order> placeOrder(Order body) throws Exception {
|
||||
public CompletionStage<Order> placeOrder(Http.Request request, Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new Order();
|
||||
|
@ -14,12 +14,12 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface StoreApiControllerImpInterface {
|
||||
void deleteOrder(String orderId) throws Exception;
|
||||
void deleteOrder(Http.Request request, String orderId) throws Exception;
|
||||
|
||||
CompletionStage<Map<String, Integer>> getInventory() throws Exception;
|
||||
CompletionStage<Map<String, Integer>> getInventory(Http.Request request) throws Exception;
|
||||
|
||||
CompletionStage<Order> getOrderById( @Min(1) @Max(5)Long orderId) throws Exception;
|
||||
CompletionStage<Order> getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception;
|
||||
|
||||
CompletionStage<Order> placeOrder(Order body) throws Exception;
|
||||
CompletionStage<Order> placeOrder(Http.Request request, Order body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> createUser() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public CompletionStage<Result> createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -54,14 +54,14 @@ public class UserApiController extends Controller {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.createUser(body)
|
||||
imp.createUser(request, body);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public CompletionStage<Result> createUsersWithArrayInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -74,14 +74,14 @@ public class UserApiController extends Controller {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.createUsersWithArrayInput(body)
|
||||
imp.createUsersWithArrayInput(request, body);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> createUsersWithListInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public CompletionStage<Result> createUsersWithListInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -94,22 +94,22 @@ public class UserApiController extends Controller {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.createUsersWithListInput(body)
|
||||
imp.createUsersWithListInput(request, body);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> deleteUser(String username) throws Exception {
|
||||
public CompletionStage<Result> deleteUser(Http.Request request, String username) throws Exception {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.deleteUser(username)
|
||||
imp.deleteUser(request, username);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> getUserByName(String username) throws Exception {
|
||||
CompletionStage<User> stage = imp.getUserByName(username).thenApply(obj -> {
|
||||
public CompletionStage<Result> getUserByName(Http.Request request, String username) throws Exception {
|
||||
CompletionStage<User> stage = imp.getUserByName(request, username).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -122,22 +122,22 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> loginUser() throws Exception {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public CompletionStage<Result> loginUser(Http.Request request) throws Exception {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'password' parameter is required");
|
||||
}
|
||||
CompletionStage<String> stage = imp.loginUser(username, password).thenApply(obj -> {
|
||||
CompletionStage<String> stage = imp.loginUser(request, username, password).thenApply(obj -> {
|
||||
return obj;
|
||||
});
|
||||
stage.thenApply(obj -> {
|
||||
@ -147,16 +147,16 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> logoutUser() throws Exception {
|
||||
public CompletionStage<Result> logoutUser(Http.Request request) throws Exception {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.logoutUser()
|
||||
imp.logoutUser(request);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public CompletionStage<Result> updateUser(String username) throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public CompletionStage<Result> updateUser(Http.Request request, String username) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -167,7 +167,7 @@ public class UserApiController extends Controller {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
imp.updateUser(username, body)
|
||||
imp.updateUser(request, username, body);
|
||||
return ok();
|
||||
});
|
||||
}
|
||||
|
@ -9,31 +9,33 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public void createUser(User body) throws Exception {
|
||||
public void createUser(Http.Request request, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithArrayInput(List<User> body) throws Exception {
|
||||
public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithListInput(List<User> body) throws Exception {
|
||||
public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(String username) throws Exception {
|
||||
public void deleteUser(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<User> getUserByName(String username) throws Exception {
|
||||
public CompletionStage<User> getUserByName(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new User();
|
||||
@ -41,7 +43,7 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<String> loginUser( @NotNull String username, @NotNull String password) throws Exception {
|
||||
public CompletionStage<String> loginUser(Http.Request request, @NotNull String username, @NotNull String password) throws Exception {
|
||||
//Do your magic!!!
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return new String();
|
||||
@ -49,12 +51,12 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutUser() throws Exception {
|
||||
public void logoutUser(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(String username, User body) throws Exception {
|
||||
public void updateUser(Http.Request request, String username, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
@ -14,20 +14,20 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface UserApiControllerImpInterface {
|
||||
void createUser(User body) throws Exception;
|
||||
void createUser(Http.Request request, User body) throws Exception;
|
||||
|
||||
void createUsersWithArrayInput(List<User> body) throws Exception;
|
||||
void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void createUsersWithListInput(List<User> body) throws Exception;
|
||||
void createUsersWithListInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void deleteUser(String username) throws Exception;
|
||||
void deleteUser(Http.Request request, String username) throws Exception;
|
||||
|
||||
CompletionStage<User> getUserByName(String username) throws Exception;
|
||||
CompletionStage<User> getUserByName(Http.Request request, String username) throws Exception;
|
||||
|
||||
CompletionStage<String> loginUser( @NotNull String username, @NotNull String password) throws Exception;
|
||||
CompletionStage<String> loginUser(Http.Request request, @NotNull String username, @NotNull String password) throws Exception;
|
||||
|
||||
void logoutUser() throws Exception;
|
||||
void logoutUser(Http.Request request) throws Exception;
|
||||
|
||||
void updateUser(String username, User body) throws Exception;
|
||||
void updateUser(Http.Request request, String username, User body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
|
||||
libraryDependencies += guice
|
||||
|
@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
|
||||
|
||||
|
||||
#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)
|
||||
POST /v2/pet controllers.PetApiController.addPet(request: Request)
|
||||
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
|
||||
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
|
||||
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
|
||||
GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
|
||||
PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
|
||||
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, 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()
|
||||
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
|
||||
GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
|
||||
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
|
||||
POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
|
||||
|
||||
#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)
|
||||
POST /v2/user controllers.UserApiController.createUser(request: Request)
|
||||
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
|
||||
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
|
||||
DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
|
||||
GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
|
||||
GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
|
||||
GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
|
||||
PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(file)
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -38,8 +38,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -53,8 +53,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
@ -65,8 +65,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -82,8 +82,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -99,13 +99,13 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) throws Exception {
|
||||
public Result getPetById(Http.Request request, Long petId) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -119,15 +119,15 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
@ -138,15 +138,15 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
@ -37,23 +37,23 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) throws Exception {
|
||||
public Result deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getInventory() throws Exception {
|
||||
public Result getInventory(Http.Request request) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
public Result getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result placeOrder(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
|
@ -37,8 +37,8 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -52,8 +52,8 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithArrayInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -69,8 +69,8 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithListInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -86,25 +86,25 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) throws Exception {
|
||||
public Result deleteUser(Http.Request request, String username) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getUserByName(String username) throws Exception {
|
||||
public Result getUserByName(Http.Request request, String username) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result loginUser() throws Exception {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public Result loginUser(Http.Request request) throws Exception {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
@ -115,13 +115,13 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() throws Exception {
|
||||
public Result logoutUser(Http.Request request) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updateUser(Http.Request request, String username) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
|
@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
|
||||
libraryDependencies += guice
|
||||
|
@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
|
||||
|
||||
|
||||
#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)
|
||||
POST /v2/pet controllers.PetApiController.addPet(request: Request)
|
||||
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
|
||||
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
|
||||
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
|
||||
GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
|
||||
PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
|
||||
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, 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()
|
||||
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
|
||||
GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
|
||||
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
|
||||
POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
|
||||
|
||||
#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)
|
||||
POST /v2/user controllers.UserApiController.createUser(request: Request)
|
||||
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
|
||||
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
|
||||
DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
|
||||
GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
|
||||
GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
|
||||
GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
|
||||
PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(file)
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -38,8 +38,8 @@ public class AnotherFakeApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result call123testSpecialTags() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result call123testSpecialTags(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Client body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Client.class);
|
||||
@ -49,7 +49,7 @@ public class AnotherFakeApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Client obj = imp.call123testSpecialTags(body);
|
||||
Client obj = imp.call123testSpecialTags(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class AnotherFakeApiControllerImp implements AnotherFakeApiControllerImpInterface {
|
||||
@Override
|
||||
public Client call123testSpecialTags(Client body) throws Exception {
|
||||
public Client call123testSpecialTags(Http.Request request, Client body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Client();
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface AnotherFakeApiControllerImpInterface {
|
||||
Client call123testSpecialTags(Client body) throws Exception;
|
||||
Client call123testSpecialTags(Http.Request request, Client body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ public class FakeApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createXmlItem() throws Exception {
|
||||
JsonNode nodexmlItem = request().body().asJson();
|
||||
public Result createXmlItem(Http.Request request) throws Exception {
|
||||
JsonNode nodexmlItem = request.body().asJson();
|
||||
XmlItem xmlItem;
|
||||
if (nodexmlItem != null) {
|
||||
xmlItem = mapper.readValue(nodexmlItem.toString(), XmlItem.class);
|
||||
@ -58,13 +58,13 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'XmlItem' parameter is required");
|
||||
}
|
||||
imp.createXmlItem(xmlItem);
|
||||
imp.createXmlItem(request, xmlItem);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result fakeOuterBooleanSerialize() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result fakeOuterBooleanSerialize(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Boolean body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Boolean.class);
|
||||
@ -74,14 +74,14 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
body = null;
|
||||
}
|
||||
Boolean obj = imp.fakeOuterBooleanSerialize(body);
|
||||
Boolean obj = imp.fakeOuterBooleanSerialize(request, body);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result fakeOuterCompositeSerialize() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result fakeOuterCompositeSerialize(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
OuterComposite body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), OuterComposite.class);
|
||||
@ -91,7 +91,7 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
body = null;
|
||||
}
|
||||
OuterComposite obj = imp.fakeOuterCompositeSerialize(body);
|
||||
OuterComposite obj = imp.fakeOuterCompositeSerialize(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -100,8 +100,8 @@ public class FakeApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result fakeOuterNumberSerialize() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result fakeOuterNumberSerialize(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
BigDecimal body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), BigDecimal.class);
|
||||
@ -111,7 +111,7 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
body = null;
|
||||
}
|
||||
BigDecimal obj = imp.fakeOuterNumberSerialize(body);
|
||||
BigDecimal obj = imp.fakeOuterNumberSerialize(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -120,8 +120,8 @@ public class FakeApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result fakeOuterStringSerialize() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result fakeOuterStringSerialize(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
String body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), String.class);
|
||||
@ -131,14 +131,14 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
body = null;
|
||||
}
|
||||
String obj = imp.fakeOuterStringSerialize(body);
|
||||
String obj = imp.fakeOuterStringSerialize(request, body);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testBodyWithFileSchema() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result testBodyWithFileSchema(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
FileSchemaTestClass body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), FileSchemaTestClass.class);
|
||||
@ -148,13 +148,13 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.testBodyWithFileSchema(body);
|
||||
imp.testBodyWithFileSchema(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testBodyWithQueryParams() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result testBodyWithQueryParams(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -164,20 +164,20 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
String valuequery = request().getQueryString("query");
|
||||
String valuequery = request.getQueryString("query");
|
||||
String query;
|
||||
if (valuequery != null) {
|
||||
query = valuequery;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'query' parameter is required");
|
||||
}
|
||||
imp.testBodyWithQueryParams(query, body);
|
||||
imp.testBodyWithQueryParams(request, query, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testClientModel() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result testClientModel(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Client body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Client.class);
|
||||
@ -187,7 +187,7 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Client obj = imp.testClientModel(body);
|
||||
Client obj = imp.testClientModel(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -196,106 +196,106 @@ public class FakeApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testEndpointParameters() throws Exception {
|
||||
String valueinteger = (request().body().asMultipartFormData().asFormUrlEncoded().get("integer"))[0];
|
||||
public Result testEndpointParameters(Http.Request request) throws Exception {
|
||||
String valueinteger = (request.body().asMultipartFormData().asFormUrlEncoded().get("integer"))[0];
|
||||
Integer integer;
|
||||
if (valueinteger != null) {
|
||||
integer = Integer.parseInt(valueinteger);
|
||||
} else {
|
||||
integer = null;
|
||||
}
|
||||
String valueint32 = (request().body().asMultipartFormData().asFormUrlEncoded().get("int32"))[0];
|
||||
String valueint32 = (request.body().asMultipartFormData().asFormUrlEncoded().get("int32"))[0];
|
||||
Integer int32;
|
||||
if (valueint32 != null) {
|
||||
int32 = Integer.parseInt(valueint32);
|
||||
} else {
|
||||
int32 = null;
|
||||
}
|
||||
String valueint64 = (request().body().asMultipartFormData().asFormUrlEncoded().get("int64"))[0];
|
||||
String valueint64 = (request.body().asMultipartFormData().asFormUrlEncoded().get("int64"))[0];
|
||||
Long int64;
|
||||
if (valueint64 != null) {
|
||||
int64 = Long.parseLong(valueint64);
|
||||
} else {
|
||||
int64 = null;
|
||||
}
|
||||
String valuenumber = (request().body().asMultipartFormData().asFormUrlEncoded().get("number"))[0];
|
||||
String valuenumber = (request.body().asMultipartFormData().asFormUrlEncoded().get("number"))[0];
|
||||
BigDecimal number;
|
||||
if (valuenumber != null) {
|
||||
number = new BigDecimal(valuenumber);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'number' parameter is required");
|
||||
}
|
||||
String value_float = (request().body().asMultipartFormData().asFormUrlEncoded().get("float"))[0];
|
||||
String value_float = (request.body().asMultipartFormData().asFormUrlEncoded().get("float"))[0];
|
||||
Float _float;
|
||||
if (value_float != null) {
|
||||
_float = Float.parseFloat(value_float);
|
||||
} else {
|
||||
_float = null;
|
||||
}
|
||||
String value_double = (request().body().asMultipartFormData().asFormUrlEncoded().get("double"))[0];
|
||||
String value_double = (request.body().asMultipartFormData().asFormUrlEncoded().get("double"))[0];
|
||||
Double _double;
|
||||
if (value_double != null) {
|
||||
_double = Double.parseDouble(value_double);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'double' parameter is required");
|
||||
}
|
||||
String valuestring = (request().body().asMultipartFormData().asFormUrlEncoded().get("string"))[0];
|
||||
String valuestring = (request.body().asMultipartFormData().asFormUrlEncoded().get("string"))[0];
|
||||
String string;
|
||||
if (valuestring != null) {
|
||||
string = valuestring;
|
||||
} else {
|
||||
string = null;
|
||||
}
|
||||
String valuepatternWithoutDelimiter = (request().body().asMultipartFormData().asFormUrlEncoded().get("pattern_without_delimiter"))[0];
|
||||
String valuepatternWithoutDelimiter = (request.body().asMultipartFormData().asFormUrlEncoded().get("pattern_without_delimiter"))[0];
|
||||
String patternWithoutDelimiter;
|
||||
if (valuepatternWithoutDelimiter != null) {
|
||||
patternWithoutDelimiter = valuepatternWithoutDelimiter;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'pattern_without_delimiter' parameter is required");
|
||||
}
|
||||
String value_byte = (request().body().asMultipartFormData().asFormUrlEncoded().get("byte"))[0];
|
||||
String value_byte = (request.body().asMultipartFormData().asFormUrlEncoded().get("byte"))[0];
|
||||
byte[] _byte;
|
||||
if (value_byte != null) {
|
||||
_byte = value_byte.getBytes();
|
||||
} else {
|
||||
throw new IllegalArgumentException("'byte' parameter is required");
|
||||
}
|
||||
Http.MultipartFormData.FilePart binary = request().body().asMultipartFormData().getFile("binary");
|
||||
String valuedate = (request().body().asMultipartFormData().asFormUrlEncoded().get("date"))[0];
|
||||
Http.MultipartFormData.FilePart binary = request.body().asMultipartFormData().getFile("binary");
|
||||
String valuedate = (request.body().asMultipartFormData().asFormUrlEncoded().get("date"))[0];
|
||||
LocalDate date;
|
||||
if (valuedate != null) {
|
||||
date = LocalDate.parse(valuedate);
|
||||
} else {
|
||||
date = null;
|
||||
}
|
||||
String valuedateTime = (request().body().asMultipartFormData().asFormUrlEncoded().get("dateTime"))[0];
|
||||
String valuedateTime = (request.body().asMultipartFormData().asFormUrlEncoded().get("dateTime"))[0];
|
||||
OffsetDateTime dateTime;
|
||||
if (valuedateTime != null) {
|
||||
dateTime = OffsetDateTime.parse(valuedateTime);
|
||||
} else {
|
||||
dateTime = null;
|
||||
}
|
||||
String valuepassword = (request().body().asMultipartFormData().asFormUrlEncoded().get("password"))[0];
|
||||
String valuepassword = (request.body().asMultipartFormData().asFormUrlEncoded().get("password"))[0];
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
} else {
|
||||
password = null;
|
||||
}
|
||||
String valueparamCallback = (request().body().asMultipartFormData().asFormUrlEncoded().get("callback"))[0];
|
||||
String valueparamCallback = (request.body().asMultipartFormData().asFormUrlEncoded().get("callback"))[0];
|
||||
String paramCallback;
|
||||
if (valueparamCallback != null) {
|
||||
paramCallback = valueparamCallback;
|
||||
} else {
|
||||
paramCallback = null;
|
||||
}
|
||||
imp.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
||||
imp.testEndpointParameters(request, number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testEnumParameters() throws Exception {
|
||||
String[] enumQueryStringArrayArray = request().queryString().get("enum_query_string_array");
|
||||
public Result testEnumParameters(Http.Request request) throws Exception {
|
||||
String[] enumQueryStringArrayArray = request.queryString().get("enum_query_string_array");
|
||||
List<String> enumQueryStringArrayList = OpenAPIUtils.parametersToList("csv", enumQueryStringArrayArray);
|
||||
List<String> enumQueryStringArray = new ArrayList<>();
|
||||
for (String curParam : enumQueryStringArrayList) {
|
||||
@ -304,28 +304,28 @@ public class FakeApiController extends Controller {
|
||||
enumQueryStringArray.add(curParam);
|
||||
}
|
||||
}
|
||||
String valueenumQueryString = request().getQueryString("enum_query_string");
|
||||
String valueenumQueryString = request.getQueryString("enum_query_string");
|
||||
String enumQueryString;
|
||||
if (valueenumQueryString != null) {
|
||||
enumQueryString = valueenumQueryString;
|
||||
} else {
|
||||
enumQueryString = "-efg";
|
||||
}
|
||||
String valueenumQueryInteger = request().getQueryString("enum_query_integer");
|
||||
String valueenumQueryInteger = request.getQueryString("enum_query_integer");
|
||||
Integer enumQueryInteger;
|
||||
if (valueenumQueryInteger != null) {
|
||||
enumQueryInteger = Integer.parseInt(valueenumQueryInteger);
|
||||
} else {
|
||||
enumQueryInteger = null;
|
||||
}
|
||||
String valueenumQueryDouble = request().getQueryString("enum_query_double");
|
||||
String valueenumQueryDouble = request.getQueryString("enum_query_double");
|
||||
Double enumQueryDouble;
|
||||
if (valueenumQueryDouble != null) {
|
||||
enumQueryDouble = Double.parseDouble(valueenumQueryDouble);
|
||||
} else {
|
||||
enumQueryDouble = null;
|
||||
}
|
||||
String[] enumFormStringArrayArray = request().body().asMultipartFormData().asFormUrlEncoded().get("enum_form_string_array");
|
||||
String[] enumFormStringArrayArray = request.body().asMultipartFormData().asFormUrlEncoded().get("enum_form_string_array");
|
||||
List<String> enumFormStringArrayList = OpenAPIUtils.parametersToList("csv", enumFormStringArrayArray);
|
||||
List<String> enumFormStringArray = new ArrayList<>();
|
||||
for (String curParam : enumFormStringArrayList) {
|
||||
@ -334,14 +334,14 @@ public class FakeApiController extends Controller {
|
||||
enumFormStringArray.add(curParam);
|
||||
}
|
||||
}
|
||||
String valueenumFormString = (request().body().asMultipartFormData().asFormUrlEncoded().get("enum_form_string"))[0];
|
||||
String valueenumFormString = (request.body().asMultipartFormData().asFormUrlEncoded().get("enum_form_string"))[0];
|
||||
String enumFormString;
|
||||
if (valueenumFormString != null) {
|
||||
enumFormString = valueenumFormString;
|
||||
} else {
|
||||
enumFormString = "-efg";
|
||||
}
|
||||
String[] enumHeaderStringArrayArray = request().headers().get("enum_header_string_array");
|
||||
String[] enumHeaderStringArrayArray = request.getHeaders().getAll("enum_header_string_array").toArray(new String[0]);
|
||||
List<String> enumHeaderStringArrayList = OpenAPIUtils.parametersToList("csv", enumHeaderStringArrayArray);
|
||||
List<String> enumHeaderStringArray = new ArrayList<>();
|
||||
for (String curParam : enumHeaderStringArrayList) {
|
||||
@ -350,68 +350,68 @@ public class FakeApiController extends Controller {
|
||||
enumHeaderStringArray.add(curParam);
|
||||
}
|
||||
}
|
||||
String valueenumHeaderString = request().getHeader("enum_header_string");
|
||||
String valueenumHeaderString = request.header("enum_header_string").get();
|
||||
String enumHeaderString;
|
||||
if (valueenumHeaderString != null) {
|
||||
enumHeaderString = valueenumHeaderString;
|
||||
} else {
|
||||
enumHeaderString = "-efg";
|
||||
}
|
||||
imp.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
|
||||
imp.testEnumParameters(request, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testGroupParameters() throws Exception {
|
||||
String valuerequiredStringGroup = request().getQueryString("required_string_group");
|
||||
public Result testGroupParameters(Http.Request request) throws Exception {
|
||||
String valuerequiredStringGroup = request.getQueryString("required_string_group");
|
||||
Integer requiredStringGroup;
|
||||
if (valuerequiredStringGroup != null) {
|
||||
requiredStringGroup = Integer.parseInt(valuerequiredStringGroup);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'required_string_group' parameter is required");
|
||||
}
|
||||
String valuerequiredInt64Group = request().getQueryString("required_int64_group");
|
||||
String valuerequiredInt64Group = request.getQueryString("required_int64_group");
|
||||
Long requiredInt64Group;
|
||||
if (valuerequiredInt64Group != null) {
|
||||
requiredInt64Group = Long.parseLong(valuerequiredInt64Group);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'required_int64_group' parameter is required");
|
||||
}
|
||||
String valuestringGroup = request().getQueryString("string_group");
|
||||
String valuestringGroup = request.getQueryString("string_group");
|
||||
Integer stringGroup;
|
||||
if (valuestringGroup != null) {
|
||||
stringGroup = Integer.parseInt(valuestringGroup);
|
||||
} else {
|
||||
stringGroup = null;
|
||||
}
|
||||
String valueint64Group = request().getQueryString("int64_group");
|
||||
String valueint64Group = request.getQueryString("int64_group");
|
||||
Long int64Group;
|
||||
if (valueint64Group != null) {
|
||||
int64Group = Long.parseLong(valueint64Group);
|
||||
} else {
|
||||
int64Group = null;
|
||||
}
|
||||
String valuerequiredBooleanGroup = request().getHeader("required_boolean_group");
|
||||
String valuerequiredBooleanGroup = request.header("required_boolean_group").get();
|
||||
Boolean requiredBooleanGroup;
|
||||
if (valuerequiredBooleanGroup != null) {
|
||||
requiredBooleanGroup = Boolean.valueOf(valuerequiredBooleanGroup);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'required_boolean_group' parameter is required");
|
||||
}
|
||||
String valuebooleanGroup = request().getHeader("boolean_group");
|
||||
String valuebooleanGroup = request.header("boolean_group").get();
|
||||
Boolean booleanGroup;
|
||||
if (valuebooleanGroup != null) {
|
||||
booleanGroup = Boolean.valueOf(valuebooleanGroup);
|
||||
} else {
|
||||
booleanGroup = null;
|
||||
}
|
||||
imp.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||
imp.testGroupParameters(request, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testInlineAdditionalProperties() throws Exception {
|
||||
JsonNode nodeparam = request().body().asJson();
|
||||
public Result testInlineAdditionalProperties(Http.Request request) throws Exception {
|
||||
JsonNode nodeparam = request.body().asJson();
|
||||
Map<String, String> param;
|
||||
if (nodeparam != null) {
|
||||
param = mapper.readValue(nodeparam.toString(), new TypeReference<Map<String, String>>(){});
|
||||
@ -423,33 +423,33 @@ public class FakeApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'param' parameter is required");
|
||||
}
|
||||
imp.testInlineAdditionalProperties(param);
|
||||
imp.testInlineAdditionalProperties(request, param);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testJsonFormData() throws Exception {
|
||||
String valueparam = (request().body().asMultipartFormData().asFormUrlEncoded().get("param"))[0];
|
||||
public Result testJsonFormData(Http.Request request) throws Exception {
|
||||
String valueparam = (request.body().asMultipartFormData().asFormUrlEncoded().get("param"))[0];
|
||||
String param;
|
||||
if (valueparam != null) {
|
||||
param = valueparam;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'param' parameter is required");
|
||||
}
|
||||
String valueparam2 = (request().body().asMultipartFormData().asFormUrlEncoded().get("param2"))[0];
|
||||
String valueparam2 = (request.body().asMultipartFormData().asFormUrlEncoded().get("param2"))[0];
|
||||
String param2;
|
||||
if (valueparam2 != null) {
|
||||
param2 = valueparam2;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'param2' parameter is required");
|
||||
}
|
||||
imp.testJsonFormData(param, param2);
|
||||
imp.testJsonFormData(request, param, param2);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result testQueryParameterCollectionFormat() throws Exception {
|
||||
String[] pipeArray = request().queryString().get("pipe");
|
||||
public Result testQueryParameterCollectionFormat(Http.Request request) throws Exception {
|
||||
String[] pipeArray = request.queryString().get("pipe");
|
||||
if (pipeArray == null) {
|
||||
throw new IllegalArgumentException("'pipe' parameter is required");
|
||||
}
|
||||
@ -461,7 +461,7 @@ public class FakeApiController extends Controller {
|
||||
pipe.add(curParam);
|
||||
}
|
||||
}
|
||||
String[] ioutilArray = request().queryString().get("ioutil");
|
||||
String[] ioutilArray = request.queryString().get("ioutil");
|
||||
if (ioutilArray == null) {
|
||||
throw new IllegalArgumentException("'ioutil' parameter is required");
|
||||
}
|
||||
@ -473,7 +473,7 @@ public class FakeApiController extends Controller {
|
||||
ioutil.add(curParam);
|
||||
}
|
||||
}
|
||||
String[] httpArray = request().queryString().get("http");
|
||||
String[] httpArray = request.queryString().get("http");
|
||||
if (httpArray == null) {
|
||||
throw new IllegalArgumentException("'http' parameter is required");
|
||||
}
|
||||
@ -485,7 +485,7 @@ public class FakeApiController extends Controller {
|
||||
http.add(curParam);
|
||||
}
|
||||
}
|
||||
String[] urlArray = request().queryString().get("url");
|
||||
String[] urlArray = request.queryString().get("url");
|
||||
if (urlArray == null) {
|
||||
throw new IllegalArgumentException("'url' parameter is required");
|
||||
}
|
||||
@ -497,7 +497,7 @@ public class FakeApiController extends Controller {
|
||||
url.add(curParam);
|
||||
}
|
||||
}
|
||||
String[] contextArray = request().queryString().get("context");
|
||||
String[] contextArray = request.queryString().get("context");
|
||||
if (contextArray == null) {
|
||||
throw new IllegalArgumentException("'context' parameter is required");
|
||||
}
|
||||
@ -509,7 +509,7 @@ public class FakeApiController extends Controller {
|
||||
context.add(curParam);
|
||||
}
|
||||
}
|
||||
imp.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
|
||||
imp.testQueryParameterCollectionFormat(request, pipe, ioutil, http, url, context);
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
@ -21,77 +21,77 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class FakeApiControllerImp implements FakeApiControllerImpInterface {
|
||||
@Override
|
||||
public void createXmlItem(XmlItem xmlItem) throws Exception {
|
||||
public void createXmlItem(Http.Request request, XmlItem xmlItem) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean fakeOuterBooleanSerialize(Boolean body) throws Exception {
|
||||
public Boolean fakeOuterBooleanSerialize(Http.Request request, Boolean body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Boolean(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Exception {
|
||||
public OuterComposite fakeOuterCompositeSerialize(Http.Request request, OuterComposite body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new OuterComposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws Exception {
|
||||
public BigDecimal fakeOuterNumberSerialize(Http.Request request, BigDecimal body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new BigDecimal(1.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fakeOuterStringSerialize(String body) throws Exception {
|
||||
public String fakeOuterStringSerialize(Http.Request request, String body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new String();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testBodyWithFileSchema(FileSchemaTestClass body) throws Exception {
|
||||
public void testBodyWithFileSchema(Http.Request request, FileSchemaTestClass body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testBodyWithQueryParams( @NotNull String query, User body) throws Exception {
|
||||
public void testBodyWithQueryParams(Http.Request request, @NotNull String query, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public Client testClientModel(Client body) throws Exception {
|
||||
public Client testClientModel(Http.Request request, Client body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Client();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, Http.MultipartFormData.FilePart binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws Exception {
|
||||
public void testEndpointParameters(Http.Request request, BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, Http.MultipartFormData.FilePart binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws Exception {
|
||||
public void testEnumParameters(Http.Request request, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testGroupParameters( @NotNull Integer requiredStringGroup, Boolean requiredBooleanGroup, @NotNull Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws Exception {
|
||||
public void testGroupParameters(Http.Request request, @NotNull Integer requiredStringGroup, Boolean requiredBooleanGroup, @NotNull Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testInlineAdditionalProperties(Map<String, String> param) throws Exception {
|
||||
public void testInlineAdditionalProperties(Http.Request request, Map<String, String> param) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testJsonFormData(String param, String param2) throws Exception {
|
||||
public void testJsonFormData(Http.Request request, String param, String param2) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testQueryParameterCollectionFormat( @NotNull List<String> pipe, @NotNull List<String> ioutil, @NotNull List<String> http, @NotNull List<String> url, @NotNull List<String> context) throws Exception {
|
||||
public void testQueryParameterCollectionFormat(Http.Request request, @NotNull List<String> pipe, @NotNull List<String> ioutil, @NotNull List<String> http, @NotNull List<String> url, @NotNull List<String> context) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
@ -20,32 +20,32 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface FakeApiControllerImpInterface {
|
||||
void createXmlItem(XmlItem xmlItem) throws Exception;
|
||||
void createXmlItem(Http.Request request, XmlItem xmlItem) throws Exception;
|
||||
|
||||
Boolean fakeOuterBooleanSerialize(Boolean body) throws Exception;
|
||||
Boolean fakeOuterBooleanSerialize(Http.Request request, Boolean body) throws Exception;
|
||||
|
||||
OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Exception;
|
||||
OuterComposite fakeOuterCompositeSerialize(Http.Request request, OuterComposite body) throws Exception;
|
||||
|
||||
BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws Exception;
|
||||
BigDecimal fakeOuterNumberSerialize(Http.Request request, BigDecimal body) throws Exception;
|
||||
|
||||
String fakeOuterStringSerialize(String body) throws Exception;
|
||||
String fakeOuterStringSerialize(Http.Request request, String body) throws Exception;
|
||||
|
||||
void testBodyWithFileSchema(FileSchemaTestClass body) throws Exception;
|
||||
void testBodyWithFileSchema(Http.Request request, FileSchemaTestClass body) throws Exception;
|
||||
|
||||
void testBodyWithQueryParams( @NotNull String query, User body) throws Exception;
|
||||
void testBodyWithQueryParams(Http.Request request, @NotNull String query, User body) throws Exception;
|
||||
|
||||
Client testClientModel(Client body) throws Exception;
|
||||
Client testClientModel(Http.Request request, Client body) throws Exception;
|
||||
|
||||
void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, Http.MultipartFormData.FilePart binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws Exception;
|
||||
void testEndpointParameters(Http.Request request, BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, Http.MultipartFormData.FilePart binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws Exception;
|
||||
|
||||
void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws Exception;
|
||||
void testEnumParameters(Http.Request request, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws Exception;
|
||||
|
||||
void testGroupParameters( @NotNull Integer requiredStringGroup, Boolean requiredBooleanGroup, @NotNull Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws Exception;
|
||||
void testGroupParameters(Http.Request request, @NotNull Integer requiredStringGroup, Boolean requiredBooleanGroup, @NotNull Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws Exception;
|
||||
|
||||
void testInlineAdditionalProperties(Map<String, String> param) throws Exception;
|
||||
void testInlineAdditionalProperties(Http.Request request, Map<String, String> param) throws Exception;
|
||||
|
||||
void testJsonFormData(String param, String param2) throws Exception;
|
||||
void testJsonFormData(Http.Request request, String param, String param2) throws Exception;
|
||||
|
||||
void testQueryParameterCollectionFormat( @NotNull List<String> pipe, @NotNull List<String> ioutil, @NotNull List<String> http, @NotNull List<String> url, @NotNull List<String> context) throws Exception;
|
||||
void testQueryParameterCollectionFormat(Http.Request request, @NotNull List<String> pipe, @NotNull List<String> ioutil, @NotNull List<String> http, @NotNull List<String> url, @NotNull List<String> context) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ public class FakeClassnameTags123ApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result testClassname() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result testClassname(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Client body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Client.class);
|
||||
@ -49,7 +49,7 @@ public class FakeClassnameTags123ApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Client obj = imp.testClassname(body);
|
||||
Client obj = imp.testClassname(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class FakeClassnameTags123ApiControllerImp implements FakeClassnameTags123ApiControllerImpInterface {
|
||||
@Override
|
||||
public Client testClassname(Client body) throws Exception {
|
||||
public Client testClassname(Http.Request request, Client body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Client();
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface FakeClassnameTags123ApiControllerImpInterface {
|
||||
Client testClassname(Client body) throws Exception;
|
||||
Client testClassname(Http.Request request, Client body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -52,26 +52,26 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.addPet(body);
|
||||
imp.addPet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
} else {
|
||||
apiKey = null;
|
||||
}
|
||||
imp.deletePet(petId, apiKey);
|
||||
imp.deletePet(request, petId, apiKey);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -83,7 +83,7 @@ public class PetApiController extends Controller {
|
||||
status.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByStatus(status);
|
||||
List<Pet> obj = imp.findPetsByStatus(request, status);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -94,8 +94,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class PetApiController extends Controller {
|
||||
tags.add(curParam);
|
||||
}
|
||||
}
|
||||
Set<Pet> obj = imp.findPetsByTags(tags);
|
||||
Set<Pet> obj = imp.findPetsByTags(request, tags);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -118,8 +118,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(petId);
|
||||
public Result getPetById(Http.Request request, Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(request, petId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -128,8 +128,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -139,41 +139,41 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updatePet(body);
|
||||
imp.updatePet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
} else {
|
||||
status = null;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
imp.updatePetWithForm(request, petId, name, status);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -182,19 +182,19 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFileWithRequiredFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFileWithRequiredFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart requiredFile = request().body().asMultipartFormData().getFile("requiredFile");
|
||||
Http.MultipartFormData.FilePart requiredFile = request.body().asMultipartFormData().getFile("requiredFile");
|
||||
if ((requiredFile == null || ((File) requiredFile.getFile()).length() == 0)) {
|
||||
throw new IllegalArgumentException("'requiredFile' file cannot be empty");
|
||||
}
|
||||
ModelApiResponse obj = imp.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
|
||||
ModelApiResponse obj = imp.uploadFileWithRequiredFile(request, petId, requiredFile, additionalMetadata);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -15,51 +15,51 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public void addPet(Pet body) throws Exception {
|
||||
public void addPet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePet(Long petId, String apiKey) throws Exception {
|
||||
public void deletePet(Http.Request request, Long petId, String apiKey) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByStatus( @NotNull List<String> status) throws Exception {
|
||||
public List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Pet> findPetsByTags( @NotNull Set<String> tags) throws Exception {
|
||||
public Set<Pet> findPetsByTags(Http.Request request, @NotNull Set<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new LinkedHashSet<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getPetById(Long petId) throws Exception {
|
||||
public Pet getPetById(Http.Request request, Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePet(Pet body) throws Exception {
|
||||
public void updatePet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePetWithForm(Long petId, String name, String status) throws Exception {
|
||||
public void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
public ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, Http.MultipartFormData.FilePart requiredFile, String additionalMetadata) throws Exception {
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Http.Request request, Long petId, Http.MultipartFormData.FilePart requiredFile, String additionalMetadata) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
@ -14,22 +14,22 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PetApiControllerImpInterface {
|
||||
void addPet(Pet body) throws Exception;
|
||||
void addPet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void deletePet(Long petId, String apiKey) throws Exception;
|
||||
void deletePet(Http.Request request, Long petId, String apiKey) throws Exception;
|
||||
|
||||
List<Pet> findPetsByStatus( @NotNull List<String> status) throws Exception;
|
||||
List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception;
|
||||
|
||||
Set<Pet> findPetsByTags( @NotNull Set<String> tags) throws Exception;
|
||||
Set<Pet> findPetsByTags(Http.Request request, @NotNull Set<String> tags) throws Exception;
|
||||
|
||||
Pet getPetById(Long petId) throws Exception;
|
||||
Pet getPetById(Http.Request request, Long petId) throws Exception;
|
||||
|
||||
void updatePet(Pet body) throws Exception;
|
||||
void updatePet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void updatePetWithForm(Long petId, String name, String status) throws Exception;
|
||||
void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception;
|
||||
|
||||
ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
|
||||
ModelApiResponse uploadFileWithRequiredFile(Long petId, Http.MultipartFormData.FilePart requiredFile, String additionalMetadata) throws Exception;
|
||||
ModelApiResponse uploadFileWithRequiredFile(Http.Request request, Long petId, Http.MultipartFormData.FilePart requiredFile, String additionalMetadata) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -39,21 +39,21 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) throws Exception {
|
||||
imp.deleteOrder(orderId);
|
||||
public Result deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
imp.deleteOrder(request, orderId);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getInventory() throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory();
|
||||
public Result getInventory(Http.Request request) throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory(request);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(orderId);
|
||||
public Result getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(request, orderId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -62,8 +62,8 @@ public class StoreApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result placeOrder(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
@ -73,7 +73,7 @@ public class StoreApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Order obj = imp.placeOrder(body);
|
||||
Order obj = imp.placeOrder(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -13,24 +13,24 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
@Override
|
||||
public void deleteOrder(String orderId) throws Exception {
|
||||
public void deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getInventory() throws Exception {
|
||||
public Map<String, Integer> getInventory(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
public Order getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order placeOrder(Order body) throws Exception {
|
||||
public Order placeOrder(Http.Request request, Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface StoreApiControllerImpInterface {
|
||||
void deleteOrder(String orderId) throws Exception;
|
||||
void deleteOrder(Http.Request request, String orderId) throws Exception;
|
||||
|
||||
Map<String, Integer> getInventory() throws Exception;
|
||||
Map<String, Integer> getInventory(Http.Request request) throws Exception;
|
||||
|
||||
Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception;
|
||||
Order getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception;
|
||||
|
||||
Order placeOrder(Order body) throws Exception;
|
||||
Order placeOrder(Http.Request request, Order body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -50,13 +50,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUser(body);
|
||||
imp.createUser(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithArrayInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -68,13 +68,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithArrayInput(body);
|
||||
imp.createUsersWithArrayInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithListInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -86,19 +86,19 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithListInput(body);
|
||||
imp.createUsersWithListInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) throws Exception {
|
||||
imp.deleteUser(username);
|
||||
public Result deleteUser(Http.Request request, String username) throws Exception {
|
||||
imp.deleteUser(request, username);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getUserByName(String username) throws Exception {
|
||||
User obj = imp.getUserByName(username);
|
||||
public Result getUserByName(Http.Request request, String username) throws Exception {
|
||||
User obj = imp.getUserByName(request, username);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -107,35 +107,35 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result loginUser() throws Exception {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public Result loginUser(Http.Request request) throws Exception {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'password' parameter is required");
|
||||
}
|
||||
String obj = imp.loginUser(username, password);
|
||||
String obj = imp.loginUser(request, username, password);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() throws Exception {
|
||||
imp.logoutUser();
|
||||
public Result logoutUser(Http.Request request) throws Exception {
|
||||
imp.logoutUser(request);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updateUser(Http.Request request, String username) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -145,7 +145,7 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updateUser(username, body);
|
||||
imp.updateUser(request, username, body);
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
@ -13,44 +13,44 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public void createUser(User body) throws Exception {
|
||||
public void createUser(Http.Request request, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithArrayInput(List<User> body) throws Exception {
|
||||
public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithListInput(List<User> body) throws Exception {
|
||||
public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(String username) throws Exception {
|
||||
public void deleteUser(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUserByName(String username) throws Exception {
|
||||
public User getUserByName(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new User();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String loginUser( @NotNull String username, @NotNull String password) throws Exception {
|
||||
public String loginUser(Http.Request request, @NotNull String username, @NotNull String password) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new String();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutUser() throws Exception {
|
||||
public void logoutUser(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(String username, User body) throws Exception {
|
||||
public void updateUser(Http.Request request, String username, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
@ -12,20 +12,20 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface UserApiControllerImpInterface {
|
||||
void createUser(User body) throws Exception;
|
||||
void createUser(Http.Request request, User body) throws Exception;
|
||||
|
||||
void createUsersWithArrayInput(List<User> body) throws Exception;
|
||||
void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void createUsersWithListInput(List<User> body) throws Exception;
|
||||
void createUsersWithListInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void deleteUser(String username) throws Exception;
|
||||
void deleteUser(Http.Request request, String username) throws Exception;
|
||||
|
||||
User getUserByName(String username) throws Exception;
|
||||
User getUserByName(Http.Request request, String username) throws Exception;
|
||||
|
||||
String loginUser( @NotNull String username, @NotNull String password) throws Exception;
|
||||
String loginUser(Http.Request request, @NotNull String username, @NotNull String password) throws Exception;
|
||||
|
||||
void logoutUser() throws Exception;
|
||||
void logoutUser(Http.Request request) throws Exception;
|
||||
|
||||
void updateUser(String username, User body) throws Exception;
|
||||
void updateUser(Http.Request request, String username, User body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
|
||||
libraryDependencies += guice
|
||||
|
@ -6,53 +6,53 @@ GET /api controllers.ApiDocController.api
|
||||
|
||||
|
||||
#Functions for AnotherFake API
|
||||
PATCH /v2/another-fake/dummy controllers.AnotherFakeApiController.call123testSpecialTags()
|
||||
PATCH /v2/another-fake/dummy controllers.AnotherFakeApiController.call123testSpecialTags(request: Request)
|
||||
|
||||
#Functions for Fake API
|
||||
POST /v2/fake/create_xml_item controllers.FakeApiController.createXmlItem()
|
||||
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()
|
||||
PUT /v2/fake/body-with-file-schema controllers.FakeApiController.testBodyWithFileSchema()
|
||||
PUT /v2/fake/body-with-query-params controllers.FakeApiController.testBodyWithQueryParams()
|
||||
PATCH /v2/fake controllers.FakeApiController.testClientModel()
|
||||
POST /v2/fake controllers.FakeApiController.testEndpointParameters()
|
||||
GET /v2/fake controllers.FakeApiController.testEnumParameters()
|
||||
DELETE /v2/fake controllers.FakeApiController.testGroupParameters()
|
||||
POST /v2/fake/inline-additionalProperties controllers.FakeApiController.testInlineAdditionalProperties()
|
||||
GET /v2/fake/jsonFormData controllers.FakeApiController.testJsonFormData()
|
||||
PUT /v2/fake/test-query-paramters controllers.FakeApiController.testQueryParameterCollectionFormat()
|
||||
POST /v2/fake/create_xml_item controllers.FakeApiController.createXmlItem(request: Request)
|
||||
POST /v2/fake/outer/boolean controllers.FakeApiController.fakeOuterBooleanSerialize(request: Request)
|
||||
POST /v2/fake/outer/composite controllers.FakeApiController.fakeOuterCompositeSerialize(request: Request)
|
||||
POST /v2/fake/outer/number controllers.FakeApiController.fakeOuterNumberSerialize(request: Request)
|
||||
POST /v2/fake/outer/string controllers.FakeApiController.fakeOuterStringSerialize(request: Request)
|
||||
PUT /v2/fake/body-with-file-schema controllers.FakeApiController.testBodyWithFileSchema(request: Request)
|
||||
PUT /v2/fake/body-with-query-params controllers.FakeApiController.testBodyWithQueryParams(request: Request)
|
||||
PATCH /v2/fake controllers.FakeApiController.testClientModel(request: Request)
|
||||
POST /v2/fake controllers.FakeApiController.testEndpointParameters(request: Request)
|
||||
GET /v2/fake controllers.FakeApiController.testEnumParameters(request: Request)
|
||||
DELETE /v2/fake controllers.FakeApiController.testGroupParameters(request: Request)
|
||||
POST /v2/fake/inline-additionalProperties controllers.FakeApiController.testInlineAdditionalProperties(request: Request)
|
||||
GET /v2/fake/jsonFormData controllers.FakeApiController.testJsonFormData(request: Request)
|
||||
PUT /v2/fake/test-query-paramters controllers.FakeApiController.testQueryParameterCollectionFormat(request: Request)
|
||||
|
||||
#Functions for FakeClassnameTags123 API
|
||||
PATCH /v2/fake_classname_test controllers.FakeClassnameTags123ApiController.testClassname()
|
||||
PATCH /v2/fake_classname_test controllers.FakeClassnameTags123ApiController.testClassname(request: Request)
|
||||
|
||||
#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)
|
||||
POST /v2/fake/:petId/uploadImageWithRequiredFile controllers.PetApiController.uploadFileWithRequiredFile(petId: Long)
|
||||
POST /v2/pet controllers.PetApiController.addPet(request: Request)
|
||||
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
|
||||
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
|
||||
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
|
||||
GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
|
||||
PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
|
||||
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, petId: Long)
|
||||
POST /v2/fake/:petId/uploadImageWithRequiredFile controllers.PetApiController.uploadFileWithRequiredFile(request: Request, 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()
|
||||
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
|
||||
GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
|
||||
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
|
||||
POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
|
||||
|
||||
#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)
|
||||
POST /v2/user controllers.UserApiController.createUser(request: Request)
|
||||
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
|
||||
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
|
||||
DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
|
||||
GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
|
||||
GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
|
||||
GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
|
||||
PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(file)
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -36,34 +36,34 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.addPet(body);
|
||||
imp.addPet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
} else {
|
||||
apiKey = null;
|
||||
}
|
||||
imp.deletePet(petId, apiKey);
|
||||
imp.deletePet(request, petId, apiKey);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -75,14 +75,14 @@ public class PetApiController extends Controller {
|
||||
status.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByStatus(status);
|
||||
List<Pet> obj = imp.findPetsByStatus(request, status);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -94,62 +94,62 @@ public class PetApiController extends Controller {
|
||||
tags.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByTags(tags);
|
||||
List<Pet> obj = imp.findPetsByTags(request, tags);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(petId);
|
||||
public Result getPetById(Http.Request request, Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(request, petId);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updatePet(body);
|
||||
imp.updatePet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
} else {
|
||||
status = null;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
imp.updatePetWithForm(request, petId, name, status);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
@ -13,45 +13,45 @@ import java.io.FileInputStream;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public void addPet(Pet body) throws Exception {
|
||||
public void addPet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePet(Long petId, String apiKey) throws Exception {
|
||||
public void deletePet(Http.Request request, Long petId, String apiKey) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByStatus(List<String> status) throws Exception {
|
||||
public List<Pet> findPetsByStatus(Http.Request request, List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByTags(List<String> tags) throws Exception {
|
||||
public List<Pet> findPetsByTags(Http.Request request, List<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getPetById(Long petId) throws Exception {
|
||||
public Pet getPetById(Http.Request request, Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePet(Pet body) throws Exception {
|
||||
public void updatePet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePetWithForm(Long petId, String name, String status) throws Exception {
|
||||
public void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
public ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
@ -12,20 +12,20 @@ import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PetApiControllerImpInterface {
|
||||
void addPet(Pet body) throws Exception;
|
||||
void addPet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void deletePet(Long petId, String apiKey) throws Exception;
|
||||
void deletePet(Http.Request request, Long petId, String apiKey) throws Exception;
|
||||
|
||||
List<Pet> findPetsByStatus(List<String> status) throws Exception;
|
||||
List<Pet> findPetsByStatus(Http.Request request, List<String> status) throws Exception;
|
||||
|
||||
List<Pet> findPetsByTags(List<String> tags) throws Exception;
|
||||
List<Pet> findPetsByTags(Http.Request request, List<String> tags) throws Exception;
|
||||
|
||||
Pet getPetById(Long petId) throws Exception;
|
||||
Pet getPetById(Http.Request request, Long petId) throws Exception;
|
||||
|
||||
void updatePet(Pet body) throws Exception;
|
||||
void updatePet(Http.Request request, Pet body) throws Exception;
|
||||
|
||||
void updatePetWithForm(Long petId, String name, String status) throws Exception;
|
||||
void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception;
|
||||
|
||||
ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -35,35 +35,35 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) throws Exception {
|
||||
imp.deleteOrder(orderId);
|
||||
public Result deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
imp.deleteOrder(request, orderId);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getInventory() throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory();
|
||||
public Result getInventory(Http.Request request) throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory(request);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getOrderById(Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(orderId);
|
||||
public Result getOrderById(Http.Request request, Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(request, orderId);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result placeOrder(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Order obj = imp.placeOrder(body);
|
||||
Order obj = imp.placeOrder(request, body);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
@ -12,24 +12,24 @@ import java.io.FileInputStream;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
@Override
|
||||
public void deleteOrder(String orderId) throws Exception {
|
||||
public void deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getInventory() throws Exception {
|
||||
public Map<String, Integer> getInventory(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrderById(Long orderId) throws Exception {
|
||||
public Order getOrderById(Http.Request request, Long orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order placeOrder(Order body) throws Exception {
|
||||
public Order placeOrder(Http.Request request, Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface StoreApiControllerImpInterface {
|
||||
void deleteOrder(String orderId) throws Exception;
|
||||
void deleteOrder(Http.Request request, String orderId) throws Exception;
|
||||
|
||||
Map<String, Integer> getInventory() throws Exception;
|
||||
Map<String, Integer> getInventory(Http.Request request) throws Exception;
|
||||
|
||||
Order getOrderById(Long orderId) throws Exception;
|
||||
Order getOrderById(Http.Request request, Long orderId) throws Exception;
|
||||
|
||||
Order placeOrder(Order body) throws Exception;
|
||||
Order placeOrder(Http.Request request, Order body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -35,94 +35,94 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUser(body);
|
||||
imp.createUser(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithArrayInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithArrayInput(body);
|
||||
imp.createUsersWithArrayInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithListInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithListInput(body);
|
||||
imp.createUsersWithListInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) throws Exception {
|
||||
imp.deleteUser(username);
|
||||
public Result deleteUser(Http.Request request, String username) throws Exception {
|
||||
imp.deleteUser(request, username);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getUserByName(String username) throws Exception {
|
||||
User obj = imp.getUserByName(username);
|
||||
public Result getUserByName(Http.Request request, String username) throws Exception {
|
||||
User obj = imp.getUserByName(request, username);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result loginUser() throws Exception {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public Result loginUser(Http.Request request) throws Exception {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'password' parameter is required");
|
||||
}
|
||||
String obj = imp.loginUser(username, password);
|
||||
String obj = imp.loginUser(request, username, password);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() throws Exception {
|
||||
imp.logoutUser();
|
||||
public Result logoutUser(Http.Request request) throws Exception {
|
||||
imp.logoutUser(request);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updateUser(Http.Request request, String username) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updateUser(username, body);
|
||||
imp.updateUser(request, username, body);
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
@ -12,44 +12,44 @@ import java.io.FileInputStream;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public void createUser(User body) throws Exception {
|
||||
public void createUser(Http.Request request, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithArrayInput(List<User> body) throws Exception {
|
||||
public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithListInput(List<User> body) throws Exception {
|
||||
public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(String username) throws Exception {
|
||||
public void deleteUser(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUserByName(String username) throws Exception {
|
||||
public User getUserByName(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new User();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String loginUser(String username, String password) throws Exception {
|
||||
public String loginUser(Http.Request request, String username, String password) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new String();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutUser() throws Exception {
|
||||
public void logoutUser(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(String username, User body) throws Exception {
|
||||
public void updateUser(Http.Request request, String username, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
@ -11,20 +11,20 @@ import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface UserApiControllerImpInterface {
|
||||
void createUser(User body) throws Exception;
|
||||
void createUser(Http.Request request, User body) throws Exception;
|
||||
|
||||
void createUsersWithArrayInput(List<User> body) throws Exception;
|
||||
void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void createUsersWithListInput(List<User> body) throws Exception;
|
||||
void createUsersWithListInput(Http.Request request, List<User> body) throws Exception;
|
||||
|
||||
void deleteUser(String username) throws Exception;
|
||||
void deleteUser(Http.Request request, String username) throws Exception;
|
||||
|
||||
User getUserByName(String username) throws Exception;
|
||||
User getUserByName(Http.Request request, String username) throws Exception;
|
||||
|
||||
String loginUser(String username, String password) throws Exception;
|
||||
String loginUser(Http.Request request, String username, String password) throws Exception;
|
||||
|
||||
void logoutUser() throws Exception;
|
||||
void logoutUser(Http.Request request) throws Exception;
|
||||
|
||||
void updateUser(String username, User body) throws Exception;
|
||||
void updateUser(Http.Request request, String username, User body) throws Exception;
|
||||
|
||||
}
|
||||
|
@ -6,5 +6,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
libraryDependencies += guice
|
||||
|
@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
|
||||
|
||||
|
||||
#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)
|
||||
POST /v2/pet controllers.PetApiController.addPet(request: Request)
|
||||
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
|
||||
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
|
||||
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
|
||||
GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
|
||||
PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
|
||||
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, 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()
|
||||
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
|
||||
GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
|
||||
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
|
||||
POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
|
||||
|
||||
#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)
|
||||
POST /v2/user controllers.UserApiController.createUser(request: Request)
|
||||
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
|
||||
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
|
||||
DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
|
||||
GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
|
||||
GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
|
||||
GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
|
||||
PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(file)
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -41,8 +41,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws IOException {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws IOException {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -52,26 +52,26 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.addPet(body);
|
||||
imp.addPet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
} else {
|
||||
apiKey = null;
|
||||
}
|
||||
imp.deletePet(petId, apiKey);
|
||||
imp.deletePet(request, petId, apiKey);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -83,7 +83,7 @@ public class PetApiController extends Controller {
|
||||
status.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByStatus(status);
|
||||
List<Pet> obj = imp.findPetsByStatus(request, status);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -94,8 +94,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class PetApiController extends Controller {
|
||||
tags.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByTags(tags);
|
||||
List<Pet> obj = imp.findPetsByTags(request, tags);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -118,8 +118,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) {
|
||||
Pet obj = imp.getPetById(petId);
|
||||
public Result getPetById(Http.Request request, Long petId) {
|
||||
Pet obj = imp.getPetById(request, petId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -128,8 +128,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws IOException {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws IOException {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -139,41 +139,41 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updatePet(body);
|
||||
imp.updatePet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
} else {
|
||||
status = null;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
imp.updatePetWithForm(request, petId, name, status);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -14,45 +14,45 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public void addPet(Pet body) {
|
||||
public void addPet(Http.Request request, Pet body) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePet(Long petId, String apiKey) {
|
||||
public void deletePet(Http.Request request, Long petId, String apiKey) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByStatus( @NotNull List<String> status) {
|
||||
public List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByTags( @NotNull List<String> tags) {
|
||||
public List<Pet> findPetsByTags(Http.Request request, @NotNull List<String> tags) {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getPetById(Long petId) {
|
||||
public Pet getPetById(Http.Request request, Long petId) {
|
||||
//Do your magic!!!
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePet(Pet body) {
|
||||
public void updatePet(Http.Request request, Pet body) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePetWithForm(Long petId, String name, String status) {
|
||||
public void updatePetWithForm(Http.Request request, Long petId, String name, String status) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) {
|
||||
public ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) {
|
||||
//Do your magic!!!
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
@ -13,20 +13,20 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PetApiControllerImpInterface {
|
||||
void addPet(Pet body) ;
|
||||
void addPet(Http.Request request, Pet body) ;
|
||||
|
||||
void deletePet(Long petId, String apiKey) ;
|
||||
void deletePet(Http.Request request, Long petId, String apiKey) ;
|
||||
|
||||
List<Pet> findPetsByStatus( @NotNull List<String> status) ;
|
||||
List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) ;
|
||||
|
||||
List<Pet> findPetsByTags( @NotNull List<String> tags) ;
|
||||
List<Pet> findPetsByTags(Http.Request request, @NotNull List<String> tags) ;
|
||||
|
||||
Pet getPetById(Long petId) ;
|
||||
Pet getPetById(Http.Request request, Long petId) ;
|
||||
|
||||
void updatePet(Pet body) ;
|
||||
void updatePet(Http.Request request, Pet body) ;
|
||||
|
||||
void updatePetWithForm(Long petId, String name, String status) ;
|
||||
void updatePetWithForm(Http.Request request, Long petId, String name, String status) ;
|
||||
|
||||
ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) ;
|
||||
ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) ;
|
||||
|
||||
}
|
||||
|
@ -40,21 +40,21 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) {
|
||||
imp.deleteOrder(orderId);
|
||||
public Result deleteOrder(Http.Request request, String orderId) {
|
||||
imp.deleteOrder(request, orderId);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getInventory() {
|
||||
Map<String, Integer> obj = imp.getInventory();
|
||||
public Result getInventory(Http.Request request) {
|
||||
Map<String, Integer> obj = imp.getInventory(request);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getOrderById( @Min(1) @Max(5)Long orderId) {
|
||||
Order obj = imp.getOrderById(orderId);
|
||||
public Result getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) {
|
||||
Order obj = imp.getOrderById(request, orderId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -63,8 +63,8 @@ public class StoreApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws IOException {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result placeOrder(Http.Request request) throws IOException {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
@ -74,7 +74,7 @@ public class StoreApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Order obj = imp.placeOrder(body);
|
||||
Order obj = imp.placeOrder(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -13,24 +13,24 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
@Override
|
||||
public void deleteOrder(String orderId) {
|
||||
public void deleteOrder(Http.Request request, String orderId) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getInventory() {
|
||||
public Map<String, Integer> getInventory(Http.Request request) {
|
||||
//Do your magic!!!
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrderById( @Min(1) @Max(5)Long orderId) {
|
||||
public Order getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order placeOrder(Order body) {
|
||||
public Order placeOrder(Http.Request request, Order body) {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface StoreApiControllerImpInterface {
|
||||
void deleteOrder(String orderId) ;
|
||||
void deleteOrder(Http.Request request, String orderId) ;
|
||||
|
||||
Map<String, Integer> getInventory() ;
|
||||
Map<String, Integer> getInventory(Http.Request request) ;
|
||||
|
||||
Order getOrderById( @Min(1) @Max(5)Long orderId) ;
|
||||
Order getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) ;
|
||||
|
||||
Order placeOrder(Order body) ;
|
||||
Order placeOrder(Http.Request request, Order body) ;
|
||||
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws IOException {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUser(Http.Request request) throws IOException {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -51,13 +51,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUser(body);
|
||||
imp.createUser(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws IOException {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithArrayInput(Http.Request request) throws IOException {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -69,13 +69,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithArrayInput(body);
|
||||
imp.createUsersWithArrayInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws IOException {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithListInput(Http.Request request) throws IOException {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -87,19 +87,19 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithListInput(body);
|
||||
imp.createUsersWithListInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) {
|
||||
imp.deleteUser(username);
|
||||
public Result deleteUser(Http.Request request, String username) {
|
||||
imp.deleteUser(request, username);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getUserByName(String username) {
|
||||
User obj = imp.getUserByName(username);
|
||||
public Result getUserByName(Http.Request request, String username) {
|
||||
User obj = imp.getUserByName(request, username);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -108,35 +108,35 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result loginUser() {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public Result loginUser(Http.Request request) {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'password' parameter is required");
|
||||
}
|
||||
String obj = imp.loginUser(username, password);
|
||||
String obj = imp.loginUser(request, username, password);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() {
|
||||
imp.logoutUser();
|
||||
public Result logoutUser(Http.Request request) {
|
||||
imp.logoutUser(request);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws IOException {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updateUser(Http.Request request, String username) throws IOException {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -146,7 +146,7 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updateUser(username, body);
|
||||
imp.updateUser(request, username, body);
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
@ -13,44 +13,44 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public void createUser(User body) {
|
||||
public void createUser(Http.Request request, User body) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithArrayInput(List<User> body) {
|
||||
public void createUsersWithArrayInput(Http.Request request, List<User> body) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithListInput(List<User> body) {
|
||||
public void createUsersWithListInput(Http.Request request, List<User> body) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(String username) {
|
||||
public void deleteUser(Http.Request request, String username) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUserByName(String username) {
|
||||
public User getUserByName(Http.Request request, String username) {
|
||||
//Do your magic!!!
|
||||
return new User();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String loginUser( @NotNull String username, @NotNull String password) {
|
||||
public String loginUser(Http.Request request, @NotNull String username, @NotNull String password) {
|
||||
//Do your magic!!!
|
||||
return new String();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutUser() {
|
||||
public void logoutUser(Http.Request request) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(String username, User body) {
|
||||
public void updateUser(Http.Request request, String username, User body) {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
@ -12,20 +12,20 @@ import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface UserApiControllerImpInterface {
|
||||
void createUser(User body) ;
|
||||
void createUser(Http.Request request, User body) ;
|
||||
|
||||
void createUsersWithArrayInput(List<User> body) ;
|
||||
void createUsersWithArrayInput(Http.Request request, List<User> body) ;
|
||||
|
||||
void createUsersWithListInput(List<User> body) ;
|
||||
void createUsersWithListInput(Http.Request request, List<User> body) ;
|
||||
|
||||
void deleteUser(String username) ;
|
||||
void deleteUser(Http.Request request, String username) ;
|
||||
|
||||
User getUserByName(String username) ;
|
||||
User getUserByName(Http.Request request, String username) ;
|
||||
|
||||
String loginUser( @NotNull String username, @NotNull String password) ;
|
||||
String loginUser(Http.Request request, @NotNull String username, @NotNull String password) ;
|
||||
|
||||
void logoutUser() ;
|
||||
void logoutUser(Http.Request request) ;
|
||||
|
||||
void updateUser(String username, User body) ;
|
||||
void updateUser(Http.Request request, String username, User body) ;
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
|
||||
libraryDependencies += guice
|
||||
|
@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
|
||||
|
||||
|
||||
#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)
|
||||
POST /v2/pet controllers.PetApiController.addPet(request: Request)
|
||||
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
|
||||
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
|
||||
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
|
||||
GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
|
||||
PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
|
||||
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, 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()
|
||||
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
|
||||
GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
|
||||
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
|
||||
POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
|
||||
|
||||
#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)
|
||||
POST /v2/user controllers.UserApiController.createUser(request: Request)
|
||||
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
|
||||
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
|
||||
DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
|
||||
GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
|
||||
GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
|
||||
GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
|
||||
PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(file)
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -40,8 +40,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -51,26 +51,26 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.addPet(body);
|
||||
imp.addPet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
} else {
|
||||
apiKey = null;
|
||||
}
|
||||
imp.deletePet(petId, apiKey);
|
||||
imp.deletePet(request, petId, apiKey);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class PetApiController extends Controller {
|
||||
status.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByStatus(status);
|
||||
List<Pet> obj = imp.findPetsByStatus(request, status);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -93,8 +93,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class PetApiController extends Controller {
|
||||
tags.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByTags(tags);
|
||||
List<Pet> obj = imp.findPetsByTags(request, tags);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -117,8 +117,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(petId);
|
||||
public Result getPetById(Http.Request request, Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(request, petId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -127,8 +127,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -138,41 +138,41 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updatePet(body);
|
||||
imp.updatePet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
} else {
|
||||
status = null;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
imp.updatePetWithForm(request, petId, name, status);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -14,45 +14,45 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiControllerImp {
|
||||
|
||||
public void addPet(Pet body) throws Exception {
|
||||
public void addPet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public void deletePet(Long petId, String apiKey) throws Exception {
|
||||
public void deletePet(Http.Request request, Long petId, String apiKey) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public List<Pet> findPetsByStatus( @NotNull List<String> status) throws Exception {
|
||||
public List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
|
||||
public List<Pet> findPetsByTags( @NotNull List<String> tags) throws Exception {
|
||||
public List<Pet> findPetsByTags(Http.Request request, @NotNull List<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
|
||||
public Pet getPetById(Long petId) throws Exception {
|
||||
public Pet getPetById(Http.Request request, Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
|
||||
public void updatePet(Pet body) throws Exception {
|
||||
public void updatePet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public void updatePetWithForm(Long petId, String name, String status) throws Exception {
|
||||
public void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
public ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
@ -39,21 +39,21 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) throws Exception {
|
||||
imp.deleteOrder(orderId);
|
||||
public Result deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
imp.deleteOrder(request, orderId);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getInventory() throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory();
|
||||
public Result getInventory(Http.Request request) throws Exception {
|
||||
Map<String, Integer> obj = imp.getInventory(request);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(orderId);
|
||||
public Result getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
Order obj = imp.getOrderById(request, orderId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -62,8 +62,8 @@ public class StoreApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result placeOrder(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
@ -73,7 +73,7 @@ public class StoreApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Order obj = imp.placeOrder(body);
|
||||
Order obj = imp.placeOrder(request, body);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -13,24 +13,24 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class StoreApiControllerImp {
|
||||
|
||||
public void deleteOrder(String orderId) throws Exception {
|
||||
public void deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Integer> getInventory() throws Exception {
|
||||
public Map<String, Integer> getInventory(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
|
||||
public Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
public Order getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
||||
|
||||
public Order placeOrder(Order body) throws Exception {
|
||||
public Order placeOrder(Http.Request request, Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -50,13 +50,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUser(body);
|
||||
imp.createUser(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithArrayInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -68,13 +68,13 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithArrayInput(body);
|
||||
imp.createUsersWithArrayInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithListInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@ -86,19 +86,19 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithListInput(body);
|
||||
imp.createUsersWithListInput(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) throws Exception {
|
||||
imp.deleteUser(username);
|
||||
public Result deleteUser(Http.Request request, String username) throws Exception {
|
||||
imp.deleteUser(request, username);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getUserByName(String username) throws Exception {
|
||||
User obj = imp.getUserByName(username);
|
||||
public Result getUserByName(Http.Request request, String username) throws Exception {
|
||||
User obj = imp.getUserByName(request, username);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -107,35 +107,35 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result loginUser() throws Exception {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public Result loginUser(Http.Request request) throws Exception {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'password' parameter is required");
|
||||
}
|
||||
String obj = imp.loginUser(username, password);
|
||||
String obj = imp.loginUser(request, username, password);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() throws Exception {
|
||||
imp.logoutUser();
|
||||
public Result logoutUser(Http.Request request) throws Exception {
|
||||
imp.logoutUser(request);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updateUser(Http.Request request, String username) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@ -145,7 +145,7 @@ public class UserApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updateUser(username, body);
|
||||
imp.updateUser(request, username, body);
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
@ -13,44 +13,44 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class UserApiControllerImp {
|
||||
|
||||
public void createUser(User body) throws Exception {
|
||||
public void createUser(Http.Request request, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public void createUsersWithArrayInput(List<User> body) throws Exception {
|
||||
public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public void createUsersWithListInput(List<User> body) throws Exception {
|
||||
public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public void deleteUser(String username) throws Exception {
|
||||
public void deleteUser(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public User getUserByName(String username) throws Exception {
|
||||
public User getUserByName(Http.Request request, String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new User();
|
||||
}
|
||||
|
||||
|
||||
public String loginUser( @NotNull String username, @NotNull String password) throws Exception {
|
||||
public String loginUser(Http.Request request, @NotNull String username, @NotNull String password) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new String();
|
||||
}
|
||||
|
||||
|
||||
public void logoutUser() throws Exception {
|
||||
public void logoutUser(Http.Request request) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
public void updateUser(String username, User body) throws Exception {
|
||||
public void updateUser(Http.Request request, String username, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5"
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
|
||||
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"
|
||||
libraryDependencies += guice
|
||||
|
@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
|
||||
|
||||
|
||||
#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)
|
||||
POST /v2/pet controllers.PetApiController.addPet(request: Request)
|
||||
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
|
||||
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
|
||||
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
|
||||
GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
|
||||
PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
|
||||
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
|
||||
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, 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()
|
||||
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
|
||||
GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
|
||||
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
|
||||
POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
|
||||
|
||||
#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)
|
||||
POST /v2/user controllers.UserApiController.createUser(request: Request)
|
||||
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
|
||||
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
|
||||
DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
|
||||
GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
|
||||
GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
|
||||
GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
|
||||
PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(file)
|
||||
|
@ -1 +1 @@
|
||||
sbt.version=0.13.15
|
||||
sbt.version=1.3.13
|
@ -1,2 +1,2 @@
|
||||
// The Play plugin
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25")
|
||||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")
|
@ -40,8 +40,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -51,26 +51,26 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.addPet(body);
|
||||
imp.addPet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
} else {
|
||||
apiKey = null;
|
||||
}
|
||||
imp.deletePet(petId, apiKey);
|
||||
imp.deletePet(request, petId, apiKey);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class PetApiController extends Controller {
|
||||
status.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByStatus(status);
|
||||
List<Pet> obj = imp.findPetsByStatus(request, status);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -93,8 +93,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class PetApiController extends Controller {
|
||||
tags.add(curParam);
|
||||
}
|
||||
}
|
||||
List<Pet> obj = imp.findPetsByTags(tags);
|
||||
List<Pet> obj = imp.findPetsByTags(request, tags);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
OpenAPIUtils.validate(curItem);
|
||||
@ -117,8 +117,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(petId);
|
||||
public Result getPetById(Http.Request request, Long petId) throws Exception {
|
||||
Pet obj = imp.getPetById(request, petId);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
@ -127,8 +127,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@ -138,41 +138,41 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updatePet(body);
|
||||
imp.updatePet(request, body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
} else {
|
||||
status = null;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
imp.updatePetWithForm(request, petId, name, status);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
|
@ -14,45 +14,45 @@ import javax.validation.constraints.*;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public void addPet(Pet body) throws Exception {
|
||||
public void addPet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePet(Long petId, String apiKey) throws Exception {
|
||||
public void deletePet(Http.Request request, Long petId, String apiKey) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByStatus( @NotNull List<String> status) throws Exception {
|
||||
public List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByTags( @NotNull List<String> tags) throws Exception {
|
||||
public List<Pet> findPetsByTags(Http.Request request, @NotNull List<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getPetById(Long petId) throws Exception {
|
||||
public Pet getPetById(Http.Request request, Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePet(Pet body) throws Exception {
|
||||
public void updatePet(Http.Request request, Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePetWithForm(Long petId, String name, String status) throws Exception {
|
||||
public void updatePetWithForm(Http.Request request, Long petId, String name, String status) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
public ModelApiResponse uploadFile(Http.Request request, Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user