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:
Jean-François Côté 2020-09-12 10:01:56 -04:00 committed by GitHub
parent 684b77166b
commit 09200eb04e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
150 changed files with 1389 additions and 1379 deletions

View File

@ -7,7 +7,7 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" scalaVersion := "2.12.6"
{{#useSwaggerUI}} {{#useSwaggerUI}}
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
{{/useSwaggerUI}} {{/useSwaggerUI}}
{{#useBeanValidation}} {{#useBeanValidation}}
libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final" libraryDependencies += "javax.validation" % "validation-api" % "1.1.0.Final"

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -9,6 +9,10 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.io.FileInputStream; import java.io.FileInputStream;
{{#supportAsync}}
import java.util.concurrent.CompletionStage;
import java.util.concurrent.CompletableFuture;
{{/supportAsync}}
{{#useBeanValidation}} {{#useBeanValidation}}
import javax.validation.constraints.*; import javax.validation.constraints.*;
{{/useBeanValidation}} {{/useBeanValidation}}
@ -17,7 +21,7 @@ import javax.validation.constraints.*;
public class {{classname}}ControllerImp {{#useInterfaces}}implements {{classname}}ControllerImpInterface{{/useInterfaces}} { public class {{classname}}ControllerImp {{#useInterfaces}}implements {{classname}}ControllerImpInterface{{/useInterfaces}} {
{{#operation}} {{#operation}}
{{#useInterfaces}}@Override{{/useInterfaces}} {{#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!!! //Do your magic!!!
{{#returnType}} {{#returnType}}
{{#supportAsync}} {{#supportAsync}}

View File

@ -61,10 +61,10 @@ public class {{classname}}Controller extends Controller {
{{#operation}} {{#operation}}
{{#wrapCalls}}@ApiAction{{/wrapCalls}} {{#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}} {{#bodyParams}}
{{^collectionFormat}} {{^collectionFormat}}
JsonNode node{{paramName}} = request().body().asJson(); JsonNode node{{paramName}} = request.body().asJson();
{{{dataType}}} {{paramName}}; {{{dataType}}} {{paramName}};
if (node{{paramName}} != null) { if (node{{paramName}} != null) {
{{paramName}} = mapper.readValue(node{{paramName}}.toString(), {{#isContainer}}new TypeReference<{{{dataType}}}>(){}{{/isContainer}}{{^isContainer}}{{{dataType}}}.class{{/isContainer}}); {{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}} {{/bodyParams}}
{{#queryParams}} {{#queryParams}}
{{#collectionFormat}} {{#collectionFormat}}
String[] {{paramName}}Array = request().queryString().get("{{baseName}}"); String[] {{paramName}}Array = request.queryString().get("{{baseName}}");
{{#required}} {{#required}}
if ({{paramName}}Array == null) { if ({{paramName}}Array == null) {
throw new IllegalArgumentException("'{{baseName}}' parameter is required"); throw new IllegalArgumentException("'{{baseName}}' parameter is required");
@ -113,7 +113,7 @@ public class {{classname}}Controller extends Controller {
} }
{{/collectionFormat}} {{/collectionFormat}}
{{^collectionFormat}} {{^collectionFormat}}
String value{{paramName}} = request().getQueryString("{{baseName}}"); String value{{paramName}} = request.getQueryString("{{baseName}}");
{{{dataType}}} {{paramName}}; {{{dataType}}} {{paramName}};
if (value{{paramName}} != null) { if (value{{paramName}} != null) {
{{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}}; {{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}};
@ -129,7 +129,7 @@ public class {{classname}}Controller extends Controller {
{{/queryParams}} {{/queryParams}}
{{#formParams}} {{#formParams}}
{{#isFile}} {{#isFile}}
{{{dataType}}} {{paramName}} = request().body().asMultipartFormData().getFile("{{baseName}}"); {{{dataType}}} {{paramName}} = request.body().asMultipartFormData().getFile("{{baseName}}");
{{#required}} {{#required}}
if (({{paramName}} == null || ((File) {{paramName}}.getFile()).length() == 0)) { if (({{paramName}} == null || ((File) {{paramName}}.getFile()).length() == 0)) {
throw new IllegalArgumentException("'{{baseName}}' file cannot be empty"); throw new IllegalArgumentException("'{{baseName}}' file cannot be empty");
@ -138,7 +138,7 @@ public class {{classname}}Controller extends Controller {
{{/isFile}} {{/isFile}}
{{^isFile}} {{^isFile}}
{{#collectionFormat}} {{#collectionFormat}}
String[] {{paramName}}Array = request().body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}"); String[] {{paramName}}Array = request.body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}");
{{#required}} {{#required}}
if ({{paramName}}Array == null) { if ({{paramName}}Array == null) {
throw new IllegalArgumentException("'{{baseName}}' parameter is required"); throw new IllegalArgumentException("'{{baseName}}' parameter is required");
@ -154,7 +154,7 @@ public class {{classname}}Controller extends Controller {
} }
{{/collectionFormat}} {{/collectionFormat}}
{{^collectionFormat}} {{^collectionFormat}}
String value{{paramName}} = (request().body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}"))[0]; String value{{paramName}} = (request.body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}"))[0];
{{{dataType}}} {{paramName}}; {{{dataType}}} {{paramName}};
if (value{{paramName}} != null) { if (value{{paramName}} != null) {
{{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}}; {{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}};
@ -171,7 +171,7 @@ public class {{classname}}Controller extends Controller {
{{/formParams}} {{/formParams}}
{{#headerParams}} {{#headerParams}}
{{#collectionFormat}} {{#collectionFormat}}
String[] {{paramName}}Array = request().headers().get("{{baseName}}"); String[] {{paramName}}Array = request.getHeaders().getAll("{{baseName}}").toArray(new String[0]);
{{#required}} {{#required}}
if ({{paramName}}Array == null) { if ({{paramName}}Array == null) {
throw new IllegalArgumentException("'{{baseName}}' parameter is required"); throw new IllegalArgumentException("'{{baseName}}' parameter is required");
@ -187,7 +187,7 @@ public class {{classname}}Controller extends Controller {
} }
{{/collectionFormat}} {{/collectionFormat}}
{{^collectionFormat}} {{^collectionFormat}}
String value{{paramName}} = request().getHeader("{{baseName}}"); String value{{paramName}} = request.header("{{baseName}}").get();
{{{dataType}}} {{paramName}}; {{{dataType}}} {{paramName}};
if (value{{paramName}} != null) { if (value{{paramName}} != null) {
{{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}}; {{paramName}} = {{>conversionBegin}}value{{paramName}}{{>conversionEnd}};
@ -207,7 +207,7 @@ public class {{classname}}Controller extends Controller {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
{{/supportAsync}} {{/supportAsync}}
{{/returnType}} {{/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}} {{#returnType}}
{{^isResponseFile}} {{^isResponseFile}}
{{^returnTypeIsPrimitive}} {{^returnTypeIsPrimitive}}

View File

@ -20,7 +20,7 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface {{classname}}ControllerImpInterface { public interface {{classname}}ControllerImpInterface {
{{#operation}} {{#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}} {{/operation}}
} }

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -12,7 +12,7 @@ GET /api {{apiPackage}}.ApiDocController.api
#Functions for {{{baseName}}} API #Functions for {{{baseName}}} API
{{#operations}} {{#operations}}
{{#operation}} {{#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}} {{/operation}}
{{/operations}} {{/operations}}
{{/apis}} {{/apis}}

View File

@ -40,8 +40,8 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public Result addPet() throws Exception { public Result addPet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -51,26 +51,26 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.addPet(body); imp.addPet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deletePet(Long petId) throws Exception { public Result deletePet(Http.Request request, Long petId) throws Exception {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
} else { } else {
apiKey = null; apiKey = null;
} }
imp.deletePet(petId, apiKey); imp.deletePet(request, petId, apiKey);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result findPetsByStatus() throws Exception { public Result findPetsByStatus(Http.Request request) throws Exception {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -82,7 +82,7 @@ public class PetApiController extends Controller {
status.add(curParam); status.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByStatus(status); List<Pet> obj = imp.findPetsByStatus(request, status);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -93,8 +93,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result findPetsByTags() throws Exception { public Result findPetsByTags(Http.Request request) throws Exception {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -106,7 +106,7 @@ public class PetApiController extends Controller {
tags.add(curParam); tags.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByTags(tags); List<Pet> obj = imp.findPetsByTags(request, tags);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -117,8 +117,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result getPetById(Long petId) throws Exception { public Result getPetById(Http.Request request, Long petId) throws Exception {
Pet obj = imp.getPetById(petId); Pet obj = imp.getPetById(request, petId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -127,8 +127,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result updatePet() throws Exception { public Result updatePet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -138,41 +138,41 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updatePet(body); imp.updatePet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updatePetWithForm(Long petId) throws Exception { public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
} else { } else {
status = null; status = null;
} }
imp.updatePetWithForm(petId, name, status); imp.updatePetWithForm(request, petId, name, status);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result uploadFile(Long petId) throws Exception { public Result uploadFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -14,45 +14,45 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class PetApiControllerImp implements PetApiControllerImpInterface { public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override @Override
public void addPet(Pet body) throws Exception { public void addPet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @Override
public Pet getPetById(Long petId) throws Exception { public Pet getPetById(Http.Request request, Long petId) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Pet(); return new Pet();
} }
@Override @Override
public void updatePet(Pet body) throws Exception { public void updatePet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ModelApiResponse(); return new ModelApiResponse();
} }

View File

@ -13,20 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface PetApiControllerImpInterface { 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;
} }

View File

@ -39,21 +39,21 @@ public class StoreApiController extends Controller {
@ApiAction @ApiAction
public Result deleteOrder(String orderId) throws Exception { public Result deleteOrder(Http.Request request, String orderId) throws Exception {
imp.deleteOrder(orderId); imp.deleteOrder(request, orderId);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getInventory() throws Exception { public Result getInventory(Http.Request request) throws Exception {
Map<String, Integer> obj = imp.getInventory(); Map<String, Integer> obj = imp.getInventory(request);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @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 {
Order obj = imp.getOrderById(orderId); Order obj = imp.getOrderById(request, orderId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -62,8 +62,8 @@ public class StoreApiController extends Controller {
} }
@ApiAction @ApiAction
public Result placeOrder() throws Exception { public Result placeOrder(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Order body; Order body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class); body = mapper.readValue(nodebody.toString(), Order.class);
@ -73,7 +73,7 @@ public class StoreApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Order obj = imp.placeOrder(body); Order obj = imp.placeOrder(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -13,24 +13,24 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class StoreApiControllerImp implements StoreApiControllerImpInterface { public class StoreApiControllerImp implements StoreApiControllerImpInterface {
@Override @Override
public void deleteOrder(String orderId) throws Exception { public void deleteOrder(Http.Request request, String orderId) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public Map<String, Integer> getInventory() throws Exception { public Map<String, Integer> getInventory(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
return new HashMap<String, Integer>(); return new HashMap<String, Integer>();
} }
@Override @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!!! //Do your magic!!!
return new Order(); return new Order();
} }
@Override @Override
public Order placeOrder(Order body) throws Exception { public Order placeOrder(Http.Request request, Order body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Order(); return new Order();
} }

View File

@ -12,12 +12,12 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface StoreApiControllerImpInterface { 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;
} }

View File

@ -39,8 +39,8 @@ public class UserApiController extends Controller {
@ApiAction @ApiAction
public Result createUser() throws Exception { public Result createUser(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -50,13 +50,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUser(body); imp.createUser(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithArrayInput() throws Exception { public Result createUsersWithArrayInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -68,13 +68,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithArrayInput(body); imp.createUsersWithArrayInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithListInput() throws Exception { public Result createUsersWithListInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -86,19 +86,19 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithListInput(body); imp.createUsersWithListInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deleteUser(String username) throws Exception { public Result deleteUser(Http.Request request, String username) throws Exception {
imp.deleteUser(username); imp.deleteUser(request, username);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getUserByName(String username) throws Exception { public Result getUserByName(Http.Request request, String username) throws Exception {
User obj = imp.getUserByName(username); User obj = imp.getUserByName(request, username);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -107,35 +107,35 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result loginUser() throws Exception { public Result loginUser(Http.Request request) throws Exception {
String valueusername = request().getQueryString("username"); String valueusername = request.getQueryString("username");
String username; String username;
if (valueusername != null) { if (valueusername != null) {
username = valueusername; username = valueusername;
} else { } else {
throw new IllegalArgumentException("'username' parameter is required"); throw new IllegalArgumentException("'username' parameter is required");
} }
String valuepassword = request().getQueryString("password"); String valuepassword = request.getQueryString("password");
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
} else { } else {
throw new IllegalArgumentException("'password' parameter is required"); 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); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result logoutUser() throws Exception { public Result logoutUser(Http.Request request) throws Exception {
imp.logoutUser(); imp.logoutUser(request);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updateUser(String username) throws Exception { public Result updateUser(Http.Request request, String username) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -145,7 +145,7 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updateUser(username, body); imp.updateUser(request, username, body);
return ok(); return ok();
} }
} }

View File

@ -13,44 +13,44 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class UserApiControllerImp implements UserApiControllerImpInterface { public class UserApiControllerImp implements UserApiControllerImpInterface {
@Override @Override
public void createUser(User body) throws Exception { public void createUser(Http.Request request, User body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithArrayInput(List<User> body) throws Exception { public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithListInput(List<User> body) throws Exception { public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void deleteUser(String username) throws Exception { public void deleteUser(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public User getUserByName(String username) throws Exception { public User getUserByName(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
return new User(); return new User();
} }
@Override @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!!! //Do your magic!!!
return new String(); return new String();
} }
@Override @Override
public void logoutUser() throws Exception { public void logoutUser(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }

View File

@ -12,20 +12,20 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface UserApiControllerImpInterface { 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;
} }

View File

@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" 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 += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += guice libraryDependencies += guice

View File

@ -6,30 +6,30 @@ GET /api com.puppies.store.apis.ApiDocController.api
#Functions for Pet API #Functions for Pet API
POST /v2/pet com.puppies.store.apis.PetApiController.addPet() POST /v2/pet com.puppies.store.apis.PetApiController.addPet(request: Request)
DELETE /v2/pet/:petId com.puppies.store.apis.PetApiController.deletePet(petId: Long) DELETE /v2/pet/:petId com.puppies.store.apis.PetApiController.deletePet(request: Request, petId: Long)
GET /v2/pet/findByStatus com.puppies.store.apis.PetApiController.findPetsByStatus() GET /v2/pet/findByStatus com.puppies.store.apis.PetApiController.findPetsByStatus(request: Request)
GET /v2/pet/findByTags com.puppies.store.apis.PetApiController.findPetsByTags() GET /v2/pet/findByTags com.puppies.store.apis.PetApiController.findPetsByTags(request: Request)
GET /v2/pet/:petId com.puppies.store.apis.PetApiController.getPetById(petId: Long) GET /v2/pet/:petId com.puppies.store.apis.PetApiController.getPetById(request: Request, petId: Long)
PUT /v2/pet com.puppies.store.apis.PetApiController.updatePet() PUT /v2/pet com.puppies.store.apis.PetApiController.updatePet(request: Request)
POST /v2/pet/:petId com.puppies.store.apis.PetApiController.updatePetWithForm(petId: Long) 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(petId: Long) POST /v2/pet/:petId/uploadImage com.puppies.store.apis.PetApiController.uploadFile(request: Request, petId: Long)
#Functions for Store API #Functions for Store API
DELETE /v2/store/order/:orderId com.puppies.store.apis.StoreApiController.deleteOrder(orderId: String) 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() GET /v2/store/inventory com.puppies.store.apis.StoreApiController.getInventory(request: Request)
GET /v2/store/order/:orderId com.puppies.store.apis.StoreApiController.getOrderById(orderId: Long) 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() POST /v2/store/order com.puppies.store.apis.StoreApiController.placeOrder(request: Request)
#Functions for User API #Functions for User API
POST /v2/user com.puppies.store.apis.UserApiController.createUser() POST /v2/user com.puppies.store.apis.UserApiController.createUser(request: Request)
POST /v2/user/createWithArray com.puppies.store.apis.UserApiController.createUsersWithArrayInput() POST /v2/user/createWithArray com.puppies.store.apis.UserApiController.createUsersWithArrayInput(request: Request)
POST /v2/user/createWithList com.puppies.store.apis.UserApiController.createUsersWithListInput() POST /v2/user/createWithList com.puppies.store.apis.UserApiController.createUsersWithListInput(request: Request)
DELETE /v2/user/:username com.puppies.store.apis.UserApiController.deleteUser(username: String) DELETE /v2/user/:username com.puppies.store.apis.UserApiController.deleteUser(request: Request, username: String)
GET /v2/user/:username com.puppies.store.apis.UserApiController.getUserByName(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() GET /v2/user/login com.puppies.store.apis.UserApiController.loginUser(request: Request)
GET /v2/user/logout com.puppies.store.apis.UserApiController.logoutUser() GET /v2/user/logout com.puppies.store.apis.UserApiController.logoutUser(request: Request)
PUT /v2/user/:username com.puppies.store.apis.UserApiController.updateUser(username: String) 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 # Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file) GET /assets/*file controllers.Assets.at(file)

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -43,8 +43,8 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public CompletionStage<Result> addPet() throws Exception { public CompletionStage<Result> addPet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -55,14 +55,14 @@ public class PetApiController extends Controller {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.addPet(body) imp.addPet(request, body);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> deletePet(Long petId) throws Exception { public CompletionStage<Result> deletePet(Http.Request request, Long petId) throws Exception {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
@ -70,14 +70,14 @@ public class PetApiController extends Controller {
apiKey = null; apiKey = null;
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.deletePet(petId, apiKey) imp.deletePet(request, petId, apiKey);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> findPetsByStatus() throws Exception { public CompletionStage<Result> findPetsByStatus(Http.Request request) throws Exception {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -89,7 +89,7 @@ public class PetApiController extends Controller {
status.add(curParam); 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")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -104,8 +104,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public CompletionStage<Result> findPetsByTags() throws Exception { public CompletionStage<Result> findPetsByTags(Http.Request request) throws Exception {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -117,7 +117,7 @@ public class PetApiController extends Controller {
tags.add(curParam); 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")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -132,8 +132,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public CompletionStage<Result> getPetById(Long petId) throws Exception { public CompletionStage<Result> getPetById(Http.Request request, Long petId) throws Exception {
CompletionStage<Pet> stage = imp.getPetById(petId).thenApply(obj -> { CompletionStage<Pet> stage = imp.getPetById(request, petId).thenApply(obj -> {
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -146,8 +146,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public CompletionStage<Result> updatePet() throws Exception { public CompletionStage<Result> updatePet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -158,21 +158,21 @@ public class PetApiController extends Controller {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.updatePet(body) imp.updatePet(request, body);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> updatePetWithForm(Long petId) throws Exception { public CompletionStage<Result> updatePetWithForm(Http.Request request, Long petId) throws Exception {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
@ -180,22 +180,22 @@ public class PetApiController extends Controller {
status = null; status = null;
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.updatePetWithForm(petId, name, status) imp.updatePetWithForm(request, petId, name, status);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> uploadFile(Long petId) throws Exception { public CompletionStage<Result> uploadFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
CompletionStage<ModelApiResponse> stage = imp.uploadFile(petId, additionalMetadata, file).thenApply(obj -> { CompletionStage<ModelApiResponse> stage = imp.uploadFile(request, petId, additionalMetadata, file).thenApply(obj -> {
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -10,21 +10,23 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.CompletableFuture;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class PetApiControllerImp implements PetApiControllerImpInterface { public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override @Override
public void addPet(Pet body) throws Exception { public void addPet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new ArrayList<Pet>(); return new ArrayList<Pet>();
@ -32,7 +34,7 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
} }
@Override @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!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new ArrayList<Pet>(); return new ArrayList<Pet>();
@ -40,7 +42,7 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
} }
@Override @Override
public CompletionStage<Pet> getPetById(Long petId) throws Exception { public CompletionStage<Pet> getPetById(Http.Request request, Long petId) throws Exception {
//Do your magic!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new Pet(); return new Pet();
@ -48,17 +50,17 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
} }
@Override @Override
public void updatePet(Pet body) throws Exception { public void updatePet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new ModelApiResponse(); return new ModelApiResponse();

View File

@ -15,20 +15,20 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface PetApiControllerImpInterface { 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;
} }

View File

@ -42,16 +42,16 @@ public class StoreApiController extends Controller {
@ApiAction @ApiAction
public CompletionStage<Result> deleteOrder(String orderId) throws Exception { public CompletionStage<Result> deleteOrder(Http.Request request, String orderId) throws Exception {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.deleteOrder(orderId) imp.deleteOrder(request, orderId);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> getInventory() throws Exception { public CompletionStage<Result> getInventory(Http.Request request) throws Exception {
CompletionStage<Map<String, Integer>> stage = imp.getInventory().thenApply(obj -> { CompletionStage<Map<String, Integer>> stage = imp.getInventory(request).thenApply(obj -> {
return obj; return obj;
}); });
stage.thenApply(obj -> { stage.thenApply(obj -> {
@ -61,8 +61,8 @@ public class StoreApiController extends Controller {
} }
@ApiAction @ApiAction
public CompletionStage<Result> getOrderById( @Min(1) @Max(5)Long orderId) throws Exception { public CompletionStage<Result> getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
CompletionStage<Order> stage = imp.getOrderById(orderId).thenApply(obj -> { CompletionStage<Order> stage = imp.getOrderById(request, orderId).thenApply(obj -> {
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -75,8 +75,8 @@ public class StoreApiController extends Controller {
} }
@ApiAction @ApiAction
public CompletionStage<Result> placeOrder() throws Exception { public CompletionStage<Result> placeOrder(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Order body; Order body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class); body = mapper.readValue(nodebody.toString(), Order.class);
@ -86,7 +86,7 @@ public class StoreApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); 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")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -9,16 +9,18 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.CompletableFuture;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class StoreApiControllerImp implements StoreApiControllerImpInterface { public class StoreApiControllerImp implements StoreApiControllerImpInterface {
@Override @Override
public void deleteOrder(String orderId) throws Exception { public void deleteOrder(Http.Request request, String orderId) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public CompletionStage<Map<String, Integer>> getInventory() throws Exception { public CompletionStage<Map<String, Integer>> getInventory(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new HashMap<String, Integer>(); return new HashMap<String, Integer>();
@ -26,7 +28,7 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
} }
@Override @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!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new Order(); return new Order();
@ -34,7 +36,7 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
} }
@Override @Override
public CompletionStage<Order> placeOrder(Order body) throws Exception { public CompletionStage<Order> placeOrder(Http.Request request, Order body) throws Exception {
//Do your magic!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new Order(); return new Order();

View File

@ -14,12 +14,12 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface StoreApiControllerImpInterface { 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;
} }

View File

@ -42,8 +42,8 @@ public class UserApiController extends Controller {
@ApiAction @ApiAction
public CompletionStage<Result> createUser() throws Exception { public CompletionStage<Result> createUser(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -54,14 +54,14 @@ public class UserApiController extends Controller {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.createUser(body) imp.createUser(request, body);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> createUsersWithArrayInput() throws Exception { public CompletionStage<Result> createUsersWithArrayInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); 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"); throw new IllegalArgumentException("'body' parameter is required");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.createUsersWithArrayInput(body) imp.createUsersWithArrayInput(request, body);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> createUsersWithListInput() throws Exception { public CompletionStage<Result> createUsersWithListInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); 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"); throw new IllegalArgumentException("'body' parameter is required");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.createUsersWithListInput(body) imp.createUsersWithListInput(request, body);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> deleteUser(String username) throws Exception { public CompletionStage<Result> deleteUser(Http.Request request, String username) throws Exception {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.deleteUser(username) imp.deleteUser(request, username);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> getUserByName(String username) throws Exception { public CompletionStage<Result> getUserByName(Http.Request request, String username) throws Exception {
CompletionStage<User> stage = imp.getUserByName(username).thenApply(obj -> { CompletionStage<User> stage = imp.getUserByName(request, username).thenApply(obj -> {
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -122,22 +122,22 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public CompletionStage<Result> loginUser() throws Exception { public CompletionStage<Result> loginUser(Http.Request request) throws Exception {
String valueusername = request().getQueryString("username"); String valueusername = request.getQueryString("username");
String username; String username;
if (valueusername != null) { if (valueusername != null) {
username = valueusername; username = valueusername;
} else { } else {
throw new IllegalArgumentException("'username' parameter is required"); throw new IllegalArgumentException("'username' parameter is required");
} }
String valuepassword = request().getQueryString("password"); String valuepassword = request.getQueryString("password");
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
} else { } else {
throw new IllegalArgumentException("'password' parameter is required"); 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; return obj;
}); });
stage.thenApply(obj -> { stage.thenApply(obj -> {
@ -147,16 +147,16 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public CompletionStage<Result> logoutUser() throws Exception { public CompletionStage<Result> logoutUser(Http.Request request) throws Exception {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.logoutUser() imp.logoutUser(request);
return ok(); return ok();
}); });
} }
@ApiAction @ApiAction
public CompletionStage<Result> updateUser(String username) throws Exception { public CompletionStage<Result> updateUser(Http.Request request, String username) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -167,7 +167,7 @@ public class UserApiController extends Controller {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
imp.updateUser(username, body) imp.updateUser(request, username, body);
return ok(); return ok();
}); });
} }

View File

@ -9,31 +9,33 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.CompletableFuture;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class UserApiControllerImp implements UserApiControllerImpInterface { public class UserApiControllerImp implements UserApiControllerImpInterface {
@Override @Override
public void createUser(User body) throws Exception { public void createUser(Http.Request request, User body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithArrayInput(List<User> body) throws Exception { public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithListInput(List<User> body) throws Exception { public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void deleteUser(String username) throws Exception { public void deleteUser(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public CompletionStage<User> getUserByName(String username) throws Exception { public CompletionStage<User> getUserByName(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new User(); return new User();
@ -41,7 +43,7 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
} }
@Override @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!!! //Do your magic!!!
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
return new String(); return new String();
@ -49,12 +51,12 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
} }
@Override @Override
public void logoutUser() throws Exception { public void logoutUser(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }

View File

@ -14,20 +14,20 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface UserApiControllerImpInterface { 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;
} }

View File

@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" 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 += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += guice libraryDependencies += guice

View File

@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
#Functions for Pet API #Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet() POST /v2/pet controllers.PetApiController.addPet(request: Request)
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long) DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus() GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags() GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long) GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet() PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long) POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long) POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, petId: Long)
#Functions for Store API #Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String) DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory() GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long) GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder() POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
#Functions for User API #Functions for User API
POST /v2/user controllers.UserApiController.createUser() POST /v2/user controllers.UserApiController.createUser(request: Request)
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput() POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput() POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String) DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String) GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
GET /v2/user/login controllers.UserApiController.loginUser() GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
GET /v2/user/logout controllers.UserApiController.logoutUser() GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String) PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
# Map static resources from the /public folder to the /assets URL path # Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file) GET /assets/*file controllers.Assets.at(file)

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -38,8 +38,8 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public Result addPet() throws Exception { public Result addPet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -53,8 +53,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result deletePet(Long petId) throws Exception { public Result deletePet(Http.Request request, Long petId) throws Exception {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
@ -65,8 +65,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result findPetsByStatus() throws Exception { public Result findPetsByStatus(Http.Request request) throws Exception {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -82,8 +82,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result findPetsByTags() throws Exception { public Result findPetsByTags(Http.Request request) throws Exception {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -99,13 +99,13 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result getPetById(Long petId) throws Exception { public Result getPetById(Http.Request request, Long petId) throws Exception {
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updatePet() throws Exception { public Result updatePet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -119,15 +119,15 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result updatePetWithForm(Long petId) throws Exception { public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
@ -138,15 +138,15 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result uploadFile(Long petId) throws Exception { public Result uploadFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
return ok(); return ok();
} }
} }

View File

@ -37,23 +37,23 @@ public class StoreApiController extends Controller {
@ApiAction @ApiAction
public Result deleteOrder(String orderId) throws Exception { public Result deleteOrder(Http.Request request, String orderId) throws Exception {
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getInventory() throws Exception { public Result getInventory(Http.Request request) throws Exception {
return ok(); return ok();
} }
@ApiAction @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(); return ok();
} }
@ApiAction @ApiAction
public Result placeOrder() throws Exception { public Result placeOrder(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Order body; Order body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class); body = mapper.readValue(nodebody.toString(), Order.class);

View File

@ -37,8 +37,8 @@ public class UserApiController extends Controller {
@ApiAction @ApiAction
public Result createUser() throws Exception { public Result createUser(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -52,8 +52,8 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result createUsersWithArrayInput() throws Exception { public Result createUsersWithArrayInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -69,8 +69,8 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result createUsersWithListInput() throws Exception { public Result createUsersWithListInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -86,25 +86,25 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result deleteUser(String username) throws Exception { public Result deleteUser(Http.Request request, String username) throws Exception {
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getUserByName(String username) throws Exception { public Result getUserByName(Http.Request request, String username) throws Exception {
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result loginUser() throws Exception { public Result loginUser(Http.Request request) throws Exception {
String valueusername = request().getQueryString("username"); String valueusername = request.getQueryString("username");
String username; String username;
if (valueusername != null) { if (valueusername != null) {
username = valueusername; username = valueusername;
} else { } else {
throw new IllegalArgumentException("'username' parameter is required"); throw new IllegalArgumentException("'username' parameter is required");
} }
String valuepassword = request().getQueryString("password"); String valuepassword = request.getQueryString("password");
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
@ -115,13 +115,13 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result logoutUser() throws Exception { public Result logoutUser(Http.Request request) throws Exception {
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updateUser(String username) throws Exception { public Result updateUser(Http.Request request, String username) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);

View File

@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" 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 += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += guice libraryDependencies += guice

View File

@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
#Functions for Pet API #Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet() POST /v2/pet controllers.PetApiController.addPet(request: Request)
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long) DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus() GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags() GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long) GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet() PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long) POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long) POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, petId: Long)
#Functions for Store API #Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String) DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory() GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long) GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder() POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
#Functions for User API #Functions for User API
POST /v2/user controllers.UserApiController.createUser() POST /v2/user controllers.UserApiController.createUser(request: Request)
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput() POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput() POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String) DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String) GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
GET /v2/user/login controllers.UserApiController.loginUser() GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
GET /v2/user/logout controllers.UserApiController.logoutUser() GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String) PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
# Map static resources from the /public folder to the /assets URL path # Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file) GET /assets/*file controllers.Assets.at(file)

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -38,8 +38,8 @@ public class AnotherFakeApiController extends Controller {
@ApiAction @ApiAction
public Result call123testSpecialTags() throws Exception { public Result call123testSpecialTags(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Client body; Client body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Client.class); body = mapper.readValue(nodebody.toString(), Client.class);
@ -49,7 +49,7 @@ public class AnotherFakeApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Client obj = imp.call123testSpecialTags(body); Client obj = imp.call123testSpecialTags(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -12,7 +12,7 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class AnotherFakeApiControllerImp implements AnotherFakeApiControllerImpInterface { public class AnotherFakeApiControllerImp implements AnotherFakeApiControllerImpInterface {
@Override @Override
public Client call123testSpecialTags(Client body) throws Exception { public Client call123testSpecialTags(Http.Request request, Client body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Client(); return new Client();
} }

View File

@ -11,6 +11,6 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface AnotherFakeApiControllerImpInterface { public interface AnotherFakeApiControllerImpInterface {
Client call123testSpecialTags(Client body) throws Exception; Client call123testSpecialTags(Http.Request request, Client body) throws Exception;
} }

View File

@ -47,8 +47,8 @@ public class FakeApiController extends Controller {
@ApiAction @ApiAction
public Result createXmlItem() throws Exception { public Result createXmlItem(Http.Request request) throws Exception {
JsonNode nodexmlItem = request().body().asJson(); JsonNode nodexmlItem = request.body().asJson();
XmlItem xmlItem; XmlItem xmlItem;
if (nodexmlItem != null) { if (nodexmlItem != null) {
xmlItem = mapper.readValue(nodexmlItem.toString(), XmlItem.class); xmlItem = mapper.readValue(nodexmlItem.toString(), XmlItem.class);
@ -58,13 +58,13 @@ public class FakeApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'XmlItem' parameter is required"); throw new IllegalArgumentException("'XmlItem' parameter is required");
} }
imp.createXmlItem(xmlItem); imp.createXmlItem(request, xmlItem);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result fakeOuterBooleanSerialize() throws Exception { public Result fakeOuterBooleanSerialize(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Boolean body; Boolean body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Boolean.class); body = mapper.readValue(nodebody.toString(), Boolean.class);
@ -74,14 +74,14 @@ public class FakeApiController extends Controller {
} else { } else {
body = null; body = null;
} }
Boolean obj = imp.fakeOuterBooleanSerialize(body); Boolean obj = imp.fakeOuterBooleanSerialize(request, body);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result fakeOuterCompositeSerialize() throws Exception { public Result fakeOuterCompositeSerialize(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
OuterComposite body; OuterComposite body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), OuterComposite.class); body = mapper.readValue(nodebody.toString(), OuterComposite.class);
@ -91,7 +91,7 @@ public class FakeApiController extends Controller {
} else { } else {
body = null; body = null;
} }
OuterComposite obj = imp.fakeOuterCompositeSerialize(body); OuterComposite obj = imp.fakeOuterCompositeSerialize(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -100,8 +100,8 @@ public class FakeApiController extends Controller {
} }
@ApiAction @ApiAction
public Result fakeOuterNumberSerialize() throws Exception { public Result fakeOuterNumberSerialize(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
BigDecimal body; BigDecimal body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), BigDecimal.class); body = mapper.readValue(nodebody.toString(), BigDecimal.class);
@ -111,7 +111,7 @@ public class FakeApiController extends Controller {
} else { } else {
body = null; body = null;
} }
BigDecimal obj = imp.fakeOuterNumberSerialize(body); BigDecimal obj = imp.fakeOuterNumberSerialize(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -120,8 +120,8 @@ public class FakeApiController extends Controller {
} }
@ApiAction @ApiAction
public Result fakeOuterStringSerialize() throws Exception { public Result fakeOuterStringSerialize(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
String body; String body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), String.class); body = mapper.readValue(nodebody.toString(), String.class);
@ -131,14 +131,14 @@ public class FakeApiController extends Controller {
} else { } else {
body = null; body = null;
} }
String obj = imp.fakeOuterStringSerialize(body); String obj = imp.fakeOuterStringSerialize(request, body);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result testBodyWithFileSchema() throws Exception { public Result testBodyWithFileSchema(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
FileSchemaTestClass body; FileSchemaTestClass body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), FileSchemaTestClass.class); body = mapper.readValue(nodebody.toString(), FileSchemaTestClass.class);
@ -148,13 +148,13 @@ public class FakeApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.testBodyWithFileSchema(body); imp.testBodyWithFileSchema(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result testBodyWithQueryParams() throws Exception { public Result testBodyWithQueryParams(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -164,20 +164,20 @@ public class FakeApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
String valuequery = request().getQueryString("query"); String valuequery = request.getQueryString("query");
String query; String query;
if (valuequery != null) { if (valuequery != null) {
query = valuequery; query = valuequery;
} else { } else {
throw new IllegalArgumentException("'query' parameter is required"); throw new IllegalArgumentException("'query' parameter is required");
} }
imp.testBodyWithQueryParams(query, body); imp.testBodyWithQueryParams(request, query, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result testClientModel() throws Exception { public Result testClientModel(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Client body; Client body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Client.class); body = mapper.readValue(nodebody.toString(), Client.class);
@ -187,7 +187,7 @@ public class FakeApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Client obj = imp.testClientModel(body); Client obj = imp.testClientModel(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -196,106 +196,106 @@ public class FakeApiController extends Controller {
} }
@ApiAction @ApiAction
public Result testEndpointParameters() throws Exception { public Result testEndpointParameters(Http.Request request) throws Exception {
String valueinteger = (request().body().asMultipartFormData().asFormUrlEncoded().get("integer"))[0]; String valueinteger = (request.body().asMultipartFormData().asFormUrlEncoded().get("integer"))[0];
Integer integer; Integer integer;
if (valueinteger != null) { if (valueinteger != null) {
integer = Integer.parseInt(valueinteger); integer = Integer.parseInt(valueinteger);
} else { } else {
integer = null; integer = null;
} }
String valueint32 = (request().body().asMultipartFormData().asFormUrlEncoded().get("int32"))[0]; String valueint32 = (request.body().asMultipartFormData().asFormUrlEncoded().get("int32"))[0];
Integer int32; Integer int32;
if (valueint32 != null) { if (valueint32 != null) {
int32 = Integer.parseInt(valueint32); int32 = Integer.parseInt(valueint32);
} else { } else {
int32 = null; int32 = null;
} }
String valueint64 = (request().body().asMultipartFormData().asFormUrlEncoded().get("int64"))[0]; String valueint64 = (request.body().asMultipartFormData().asFormUrlEncoded().get("int64"))[0];
Long int64; Long int64;
if (valueint64 != null) { if (valueint64 != null) {
int64 = Long.parseLong(valueint64); int64 = Long.parseLong(valueint64);
} else { } else {
int64 = null; int64 = null;
} }
String valuenumber = (request().body().asMultipartFormData().asFormUrlEncoded().get("number"))[0]; String valuenumber = (request.body().asMultipartFormData().asFormUrlEncoded().get("number"))[0];
BigDecimal number; BigDecimal number;
if (valuenumber != null) { if (valuenumber != null) {
number = new BigDecimal(valuenumber); number = new BigDecimal(valuenumber);
} else { } else {
throw new IllegalArgumentException("'number' parameter is required"); 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; Float _float;
if (value_float != null) { if (value_float != null) {
_float = Float.parseFloat(value_float); _float = Float.parseFloat(value_float);
} else { } else {
_float = null; _float = null;
} }
String value_double = (request().body().asMultipartFormData().asFormUrlEncoded().get("double"))[0]; String value_double = (request.body().asMultipartFormData().asFormUrlEncoded().get("double"))[0];
Double _double; Double _double;
if (value_double != null) { if (value_double != null) {
_double = Double.parseDouble(value_double); _double = Double.parseDouble(value_double);
} else { } else {
throw new IllegalArgumentException("'double' parameter is required"); 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; String string;
if (valuestring != null) { if (valuestring != null) {
string = valuestring; string = valuestring;
} else { } else {
string = null; 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; String patternWithoutDelimiter;
if (valuepatternWithoutDelimiter != null) { if (valuepatternWithoutDelimiter != null) {
patternWithoutDelimiter = valuepatternWithoutDelimiter; patternWithoutDelimiter = valuepatternWithoutDelimiter;
} else { } else {
throw new IllegalArgumentException("'pattern_without_delimiter' parameter is required"); 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; byte[] _byte;
if (value_byte != null) { if (value_byte != null) {
_byte = value_byte.getBytes(); _byte = value_byte.getBytes();
} else { } else {
throw new IllegalArgumentException("'byte' parameter is required"); throw new IllegalArgumentException("'byte' parameter is required");
} }
Http.MultipartFormData.FilePart binary = request().body().asMultipartFormData().getFile("binary"); Http.MultipartFormData.FilePart binary = request.body().asMultipartFormData().getFile("binary");
String valuedate = (request().body().asMultipartFormData().asFormUrlEncoded().get("date"))[0]; String valuedate = (request.body().asMultipartFormData().asFormUrlEncoded().get("date"))[0];
LocalDate date; LocalDate date;
if (valuedate != null) { if (valuedate != null) {
date = LocalDate.parse(valuedate); date = LocalDate.parse(valuedate);
} else { } else {
date = null; date = null;
} }
String valuedateTime = (request().body().asMultipartFormData().asFormUrlEncoded().get("dateTime"))[0]; String valuedateTime = (request.body().asMultipartFormData().asFormUrlEncoded().get("dateTime"))[0];
OffsetDateTime dateTime; OffsetDateTime dateTime;
if (valuedateTime != null) { if (valuedateTime != null) {
dateTime = OffsetDateTime.parse(valuedateTime); dateTime = OffsetDateTime.parse(valuedateTime);
} else { } else {
dateTime = null; dateTime = null;
} }
String valuepassword = (request().body().asMultipartFormData().asFormUrlEncoded().get("password"))[0]; String valuepassword = (request.body().asMultipartFormData().asFormUrlEncoded().get("password"))[0];
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
} else { } else {
password = null; password = null;
} }
String valueparamCallback = (request().body().asMultipartFormData().asFormUrlEncoded().get("callback"))[0]; String valueparamCallback = (request.body().asMultipartFormData().asFormUrlEncoded().get("callback"))[0];
String paramCallback; String paramCallback;
if (valueparamCallback != null) { if (valueparamCallback != null) {
paramCallback = valueparamCallback; paramCallback = valueparamCallback;
} else { } else {
paramCallback = null; 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(); return ok();
} }
@ApiAction @ApiAction
public Result testEnumParameters() throws Exception { public Result testEnumParameters(Http.Request request) throws Exception {
String[] enumQueryStringArrayArray = request().queryString().get("enum_query_string_array"); String[] enumQueryStringArrayArray = request.queryString().get("enum_query_string_array");
List<String> enumQueryStringArrayList = OpenAPIUtils.parametersToList("csv", enumQueryStringArrayArray); List<String> enumQueryStringArrayList = OpenAPIUtils.parametersToList("csv", enumQueryStringArrayArray);
List<String> enumQueryStringArray = new ArrayList<>(); List<String> enumQueryStringArray = new ArrayList<>();
for (String curParam : enumQueryStringArrayList) { for (String curParam : enumQueryStringArrayList) {
@ -304,28 +304,28 @@ public class FakeApiController extends Controller {
enumQueryStringArray.add(curParam); enumQueryStringArray.add(curParam);
} }
} }
String valueenumQueryString = request().getQueryString("enum_query_string"); String valueenumQueryString = request.getQueryString("enum_query_string");
String enumQueryString; String enumQueryString;
if (valueenumQueryString != null) { if (valueenumQueryString != null) {
enumQueryString = valueenumQueryString; enumQueryString = valueenumQueryString;
} else { } else {
enumQueryString = "-efg"; enumQueryString = "-efg";
} }
String valueenumQueryInteger = request().getQueryString("enum_query_integer"); String valueenumQueryInteger = request.getQueryString("enum_query_integer");
Integer enumQueryInteger; Integer enumQueryInteger;
if (valueenumQueryInteger != null) { if (valueenumQueryInteger != null) {
enumQueryInteger = Integer.parseInt(valueenumQueryInteger); enumQueryInteger = Integer.parseInt(valueenumQueryInteger);
} else { } else {
enumQueryInteger = null; enumQueryInteger = null;
} }
String valueenumQueryDouble = request().getQueryString("enum_query_double"); String valueenumQueryDouble = request.getQueryString("enum_query_double");
Double enumQueryDouble; Double enumQueryDouble;
if (valueenumQueryDouble != null) { if (valueenumQueryDouble != null) {
enumQueryDouble = Double.parseDouble(valueenumQueryDouble); enumQueryDouble = Double.parseDouble(valueenumQueryDouble);
} else { } else {
enumQueryDouble = null; 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> enumFormStringArrayList = OpenAPIUtils.parametersToList("csv", enumFormStringArrayArray);
List<String> enumFormStringArray = new ArrayList<>(); List<String> enumFormStringArray = new ArrayList<>();
for (String curParam : enumFormStringArrayList) { for (String curParam : enumFormStringArrayList) {
@ -334,14 +334,14 @@ public class FakeApiController extends Controller {
enumFormStringArray.add(curParam); 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; String enumFormString;
if (valueenumFormString != null) { if (valueenumFormString != null) {
enumFormString = valueenumFormString; enumFormString = valueenumFormString;
} else { } else {
enumFormString = "-efg"; 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> enumHeaderStringArrayList = OpenAPIUtils.parametersToList("csv", enumHeaderStringArrayArray);
List<String> enumHeaderStringArray = new ArrayList<>(); List<String> enumHeaderStringArray = new ArrayList<>();
for (String curParam : enumHeaderStringArrayList) { for (String curParam : enumHeaderStringArrayList) {
@ -350,68 +350,68 @@ public class FakeApiController extends Controller {
enumHeaderStringArray.add(curParam); enumHeaderStringArray.add(curParam);
} }
} }
String valueenumHeaderString = request().getHeader("enum_header_string"); String valueenumHeaderString = request.header("enum_header_string").get();
String enumHeaderString; String enumHeaderString;
if (valueenumHeaderString != null) { if (valueenumHeaderString != null) {
enumHeaderString = valueenumHeaderString; enumHeaderString = valueenumHeaderString;
} else { } else {
enumHeaderString = "-efg"; 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(); return ok();
} }
@ApiAction @ApiAction
public Result testGroupParameters() throws Exception { public Result testGroupParameters(Http.Request request) throws Exception {
String valuerequiredStringGroup = request().getQueryString("required_string_group"); String valuerequiredStringGroup = request.getQueryString("required_string_group");
Integer requiredStringGroup; Integer requiredStringGroup;
if (valuerequiredStringGroup != null) { if (valuerequiredStringGroup != null) {
requiredStringGroup = Integer.parseInt(valuerequiredStringGroup); requiredStringGroup = Integer.parseInt(valuerequiredStringGroup);
} else { } else {
throw new IllegalArgumentException("'required_string_group' parameter is required"); 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; Long requiredInt64Group;
if (valuerequiredInt64Group != null) { if (valuerequiredInt64Group != null) {
requiredInt64Group = Long.parseLong(valuerequiredInt64Group); requiredInt64Group = Long.parseLong(valuerequiredInt64Group);
} else { } else {
throw new IllegalArgumentException("'required_int64_group' parameter is required"); throw new IllegalArgumentException("'required_int64_group' parameter is required");
} }
String valuestringGroup = request().getQueryString("string_group"); String valuestringGroup = request.getQueryString("string_group");
Integer stringGroup; Integer stringGroup;
if (valuestringGroup != null) { if (valuestringGroup != null) {
stringGroup = Integer.parseInt(valuestringGroup); stringGroup = Integer.parseInt(valuestringGroup);
} else { } else {
stringGroup = null; stringGroup = null;
} }
String valueint64Group = request().getQueryString("int64_group"); String valueint64Group = request.getQueryString("int64_group");
Long int64Group; Long int64Group;
if (valueint64Group != null) { if (valueint64Group != null) {
int64Group = Long.parseLong(valueint64Group); int64Group = Long.parseLong(valueint64Group);
} else { } else {
int64Group = null; int64Group = null;
} }
String valuerequiredBooleanGroup = request().getHeader("required_boolean_group"); String valuerequiredBooleanGroup = request.header("required_boolean_group").get();
Boolean requiredBooleanGroup; Boolean requiredBooleanGroup;
if (valuerequiredBooleanGroup != null) { if (valuerequiredBooleanGroup != null) {
requiredBooleanGroup = Boolean.valueOf(valuerequiredBooleanGroup); requiredBooleanGroup = Boolean.valueOf(valuerequiredBooleanGroup);
} else { } else {
throw new IllegalArgumentException("'required_boolean_group' parameter is required"); throw new IllegalArgumentException("'required_boolean_group' parameter is required");
} }
String valuebooleanGroup = request().getHeader("boolean_group"); String valuebooleanGroup = request.header("boolean_group").get();
Boolean booleanGroup; Boolean booleanGroup;
if (valuebooleanGroup != null) { if (valuebooleanGroup != null) {
booleanGroup = Boolean.valueOf(valuebooleanGroup); booleanGroup = Boolean.valueOf(valuebooleanGroup);
} else { } else {
booleanGroup = null; booleanGroup = null;
} }
imp.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); imp.testGroupParameters(request, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result testInlineAdditionalProperties() throws Exception { public Result testInlineAdditionalProperties(Http.Request request) throws Exception {
JsonNode nodeparam = request().body().asJson(); JsonNode nodeparam = request.body().asJson();
Map<String, String> param; Map<String, String> param;
if (nodeparam != null) { if (nodeparam != null) {
param = mapper.readValue(nodeparam.toString(), new TypeReference<Map<String, String>>(){}); param = mapper.readValue(nodeparam.toString(), new TypeReference<Map<String, String>>(){});
@ -423,33 +423,33 @@ public class FakeApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'param' parameter is required"); throw new IllegalArgumentException("'param' parameter is required");
} }
imp.testInlineAdditionalProperties(param); imp.testInlineAdditionalProperties(request, param);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result testJsonFormData() throws Exception { public Result testJsonFormData(Http.Request request) throws Exception {
String valueparam = (request().body().asMultipartFormData().asFormUrlEncoded().get("param"))[0]; String valueparam = (request.body().asMultipartFormData().asFormUrlEncoded().get("param"))[0];
String param; String param;
if (valueparam != null) { if (valueparam != null) {
param = valueparam; param = valueparam;
} else { } else {
throw new IllegalArgumentException("'param' parameter is required"); 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; String param2;
if (valueparam2 != null) { if (valueparam2 != null) {
param2 = valueparam2; param2 = valueparam2;
} else { } else {
throw new IllegalArgumentException("'param2' parameter is required"); throw new IllegalArgumentException("'param2' parameter is required");
} }
imp.testJsonFormData(param, param2); imp.testJsonFormData(request, param, param2);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result testQueryParameterCollectionFormat() throws Exception { public Result testQueryParameterCollectionFormat(Http.Request request) throws Exception {
String[] pipeArray = request().queryString().get("pipe"); String[] pipeArray = request.queryString().get("pipe");
if (pipeArray == null) { if (pipeArray == null) {
throw new IllegalArgumentException("'pipe' parameter is required"); throw new IllegalArgumentException("'pipe' parameter is required");
} }
@ -461,7 +461,7 @@ public class FakeApiController extends Controller {
pipe.add(curParam); pipe.add(curParam);
} }
} }
String[] ioutilArray = request().queryString().get("ioutil"); String[] ioutilArray = request.queryString().get("ioutil");
if (ioutilArray == null) { if (ioutilArray == null) {
throw new IllegalArgumentException("'ioutil' parameter is required"); throw new IllegalArgumentException("'ioutil' parameter is required");
} }
@ -473,7 +473,7 @@ public class FakeApiController extends Controller {
ioutil.add(curParam); ioutil.add(curParam);
} }
} }
String[] httpArray = request().queryString().get("http"); String[] httpArray = request.queryString().get("http");
if (httpArray == null) { if (httpArray == null) {
throw new IllegalArgumentException("'http' parameter is required"); throw new IllegalArgumentException("'http' parameter is required");
} }
@ -485,7 +485,7 @@ public class FakeApiController extends Controller {
http.add(curParam); http.add(curParam);
} }
} }
String[] urlArray = request().queryString().get("url"); String[] urlArray = request.queryString().get("url");
if (urlArray == null) { if (urlArray == null) {
throw new IllegalArgumentException("'url' parameter is required"); throw new IllegalArgumentException("'url' parameter is required");
} }
@ -497,7 +497,7 @@ public class FakeApiController extends Controller {
url.add(curParam); url.add(curParam);
} }
} }
String[] contextArray = request().queryString().get("context"); String[] contextArray = request.queryString().get("context");
if (contextArray == null) { if (contextArray == null) {
throw new IllegalArgumentException("'context' parameter is required"); throw new IllegalArgumentException("'context' parameter is required");
} }
@ -509,7 +509,7 @@ public class FakeApiController extends Controller {
context.add(curParam); context.add(curParam);
} }
} }
imp.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); imp.testQueryParameterCollectionFormat(request, pipe, ioutil, http, url, context);
return ok(); return ok();
} }
} }

View File

@ -21,77 +21,77 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class FakeApiControllerImp implements FakeApiControllerImpInterface { public class FakeApiControllerImp implements FakeApiControllerImpInterface {
@Override @Override
public void createXmlItem(XmlItem xmlItem) throws Exception { public void createXmlItem(Http.Request request, XmlItem xmlItem) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public Boolean fakeOuterBooleanSerialize(Boolean body) throws Exception { public Boolean fakeOuterBooleanSerialize(Http.Request request, Boolean body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Boolean(true); return new Boolean(true);
} }
@Override @Override
public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Exception { public OuterComposite fakeOuterCompositeSerialize(Http.Request request, OuterComposite body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new OuterComposite(); return new OuterComposite();
} }
@Override @Override
public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws Exception { public BigDecimal fakeOuterNumberSerialize(Http.Request request, BigDecimal body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new BigDecimal(1.0); return new BigDecimal(1.0);
} }
@Override @Override
public String fakeOuterStringSerialize(String body) throws Exception { public String fakeOuterStringSerialize(Http.Request request, String body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new String(); return new String();
} }
@Override @Override
public void testBodyWithFileSchema(FileSchemaTestClass body) throws Exception { public void testBodyWithFileSchema(Http.Request request, FileSchemaTestClass body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @Override
public Client testClientModel(Client body) throws Exception { public Client testClientModel(Http.Request request, Client body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Client(); return new Client();
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }

View File

@ -20,32 +20,32 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface FakeApiControllerImpInterface { 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;
} }

View File

@ -38,8 +38,8 @@ public class FakeClassnameTags123ApiController extends Controller {
@ApiAction @ApiAction
public Result testClassname() throws Exception { public Result testClassname(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Client body; Client body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Client.class); body = mapper.readValue(nodebody.toString(), Client.class);
@ -49,7 +49,7 @@ public class FakeClassnameTags123ApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Client obj = imp.testClassname(body); Client obj = imp.testClassname(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -12,7 +12,7 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class FakeClassnameTags123ApiControllerImp implements FakeClassnameTags123ApiControllerImpInterface { public class FakeClassnameTags123ApiControllerImp implements FakeClassnameTags123ApiControllerImpInterface {
@Override @Override
public Client testClassname(Client body) throws Exception { public Client testClassname(Http.Request request, Client body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Client(); return new Client();
} }

View File

@ -11,6 +11,6 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface FakeClassnameTags123ApiControllerImpInterface { public interface FakeClassnameTags123ApiControllerImpInterface {
Client testClassname(Client body) throws Exception; Client testClassname(Http.Request request, Client body) throws Exception;
} }

View File

@ -41,8 +41,8 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public Result addPet() throws Exception { public Result addPet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -52,26 +52,26 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.addPet(body); imp.addPet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deletePet(Long petId) throws Exception { public Result deletePet(Http.Request request, Long petId) throws Exception {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
} else { } else {
apiKey = null; apiKey = null;
} }
imp.deletePet(petId, apiKey); imp.deletePet(request, petId, apiKey);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result findPetsByStatus() throws Exception { public Result findPetsByStatus(Http.Request request) throws Exception {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -83,7 +83,7 @@ public class PetApiController extends Controller {
status.add(curParam); status.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByStatus(status); List<Pet> obj = imp.findPetsByStatus(request, status);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -94,8 +94,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result findPetsByTags() throws Exception { public Result findPetsByTags(Http.Request request) throws Exception {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -107,7 +107,7 @@ public class PetApiController extends Controller {
tags.add(curParam); tags.add(curParam);
} }
} }
Set<Pet> obj = imp.findPetsByTags(tags); Set<Pet> obj = imp.findPetsByTags(request, tags);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -118,8 +118,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result getPetById(Long petId) throws Exception { public Result getPetById(Http.Request request, Long petId) throws Exception {
Pet obj = imp.getPetById(petId); Pet obj = imp.getPetById(request, petId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -128,8 +128,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result updatePet() throws Exception { public Result updatePet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -139,41 +139,41 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updatePet(body); imp.updatePet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updatePetWithForm(Long petId) throws Exception { public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
} else { } else {
status = null; status = null;
} }
imp.updatePetWithForm(petId, name, status); imp.updatePetWithForm(request, petId, name, status);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result uploadFile(Long petId) throws Exception { public Result uploadFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -182,19 +182,19 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result uploadFileWithRequiredFile(Long petId) throws Exception { public Result uploadFileWithRequiredFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; 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)) { if ((requiredFile == null || ((File) requiredFile.getFile()).length() == 0)) {
throw new IllegalArgumentException("'requiredFile' file cannot be empty"); 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")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -15,51 +15,51 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class PetApiControllerImp implements PetApiControllerImpInterface { public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override @Override
public void addPet(Pet body) throws Exception { public void addPet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @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!!! //Do your magic!!!
return new LinkedHashSet<Pet>(); return new LinkedHashSet<Pet>();
} }
@Override @Override
public Pet getPetById(Long petId) throws Exception { public Pet getPetById(Http.Request request, Long petId) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Pet(); return new Pet();
} }
@Override @Override
public void updatePet(Pet body) throws Exception { public void updatePet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ModelApiResponse(); return new ModelApiResponse();
} }
@Override @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!!! //Do your magic!!!
return new ModelApiResponse(); return new ModelApiResponse();
} }

View File

@ -14,22 +14,22 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface PetApiControllerImpInterface { 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;
} }

View File

@ -39,21 +39,21 @@ public class StoreApiController extends Controller {
@ApiAction @ApiAction
public Result deleteOrder(String orderId) throws Exception { public Result deleteOrder(Http.Request request, String orderId) throws Exception {
imp.deleteOrder(orderId); imp.deleteOrder(request, orderId);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getInventory() throws Exception { public Result getInventory(Http.Request request) throws Exception {
Map<String, Integer> obj = imp.getInventory(); Map<String, Integer> obj = imp.getInventory(request);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @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 {
Order obj = imp.getOrderById(orderId); Order obj = imp.getOrderById(request, orderId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -62,8 +62,8 @@ public class StoreApiController extends Controller {
} }
@ApiAction @ApiAction
public Result placeOrder() throws Exception { public Result placeOrder(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Order body; Order body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class); body = mapper.readValue(nodebody.toString(), Order.class);
@ -73,7 +73,7 @@ public class StoreApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Order obj = imp.placeOrder(body); Order obj = imp.placeOrder(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -13,24 +13,24 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class StoreApiControllerImp implements StoreApiControllerImpInterface { public class StoreApiControllerImp implements StoreApiControllerImpInterface {
@Override @Override
public void deleteOrder(String orderId) throws Exception { public void deleteOrder(Http.Request request, String orderId) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public Map<String, Integer> getInventory() throws Exception { public Map<String, Integer> getInventory(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
return new HashMap<String, Integer>(); return new HashMap<String, Integer>();
} }
@Override @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!!! //Do your magic!!!
return new Order(); return new Order();
} }
@Override @Override
public Order placeOrder(Order body) throws Exception { public Order placeOrder(Http.Request request, Order body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Order(); return new Order();
} }

View File

@ -12,12 +12,12 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface StoreApiControllerImpInterface { 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;
} }

View File

@ -39,8 +39,8 @@ public class UserApiController extends Controller {
@ApiAction @ApiAction
public Result createUser() throws Exception { public Result createUser(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -50,13 +50,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUser(body); imp.createUser(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithArrayInput() throws Exception { public Result createUsersWithArrayInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -68,13 +68,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithArrayInput(body); imp.createUsersWithArrayInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithListInput() throws Exception { public Result createUsersWithListInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -86,19 +86,19 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithListInput(body); imp.createUsersWithListInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deleteUser(String username) throws Exception { public Result deleteUser(Http.Request request, String username) throws Exception {
imp.deleteUser(username); imp.deleteUser(request, username);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getUserByName(String username) throws Exception { public Result getUserByName(Http.Request request, String username) throws Exception {
User obj = imp.getUserByName(username); User obj = imp.getUserByName(request, username);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -107,35 +107,35 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result loginUser() throws Exception { public Result loginUser(Http.Request request) throws Exception {
String valueusername = request().getQueryString("username"); String valueusername = request.getQueryString("username");
String username; String username;
if (valueusername != null) { if (valueusername != null) {
username = valueusername; username = valueusername;
} else { } else {
throw new IllegalArgumentException("'username' parameter is required"); throw new IllegalArgumentException("'username' parameter is required");
} }
String valuepassword = request().getQueryString("password"); String valuepassword = request.getQueryString("password");
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
} else { } else {
throw new IllegalArgumentException("'password' parameter is required"); 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); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result logoutUser() throws Exception { public Result logoutUser(Http.Request request) throws Exception {
imp.logoutUser(); imp.logoutUser(request);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updateUser(String username) throws Exception { public Result updateUser(Http.Request request, String username) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -145,7 +145,7 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updateUser(username, body); imp.updateUser(request, username, body);
return ok(); return ok();
} }
} }

View File

@ -13,44 +13,44 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class UserApiControllerImp implements UserApiControllerImpInterface { public class UserApiControllerImp implements UserApiControllerImpInterface {
@Override @Override
public void createUser(User body) throws Exception { public void createUser(Http.Request request, User body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithArrayInput(List<User> body) throws Exception { public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithListInput(List<User> body) throws Exception { public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void deleteUser(String username) throws Exception { public void deleteUser(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public User getUserByName(String username) throws Exception { public User getUserByName(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
return new User(); return new User();
} }
@Override @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!!! //Do your magic!!!
return new String(); return new String();
} }
@Override @Override
public void logoutUser() throws Exception { public void logoutUser(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }

View File

@ -12,20 +12,20 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface UserApiControllerImpInterface { 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;
} }

View File

@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" 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 += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += guice libraryDependencies += guice

View File

@ -6,53 +6,53 @@ GET /api controllers.ApiDocController.api
#Functions for AnotherFake 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 #Functions for Fake API
POST /v2/fake/create_xml_item controllers.FakeApiController.createXmlItem() POST /v2/fake/create_xml_item controllers.FakeApiController.createXmlItem(request: Request)
POST /v2/fake/outer/boolean controllers.FakeApiController.fakeOuterBooleanSerialize() POST /v2/fake/outer/boolean controllers.FakeApiController.fakeOuterBooleanSerialize(request: Request)
POST /v2/fake/outer/composite controllers.FakeApiController.fakeOuterCompositeSerialize() POST /v2/fake/outer/composite controllers.FakeApiController.fakeOuterCompositeSerialize(request: Request)
POST /v2/fake/outer/number controllers.FakeApiController.fakeOuterNumberSerialize() POST /v2/fake/outer/number controllers.FakeApiController.fakeOuterNumberSerialize(request: Request)
POST /v2/fake/outer/string controllers.FakeApiController.fakeOuterStringSerialize() POST /v2/fake/outer/string controllers.FakeApiController.fakeOuterStringSerialize(request: Request)
PUT /v2/fake/body-with-file-schema controllers.FakeApiController.testBodyWithFileSchema() PUT /v2/fake/body-with-file-schema controllers.FakeApiController.testBodyWithFileSchema(request: Request)
PUT /v2/fake/body-with-query-params controllers.FakeApiController.testBodyWithQueryParams() PUT /v2/fake/body-with-query-params controllers.FakeApiController.testBodyWithQueryParams(request: Request)
PATCH /v2/fake controllers.FakeApiController.testClientModel() PATCH /v2/fake controllers.FakeApiController.testClientModel(request: Request)
POST /v2/fake controllers.FakeApiController.testEndpointParameters() POST /v2/fake controllers.FakeApiController.testEndpointParameters(request: Request)
GET /v2/fake controllers.FakeApiController.testEnumParameters() GET /v2/fake controllers.FakeApiController.testEnumParameters(request: Request)
DELETE /v2/fake controllers.FakeApiController.testGroupParameters() DELETE /v2/fake controllers.FakeApiController.testGroupParameters(request: Request)
POST /v2/fake/inline-additionalProperties controllers.FakeApiController.testInlineAdditionalProperties() POST /v2/fake/inline-additionalProperties controllers.FakeApiController.testInlineAdditionalProperties(request: Request)
GET /v2/fake/jsonFormData controllers.FakeApiController.testJsonFormData() GET /v2/fake/jsonFormData controllers.FakeApiController.testJsonFormData(request: Request)
PUT /v2/fake/test-query-paramters controllers.FakeApiController.testQueryParameterCollectionFormat() PUT /v2/fake/test-query-paramters controllers.FakeApiController.testQueryParameterCollectionFormat(request: Request)
#Functions for FakeClassnameTags123 API #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 #Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet() POST /v2/pet controllers.PetApiController.addPet(request: Request)
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long) DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus() GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags() GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long) GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet() PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long) POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long) POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, petId: Long)
POST /v2/fake/:petId/uploadImageWithRequiredFile controllers.PetApiController.uploadFileWithRequiredFile(petId: Long) POST /v2/fake/:petId/uploadImageWithRequiredFile controllers.PetApiController.uploadFileWithRequiredFile(request: Request, petId: Long)
#Functions for Store API #Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String) DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory() GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long) GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder() POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
#Functions for User API #Functions for User API
POST /v2/user controllers.UserApiController.createUser() POST /v2/user controllers.UserApiController.createUser(request: Request)
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput() POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput() POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String) DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String) GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
GET /v2/user/login controllers.UserApiController.loginUser() GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
GET /v2/user/logout controllers.UserApiController.logoutUser() GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String) PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
# Map static resources from the /public folder to the /assets URL path # Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file) GET /assets/*file controllers.Assets.at(file)

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -36,34 +36,34 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public Result addPet() throws Exception { public Result addPet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.addPet(body); imp.addPet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deletePet(Long petId) throws Exception { public Result deletePet(Http.Request request, Long petId) throws Exception {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
} else { } else {
apiKey = null; apiKey = null;
} }
imp.deletePet(petId, apiKey); imp.deletePet(request, petId, apiKey);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result findPetsByStatus() throws Exception { public Result findPetsByStatus(Http.Request request) throws Exception {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -75,14 +75,14 @@ public class PetApiController extends Controller {
status.add(curParam); status.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByStatus(status); List<Pet> obj = imp.findPetsByStatus(request, status);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result findPetsByTags() throws Exception { public Result findPetsByTags(Http.Request request) throws Exception {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -94,62 +94,62 @@ public class PetApiController extends Controller {
tags.add(curParam); tags.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByTags(tags); List<Pet> obj = imp.findPetsByTags(request, tags);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result getPetById(Long petId) throws Exception { public Result getPetById(Http.Request request, Long petId) throws Exception {
Pet obj = imp.getPetById(petId); Pet obj = imp.getPetById(request, petId);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result updatePet() throws Exception { public Result updatePet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updatePet(body); imp.updatePet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updatePetWithForm(Long petId) throws Exception { public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
} else { } else {
status = null; status = null;
} }
imp.updatePetWithForm(petId, name, status); imp.updatePetWithForm(request, petId, name, status);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result uploadFile(Long petId) throws Exception { public Result uploadFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }

View File

@ -13,45 +13,45 @@ import java.io.FileInputStream;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class PetApiControllerImp implements PetApiControllerImpInterface { public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override @Override
public void addPet(Pet body) throws Exception { public void addPet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @Override
public Pet getPetById(Long petId) throws Exception { public Pet getPetById(Http.Request request, Long petId) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Pet(); return new Pet();
} }
@Override @Override
public void updatePet(Pet body) throws Exception { public void updatePet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ModelApiResponse(); return new ModelApiResponse();
} }

View File

@ -12,20 +12,20 @@ import java.util.HashMap;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface PetApiControllerImpInterface { 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;
} }

View File

@ -35,35 +35,35 @@ public class StoreApiController extends Controller {
@ApiAction @ApiAction
public Result deleteOrder(String orderId) throws Exception { public Result deleteOrder(Http.Request request, String orderId) throws Exception {
imp.deleteOrder(orderId); imp.deleteOrder(request, orderId);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getInventory() throws Exception { public Result getInventory(Http.Request request) throws Exception {
Map<String, Integer> obj = imp.getInventory(); Map<String, Integer> obj = imp.getInventory(request);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result getOrderById(Long orderId) throws Exception { public Result getOrderById(Http.Request request, Long orderId) throws Exception {
Order obj = imp.getOrderById(orderId); Order obj = imp.getOrderById(request, orderId);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result placeOrder() throws Exception { public Result placeOrder(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Order body; Order body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class); body = mapper.readValue(nodebody.toString(), Order.class);
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Order obj = imp.placeOrder(body); Order obj = imp.placeOrder(request, body);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }

View File

@ -12,24 +12,24 @@ import java.io.FileInputStream;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class StoreApiControllerImp implements StoreApiControllerImpInterface { public class StoreApiControllerImp implements StoreApiControllerImpInterface {
@Override @Override
public void deleteOrder(String orderId) throws Exception { public void deleteOrder(Http.Request request, String orderId) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public Map<String, Integer> getInventory() throws Exception { public Map<String, Integer> getInventory(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
return new HashMap<String, Integer>(); return new HashMap<String, Integer>();
} }
@Override @Override
public Order getOrderById(Long orderId) throws Exception { public Order getOrderById(Http.Request request, Long orderId) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Order(); return new Order();
} }
@Override @Override
public Order placeOrder(Order body) throws Exception { public Order placeOrder(Http.Request request, Order body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Order(); return new Order();
} }

View File

@ -11,12 +11,12 @@ import java.util.HashMap;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface StoreApiControllerImpInterface { 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;
} }

View File

@ -35,94 +35,94 @@ public class UserApiController extends Controller {
@ApiAction @ApiAction
public Result createUser() throws Exception { public Result createUser(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUser(body); imp.createUser(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithArrayInput() throws Exception { public Result createUsersWithArrayInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithArrayInput(body); imp.createUsersWithArrayInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithListInput() throws Exception { public Result createUsersWithListInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithListInput(body); imp.createUsersWithListInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deleteUser(String username) throws Exception { public Result deleteUser(Http.Request request, String username) throws Exception {
imp.deleteUser(username); imp.deleteUser(request, username);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getUserByName(String username) throws Exception { public Result getUserByName(Http.Request request, String username) throws Exception {
User obj = imp.getUserByName(username); User obj = imp.getUserByName(request, username);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result loginUser() throws Exception { public Result loginUser(Http.Request request) throws Exception {
String valueusername = request().getQueryString("username"); String valueusername = request.getQueryString("username");
String username; String username;
if (valueusername != null) { if (valueusername != null) {
username = valueusername; username = valueusername;
} else { } else {
throw new IllegalArgumentException("'username' parameter is required"); throw new IllegalArgumentException("'username' parameter is required");
} }
String valuepassword = request().getQueryString("password"); String valuepassword = request.getQueryString("password");
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
} else { } else {
throw new IllegalArgumentException("'password' parameter is required"); 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); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result logoutUser() throws Exception { public Result logoutUser(Http.Request request) throws Exception {
imp.logoutUser(); imp.logoutUser(request);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updateUser(String username) throws Exception { public Result updateUser(Http.Request request, String username) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updateUser(username, body); imp.updateUser(request, username, body);
return ok(); return ok();
} }
} }

View File

@ -12,44 +12,44 @@ import java.io.FileInputStream;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class UserApiControllerImp implements UserApiControllerImpInterface { public class UserApiControllerImp implements UserApiControllerImpInterface {
@Override @Override
public void createUser(User body) throws Exception { public void createUser(Http.Request request, User body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithArrayInput(List<User> body) throws Exception { public void createUsersWithArrayInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithListInput(List<User> body) throws Exception { public void createUsersWithListInput(Http.Request request, List<User> body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void deleteUser(String username) throws Exception { public void deleteUser(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public User getUserByName(String username) throws Exception { public User getUserByName(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
return new User(); return new User();
} }
@Override @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!!! //Do your magic!!!
return new String(); return new String();
} }
@Override @Override
public void logoutUser() throws Exception { public void logoutUser(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }

View File

@ -11,20 +11,20 @@ import java.util.HashMap;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface UserApiControllerImpInterface { 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;
} }

View File

@ -6,5 +6,5 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" scalaVersion := "2.12.6"
libraryDependencies += "org.webjars" % "swagger-ui" % "3.23.5" libraryDependencies += "org.webjars" % "swagger-ui" % "3.32.5"
libraryDependencies += guice libraryDependencies += guice

View File

@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
#Functions for Pet API #Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet() POST /v2/pet controllers.PetApiController.addPet(request: Request)
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long) DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus() GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags() GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long) GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet() PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long) POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long) POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, petId: Long)
#Functions for Store API #Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String) DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory() GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long) GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder() POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
#Functions for User API #Functions for User API
POST /v2/user controllers.UserApiController.createUser() POST /v2/user controllers.UserApiController.createUser(request: Request)
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput() POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput() POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String) DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String) GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
GET /v2/user/login controllers.UserApiController.loginUser() GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
GET /v2/user/logout controllers.UserApiController.logoutUser() GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String) PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
# Map static resources from the /public folder to the /assets URL path # Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file) GET /assets/*file controllers.Assets.at(file)

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -41,8 +41,8 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public Result addPet() throws IOException { public Result addPet(Http.Request request) throws IOException {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -52,26 +52,26 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.addPet(body); imp.addPet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deletePet(Long petId) { public Result deletePet(Http.Request request, Long petId) {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
} else { } else {
apiKey = null; apiKey = null;
} }
imp.deletePet(petId, apiKey); imp.deletePet(request, petId, apiKey);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result findPetsByStatus() { public Result findPetsByStatus(Http.Request request) {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -83,7 +83,7 @@ public class PetApiController extends Controller {
status.add(curParam); status.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByStatus(status); List<Pet> obj = imp.findPetsByStatus(request, status);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -94,8 +94,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result findPetsByTags() { public Result findPetsByTags(Http.Request request) {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -107,7 +107,7 @@ public class PetApiController extends Controller {
tags.add(curParam); tags.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByTags(tags); List<Pet> obj = imp.findPetsByTags(request, tags);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -118,8 +118,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result getPetById(Long petId) { public Result getPetById(Http.Request request, Long petId) {
Pet obj = imp.getPetById(petId); Pet obj = imp.getPetById(request, petId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -128,8 +128,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result updatePet() throws IOException { public Result updatePet(Http.Request request) throws IOException {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -139,41 +139,41 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updatePet(body); imp.updatePet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updatePetWithForm(Long petId) { public Result updatePetWithForm(Http.Request request, Long petId) {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
} else { } else {
status = null; status = null;
} }
imp.updatePetWithForm(petId, name, status); imp.updatePetWithForm(request, petId, name, status);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result uploadFile(Long petId) { public Result uploadFile(Http.Request request, Long petId) {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -14,45 +14,45 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class PetApiControllerImp implements PetApiControllerImpInterface { public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override @Override
public void addPet(Pet body) { public void addPet(Http.Request request, Pet body) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void deletePet(Long petId, String apiKey) { public void deletePet(Http.Request request, Long petId, String apiKey) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public List<Pet> findPetsByStatus( @NotNull List<String> status) { public List<Pet> findPetsByStatus(Http.Request request, @NotNull List<String> status) {
//Do your magic!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @Override
public List<Pet> findPetsByTags( @NotNull List<String> tags) { public List<Pet> findPetsByTags(Http.Request request, @NotNull List<String> tags) {
//Do your magic!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @Override
public Pet getPetById(Long petId) { public Pet getPetById(Http.Request request, Long petId) {
//Do your magic!!! //Do your magic!!!
return new Pet(); return new Pet();
} }
@Override @Override
public void updatePet(Pet body) { public void updatePet(Http.Request request, Pet body) {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ModelApiResponse(); return new ModelApiResponse();
} }

View File

@ -13,20 +13,20 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface PetApiControllerImpInterface { 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) ;
} }

View File

@ -40,21 +40,21 @@ public class StoreApiController extends Controller {
@ApiAction @ApiAction
public Result deleteOrder(String orderId) { public Result deleteOrder(Http.Request request, String orderId) {
imp.deleteOrder(orderId); imp.deleteOrder(request, orderId);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getInventory() { public Result getInventory(Http.Request request) {
Map<String, Integer> obj = imp.getInventory(); Map<String, Integer> obj = imp.getInventory(request);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result getOrderById( @Min(1) @Max(5)Long orderId) { public Result getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) {
Order obj = imp.getOrderById(orderId); Order obj = imp.getOrderById(request, orderId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -63,8 +63,8 @@ public class StoreApiController extends Controller {
} }
@ApiAction @ApiAction
public Result placeOrder() throws IOException { public Result placeOrder(Http.Request request) throws IOException {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Order body; Order body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class); body = mapper.readValue(nodebody.toString(), Order.class);
@ -74,7 +74,7 @@ public class StoreApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Order obj = imp.placeOrder(body); Order obj = imp.placeOrder(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -13,24 +13,24 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class StoreApiControllerImp implements StoreApiControllerImpInterface { public class StoreApiControllerImp implements StoreApiControllerImpInterface {
@Override @Override
public void deleteOrder(String orderId) { public void deleteOrder(Http.Request request, String orderId) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public Map<String, Integer> getInventory() { public Map<String, Integer> getInventory(Http.Request request) {
//Do your magic!!! //Do your magic!!!
return new HashMap<String, Integer>(); return new HashMap<String, Integer>();
} }
@Override @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!!! //Do your magic!!!
return new Order(); return new Order();
} }
@Override @Override
public Order placeOrder(Order body) { public Order placeOrder(Http.Request request, Order body) {
//Do your magic!!! //Do your magic!!!
return new Order(); return new Order();
} }

View File

@ -12,12 +12,12 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface StoreApiControllerImpInterface { 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) ;
} }

View File

@ -40,8 +40,8 @@ public class UserApiController extends Controller {
@ApiAction @ApiAction
public Result createUser() throws IOException { public Result createUser(Http.Request request) throws IOException {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -51,13 +51,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUser(body); imp.createUser(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithArrayInput() throws IOException { public Result createUsersWithArrayInput(Http.Request request) throws IOException {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -69,13 +69,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithArrayInput(body); imp.createUsersWithArrayInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithListInput() throws IOException { public Result createUsersWithListInput(Http.Request request) throws IOException {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -87,19 +87,19 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithListInput(body); imp.createUsersWithListInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deleteUser(String username) { public Result deleteUser(Http.Request request, String username) {
imp.deleteUser(username); imp.deleteUser(request, username);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getUserByName(String username) { public Result getUserByName(Http.Request request, String username) {
User obj = imp.getUserByName(username); User obj = imp.getUserByName(request, username);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -108,35 +108,35 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result loginUser() { public Result loginUser(Http.Request request) {
String valueusername = request().getQueryString("username"); String valueusername = request.getQueryString("username");
String username; String username;
if (valueusername != null) { if (valueusername != null) {
username = valueusername; username = valueusername;
} else { } else {
throw new IllegalArgumentException("'username' parameter is required"); throw new IllegalArgumentException("'username' parameter is required");
} }
String valuepassword = request().getQueryString("password"); String valuepassword = request.getQueryString("password");
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
} else { } else {
throw new IllegalArgumentException("'password' parameter is required"); 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); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result logoutUser() { public Result logoutUser(Http.Request request) {
imp.logoutUser(); imp.logoutUser(request);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updateUser(String username) throws IOException { public Result updateUser(Http.Request request, String username) throws IOException {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -146,7 +146,7 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updateUser(username, body); imp.updateUser(request, username, body);
return ok(); return ok();
} }
} }

View File

@ -13,44 +13,44 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class UserApiControllerImp implements UserApiControllerImpInterface { public class UserApiControllerImp implements UserApiControllerImpInterface {
@Override @Override
public void createUser(User body) { public void createUser(Http.Request request, User body) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithArrayInput(List<User> body) { public void createUsersWithArrayInput(Http.Request request, List<User> body) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void createUsersWithListInput(List<User> body) { public void createUsersWithListInput(Http.Request request, List<User> body) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void deleteUser(String username) { public void deleteUser(Http.Request request, String username) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public User getUserByName(String username) { public User getUserByName(Http.Request request, String username) {
//Do your magic!!! //Do your magic!!!
return new User(); return new User();
} }
@Override @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!!! //Do your magic!!!
return new String(); return new String();
} }
@Override @Override
public void logoutUser() { public void logoutUser(Http.Request request) {
//Do your magic!!! //Do your magic!!!
} }
@Override @Override
public void updateUser(String username, User body) { public void updateUser(Http.Request request, String username, User body) {
//Do your magic!!! //Do your magic!!!
} }

View File

@ -12,20 +12,20 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows") @SuppressWarnings("RedundantThrows")
public interface UserApiControllerImpInterface { 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) ;
} }

View File

@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" 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 += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += guice libraryDependencies += guice

View File

@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
#Functions for Pet API #Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet() POST /v2/pet controllers.PetApiController.addPet(request: Request)
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long) DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus() GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags() GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long) GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet() PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long) POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long) POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, petId: Long)
#Functions for Store API #Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String) DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory() GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long) GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder() POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
#Functions for User API #Functions for User API
POST /v2/user controllers.UserApiController.createUser() POST /v2/user controllers.UserApiController.createUser(request: Request)
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput() POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput() POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String) DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String) GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
GET /v2/user/login controllers.UserApiController.loginUser() GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
GET /v2/user/logout controllers.UserApiController.logoutUser() GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String) PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
# Map static resources from the /public folder to the /assets URL path # Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file) GET /assets/*file controllers.Assets.at(file)

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -40,8 +40,8 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public Result addPet() throws Exception { public Result addPet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -51,26 +51,26 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.addPet(body); imp.addPet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deletePet(Long petId) throws Exception { public Result deletePet(Http.Request request, Long petId) throws Exception {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
} else { } else {
apiKey = null; apiKey = null;
} }
imp.deletePet(petId, apiKey); imp.deletePet(request, petId, apiKey);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result findPetsByStatus() throws Exception { public Result findPetsByStatus(Http.Request request) throws Exception {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -82,7 +82,7 @@ public class PetApiController extends Controller {
status.add(curParam); status.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByStatus(status); List<Pet> obj = imp.findPetsByStatus(request, status);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -93,8 +93,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result findPetsByTags() throws Exception { public Result findPetsByTags(Http.Request request) throws Exception {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -106,7 +106,7 @@ public class PetApiController extends Controller {
tags.add(curParam); tags.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByTags(tags); List<Pet> obj = imp.findPetsByTags(request, tags);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -117,8 +117,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result getPetById(Long petId) throws Exception { public Result getPetById(Http.Request request, Long petId) throws Exception {
Pet obj = imp.getPetById(petId); Pet obj = imp.getPetById(request, petId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -127,8 +127,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result updatePet() throws Exception { public Result updatePet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -138,41 +138,41 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updatePet(body); imp.updatePet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updatePetWithForm(Long petId) throws Exception { public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
} else { } else {
status = null; status = null;
} }
imp.updatePetWithForm(petId, name, status); imp.updatePetWithForm(request, petId, name, status);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result uploadFile(Long petId) throws Exception { public Result uploadFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -14,45 +14,45 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class PetApiControllerImp { public class PetApiControllerImp {
public void addPet(Pet body) throws Exception { public void addPet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //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!!! //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!!! //Do your magic!!!
return new ArrayList<Pet>(); 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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
public Pet getPetById(Long petId) throws Exception { public Pet getPetById(Http.Request request, Long petId) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Pet(); return new Pet();
} }
public void updatePet(Pet body) throws Exception { public void updatePet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //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!!! //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!!! //Do your magic!!!
return new ModelApiResponse(); return new ModelApiResponse();
} }

View File

@ -39,21 +39,21 @@ public class StoreApiController extends Controller {
@ApiAction @ApiAction
public Result deleteOrder(String orderId) throws Exception { public Result deleteOrder(Http.Request request, String orderId) throws Exception {
imp.deleteOrder(orderId); imp.deleteOrder(request, orderId);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getInventory() throws Exception { public Result getInventory(Http.Request request) throws Exception {
Map<String, Integer> obj = imp.getInventory(); Map<String, Integer> obj = imp.getInventory(request);
JsonNode result = mapper.valueToTree(obj); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @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 {
Order obj = imp.getOrderById(orderId); Order obj = imp.getOrderById(request, orderId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -62,8 +62,8 @@ public class StoreApiController extends Controller {
} }
@ApiAction @ApiAction
public Result placeOrder() throws Exception { public Result placeOrder(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Order body; Order body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class); body = mapper.readValue(nodebody.toString(), Order.class);
@ -73,7 +73,7 @@ public class StoreApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
Order obj = imp.placeOrder(body); Order obj = imp.placeOrder(request, body);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -13,24 +13,24 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class StoreApiControllerImp { public class StoreApiControllerImp {
public void deleteOrder(String orderId) throws Exception { public void deleteOrder(Http.Request request, String orderId) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
public Map<String, Integer> getInventory() throws Exception { public Map<String, Integer> getInventory(Http.Request request) throws Exception {
//Do your magic!!! //Do your magic!!!
return new HashMap<String, Integer>(); 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!!! //Do your magic!!!
return new Order(); return new Order();
} }
public Order placeOrder(Order body) throws Exception { public Order placeOrder(Http.Request request, Order body) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Order(); return new Order();
} }

View File

@ -39,8 +39,8 @@ public class UserApiController extends Controller {
@ApiAction @ApiAction
public Result createUser() throws Exception { public Result createUser(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -50,13 +50,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUser(body); imp.createUser(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithArrayInput() throws Exception { public Result createUsersWithArrayInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -68,13 +68,13 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithArrayInput(body); imp.createUsersWithArrayInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result createUsersWithListInput() throws Exception { public Result createUsersWithListInput(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
List<User> body; List<User> body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){}); body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
@ -86,19 +86,19 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.createUsersWithListInput(body); imp.createUsersWithListInput(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deleteUser(String username) throws Exception { public Result deleteUser(Http.Request request, String username) throws Exception {
imp.deleteUser(username); imp.deleteUser(request, username);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result getUserByName(String username) throws Exception { public Result getUserByName(Http.Request request, String username) throws Exception {
User obj = imp.getUserByName(username); User obj = imp.getUserByName(request, username);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -107,35 +107,35 @@ public class UserApiController extends Controller {
} }
@ApiAction @ApiAction
public Result loginUser() throws Exception { public Result loginUser(Http.Request request) throws Exception {
String valueusername = request().getQueryString("username"); String valueusername = request.getQueryString("username");
String username; String username;
if (valueusername != null) { if (valueusername != null) {
username = valueusername; username = valueusername;
} else { } else {
throw new IllegalArgumentException("'username' parameter is required"); throw new IllegalArgumentException("'username' parameter is required");
} }
String valuepassword = request().getQueryString("password"); String valuepassword = request.getQueryString("password");
String password; String password;
if (valuepassword != null) { if (valuepassword != null) {
password = valuepassword; password = valuepassword;
} else { } else {
throw new IllegalArgumentException("'password' parameter is required"); 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); JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);
} }
@ApiAction @ApiAction
public Result logoutUser() throws Exception { public Result logoutUser(Http.Request request) throws Exception {
imp.logoutUser(); imp.logoutUser(request);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updateUser(String username) throws Exception { public Result updateUser(Http.Request request, String username) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
User body; User body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class); body = mapper.readValue(nodebody.toString(), User.class);
@ -145,7 +145,7 @@ public class UserApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updateUser(username, body); imp.updateUser(request, username, body);
return ok(); return ok();
} }
} }

View File

@ -13,44 +13,44 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class UserApiControllerImp { public class UserApiControllerImp {
public void createUser(User body) throws Exception { public void createUser(Http.Request request, User body) throws Exception {
//Do your magic!!! //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!!! //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!!! //Do your magic!!!
} }
public void deleteUser(String username) throws Exception { public void deleteUser(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
public User getUserByName(String username) throws Exception { public User getUserByName(Http.Request request, String username) throws Exception {
//Do your magic!!! //Do your magic!!!
return new User(); 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!!! //Do your magic!!!
return new String(); return new String();
} }
public void logoutUser() throws Exception { public void logoutUser(Http.Request request) throws Exception {
//Do your magic!!! //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!!! //Do your magic!!!
} }

View File

@ -6,6 +6,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.12.6" 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 += "javax.validation" % "validation-api" % "1.1.0.Final"
libraryDependencies += guice libraryDependencies += guice

View File

@ -6,30 +6,30 @@ GET /api controllers.ApiDocController.api
#Functions for Pet API #Functions for Pet API
POST /v2/pet controllers.PetApiController.addPet() POST /v2/pet controllers.PetApiController.addPet(request: Request)
DELETE /v2/pet/:petId controllers.PetApiController.deletePet(petId: Long) DELETE /v2/pet/:petId controllers.PetApiController.deletePet(request: Request, petId: Long)
GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus() GET /v2/pet/findByStatus controllers.PetApiController.findPetsByStatus(request: Request)
GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags() GET /v2/pet/findByTags controllers.PetApiController.findPetsByTags(request: Request)
GET /v2/pet/:petId controllers.PetApiController.getPetById(petId: Long) GET /v2/pet/:petId controllers.PetApiController.getPetById(request: Request, petId: Long)
PUT /v2/pet controllers.PetApiController.updatePet() PUT /v2/pet controllers.PetApiController.updatePet(request: Request)
POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(petId: Long) POST /v2/pet/:petId controllers.PetApiController.updatePetWithForm(request: Request, petId: Long)
POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(petId: Long) POST /v2/pet/:petId/uploadImage controllers.PetApiController.uploadFile(request: Request, petId: Long)
#Functions for Store API #Functions for Store API
DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(orderId: String) DELETE /v2/store/order/:orderId controllers.StoreApiController.deleteOrder(request: Request, orderId: String)
GET /v2/store/inventory controllers.StoreApiController.getInventory() GET /v2/store/inventory controllers.StoreApiController.getInventory(request: Request)
GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(orderId: Long) GET /v2/store/order/:orderId controllers.StoreApiController.getOrderById(request: Request, orderId: Long)
POST /v2/store/order controllers.StoreApiController.placeOrder() POST /v2/store/order controllers.StoreApiController.placeOrder(request: Request)
#Functions for User API #Functions for User API
POST /v2/user controllers.UserApiController.createUser() POST /v2/user controllers.UserApiController.createUser(request: Request)
POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput() POST /v2/user/createWithArray controllers.UserApiController.createUsersWithArrayInput(request: Request)
POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput() POST /v2/user/createWithList controllers.UserApiController.createUsersWithListInput(request: Request)
DELETE /v2/user/:username controllers.UserApiController.deleteUser(username: String) DELETE /v2/user/:username controllers.UserApiController.deleteUser(request: Request, username: String)
GET /v2/user/:username controllers.UserApiController.getUserByName(username: String) GET /v2/user/:username controllers.UserApiController.getUserByName(request: Request, username: String)
GET /v2/user/login controllers.UserApiController.loginUser() GET /v2/user/login controllers.UserApiController.loginUser(request: Request)
GET /v2/user/logout controllers.UserApiController.logoutUser() GET /v2/user/logout controllers.UserApiController.logoutUser(request: Request)
PUT /v2/user/:username controllers.UserApiController.updateUser(username: String) PUT /v2/user/:username controllers.UserApiController.updateUser(request: Request, username: String)
# Map static resources from the /public folder to the /assets URL path # Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(file) GET /assets/*file controllers.Assets.at(file)

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.3.13

View File

@ -1,2 +1,2 @@
// The Play plugin // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.25") addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.5")

View File

@ -40,8 +40,8 @@ public class PetApiController extends Controller {
@ApiAction @ApiAction
public Result addPet() throws Exception { public Result addPet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -51,26 +51,26 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.addPet(body); imp.addPet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result deletePet(Long petId) throws Exception { public Result deletePet(Http.Request request, Long petId) throws Exception {
String valueapiKey = request().getHeader("api_key"); String valueapiKey = request.header("api_key").get();
String apiKey; String apiKey;
if (valueapiKey != null) { if (valueapiKey != null) {
apiKey = valueapiKey; apiKey = valueapiKey;
} else { } else {
apiKey = null; apiKey = null;
} }
imp.deletePet(petId, apiKey); imp.deletePet(request, petId, apiKey);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result findPetsByStatus() throws Exception { public Result findPetsByStatus(Http.Request request) throws Exception {
String[] statusArray = request().queryString().get("status"); String[] statusArray = request.queryString().get("status");
if (statusArray == null) { if (statusArray == null) {
throw new IllegalArgumentException("'status' parameter is required"); throw new IllegalArgumentException("'status' parameter is required");
} }
@ -82,7 +82,7 @@ public class PetApiController extends Controller {
status.add(curParam); status.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByStatus(status); List<Pet> obj = imp.findPetsByStatus(request, status);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -93,8 +93,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result findPetsByTags() throws Exception { public Result findPetsByTags(Http.Request request) throws Exception {
String[] tagsArray = request().queryString().get("tags"); String[] tagsArray = request.queryString().get("tags");
if (tagsArray == null) { if (tagsArray == null) {
throw new IllegalArgumentException("'tags' parameter is required"); throw new IllegalArgumentException("'tags' parameter is required");
} }
@ -106,7 +106,7 @@ public class PetApiController extends Controller {
tags.add(curParam); tags.add(curParam);
} }
} }
List<Pet> obj = imp.findPetsByTags(tags); List<Pet> obj = imp.findPetsByTags(request, tags);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
for (Pet curItem : obj) { for (Pet curItem : obj) {
OpenAPIUtils.validate(curItem); OpenAPIUtils.validate(curItem);
@ -117,8 +117,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result getPetById(Long petId) throws Exception { public Result getPetById(Http.Request request, Long petId) throws Exception {
Pet obj = imp.getPetById(petId); Pet obj = imp.getPetById(request, petId);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }
@ -127,8 +127,8 @@ public class PetApiController extends Controller {
} }
@ApiAction @ApiAction
public Result updatePet() throws Exception { public Result updatePet(Http.Request request) throws Exception {
JsonNode nodebody = request().body().asJson(); JsonNode nodebody = request.body().asJson();
Pet body; Pet body;
if (nodebody != null) { if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class); body = mapper.readValue(nodebody.toString(), Pet.class);
@ -138,41 +138,41 @@ public class PetApiController extends Controller {
} else { } else {
throw new IllegalArgumentException("'body' parameter is required"); throw new IllegalArgumentException("'body' parameter is required");
} }
imp.updatePet(body); imp.updatePet(request, body);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result updatePetWithForm(Long petId) throws Exception { public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
String name; String name;
if (valuename != null) { if (valuename != null) {
name = valuename; name = valuename;
} else { } else {
name = null; name = null;
} }
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status; String status;
if (valuestatus != null) { if (valuestatus != null) {
status = valuestatus; status = valuestatus;
} else { } else {
status = null; status = null;
} }
imp.updatePetWithForm(petId, name, status); imp.updatePetWithForm(request, petId, name, status);
return ok(); return ok();
} }
@ApiAction @ApiAction
public Result uploadFile(Long petId) throws Exception { public Result uploadFile(Http.Request request, Long petId) throws Exception {
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
String additionalMetadata; String additionalMetadata;
if (valueadditionalMetadata != null) { if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata; additionalMetadata = valueadditionalMetadata;
} else { } else {
additionalMetadata = null; additionalMetadata = null;
} }
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); ModelApiResponse obj = imp.uploadFile(request, petId, additionalMetadata, file);
if (configuration.getBoolean("useOutputBeanValidation")) { if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj); OpenAPIUtils.validate(obj);
} }

View File

@ -14,45 +14,45 @@ import javax.validation.constraints.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
public class PetApiControllerImp implements PetApiControllerImpInterface { public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override @Override
public void addPet(Pet body) throws Exception { public void addPet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @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!!! //Do your magic!!!
return new ArrayList<Pet>(); return new ArrayList<Pet>();
} }
@Override @Override
public Pet getPetById(Long petId) throws Exception { public Pet getPetById(Http.Request request, Long petId) throws Exception {
//Do your magic!!! //Do your magic!!!
return new Pet(); return new Pet();
} }
@Override @Override
public void updatePet(Pet body) throws Exception { public void updatePet(Http.Request request, Pet body) throws Exception {
//Do your magic!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
} }
@Override @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!!! //Do your magic!!!
return new ModelApiResponse(); return new ModelApiResponse();
} }

Some files were not shown because too many files have changed in this diff Show More