forked from loafle/openapi-generator-original
[Play Framework] Update Play Framework Generator to latest version (#7860)
* First iteration to support new mechanism that needs to have the handle of the result. * Most of the samples now build except "async". Also, everything is messed up.. need to understand the mustache way to handle this. * New version to support play 2.8 * Fix conflict * Fix error when multiple file in forms
This commit is contained in:
committed by
GitHub
parent
ebf2f2e30f
commit
998e0fdaa2
@@ -16,6 +16,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import play.api.libs.Files.TemporaryFile;
|
||||
import openapitools.OpenAPIUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
@@ -26,7 +27,6 @@ import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class PetApiController extends Controller {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
private final Config configuration;
|
||||
|
||||
@@ -36,7 +36,6 @@ public class PetApiController extends Controller {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
@@ -146,7 +145,9 @@ public class PetApiController extends Controller {
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
Http.MultipartFormData<TemporaryFile> bodyfile = request.body().asMultipartFormData();
|
||||
Http.MultipartFormData.FilePart<TemporaryFile> file = bodyfile.getFile("file");
|
||||
return ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import play.api.libs.Files.TemporaryFile;
|
||||
import openapitools.OpenAPIUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
@@ -25,7 +26,6 @@ import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class StoreApiController extends Controller {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
private final Config configuration;
|
||||
|
||||
@@ -35,7 +35,6 @@ public class StoreApiController extends Controller {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
return ok();
|
||||
@@ -65,4 +64,5 @@ public class StoreApiController extends Controller {
|
||||
}
|
||||
return ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import play.api.libs.Files.TemporaryFile;
|
||||
import openapitools.OpenAPIUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
@@ -25,7 +26,6 @@ import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaPlayFrameworkCodegen")
|
||||
public class UserApiController extends Controller {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
private final Config configuration;
|
||||
|
||||
@@ -35,7 +35,6 @@ public class UserApiController extends Controller {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
@@ -133,4 +132,5 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
return ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ public class ApiCall extends Action<OpenAPIUtils.ApiAction> {
|
||||
@Inject
|
||||
private ApiCall() {}
|
||||
|
||||
public CompletionStage<Result> call(Http.Context ctx) {
|
||||
public CompletionStage<Result> call(Http.Request request) {
|
||||
try {
|
||||
//TODO: Do stuff you want to handle with each API call (metrics, logging, etc..)
|
||||
return delegate.call(ctx);
|
||||
return delegate.call(request);
|
||||
} catch (Throwable t) {
|
||||
//TODO: log the error in your metric
|
||||
|
||||
|
||||
Reference in New Issue
Block a user