mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +00:00
Fix package declaration for play-framework (#332)
This commit is contained in:
@@ -14,7 +14,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import swagger.SwaggerUtils;
|
||||
import openapitools.OpenAPIUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import java.util.concurrent.CompletionStage;
|
||||
@@ -23,7 +23,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import javax.validation.constraints.*;
|
||||
import play.Configuration;
|
||||
|
||||
import swagger.SwaggerUtils.ApiAction;
|
||||
import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
|
||||
public class PetApiController extends Controller {
|
||||
@@ -47,7 +47,7 @@ public class PetApiController extends Controller {
|
||||
if (nodepet != null) {
|
||||
pet = mapper.readValue(nodepet.toString(), Pet.class);
|
||||
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||
SwaggerUtils.validate(pet);
|
||||
OpenAPIUtils.validate(pet);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("'Pet' parameter is required");
|
||||
@@ -79,7 +79,7 @@ public class PetApiController extends Controller {
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
List<String> statusList = SwaggerUtils.parametersToList("csv", statusArray);
|
||||
List<String> statusList = OpenAPIUtils.parametersToList("csv", statusArray);
|
||||
List<String> status = new ArrayList<String>();
|
||||
for (String curParam : statusList) {
|
||||
if (!curParam.isEmpty()) {
|
||||
@@ -90,7 +90,7 @@ public class PetApiController extends Controller {
|
||||
CompletionStage<List<Pet>> stage = imp.findPetsByStatus(status).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
SwaggerUtils.validate(curItem);
|
||||
OpenAPIUtils.validate(curItem);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
@@ -107,7 +107,7 @@ public class PetApiController extends Controller {
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
List<String> tagsList = SwaggerUtils.parametersToList("csv", tagsArray);
|
||||
List<String> tagsList = OpenAPIUtils.parametersToList("csv", tagsArray);
|
||||
List<String> tags = new ArrayList<String>();
|
||||
for (String curParam : tagsList) {
|
||||
if (!curParam.isEmpty()) {
|
||||
@@ -118,7 +118,7 @@ public class PetApiController extends Controller {
|
||||
CompletionStage<List<Pet>> stage = imp.findPetsByTags(tags).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
for (Pet curItem : obj) {
|
||||
SwaggerUtils.validate(curItem);
|
||||
OpenAPIUtils.validate(curItem);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
@@ -133,7 +133,7 @@ public class PetApiController extends Controller {
|
||||
public CompletionStage<Result> getPetById(Long petId) throws Exception {
|
||||
CompletionStage<Pet> stage = imp.getPetById(petId).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
SwaggerUtils.validate(obj);
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
@@ -150,7 +150,7 @@ public class PetApiController extends Controller {
|
||||
if (nodepet != null) {
|
||||
pet = mapper.readValue(nodepet.toString(), Pet.class);
|
||||
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||
SwaggerUtils.validate(pet);
|
||||
OpenAPIUtils.validate(pet);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("'Pet' parameter is required");
|
||||
@@ -195,7 +195,7 @@ public class PetApiController extends Controller {
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
CompletionStage<ModelApiResponse> stage = imp.uploadFile(petId, additionalMetadata, file).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
SwaggerUtils.validate(obj);
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import swagger.SwaggerUtils;
|
||||
import openapitools.OpenAPIUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import java.util.concurrent.CompletionStage;
|
||||
@@ -22,7 +22,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import javax.validation.constraints.*;
|
||||
import play.Configuration;
|
||||
|
||||
import swagger.SwaggerUtils.ApiAction;
|
||||
import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
|
||||
public class StoreApiController extends Controller {
|
||||
@@ -62,7 +62,7 @@ public class StoreApiController extends Controller {
|
||||
public CompletionStage<Result> getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
CompletionStage<Order> stage = imp.getOrderById(orderId).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
SwaggerUtils.validate(obj);
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
@@ -79,14 +79,14 @@ public class StoreApiController extends Controller {
|
||||
if (nodeorder != null) {
|
||||
order = mapper.readValue(nodeorder.toString(), Order.class);
|
||||
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||
SwaggerUtils.validate(order);
|
||||
OpenAPIUtils.validate(order);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("'Order' parameter is required");
|
||||
}
|
||||
CompletionStage<Order> stage = imp.placeOrder(order).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
SwaggerUtils.validate(obj);
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.File;
|
||||
import swagger.SwaggerUtils;
|
||||
import openapitools.OpenAPIUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import java.util.concurrent.CompletionStage;
|
||||
@@ -22,7 +22,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import javax.validation.constraints.*;
|
||||
import play.Configuration;
|
||||
|
||||
import swagger.SwaggerUtils.ApiAction;
|
||||
import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
|
||||
public class UserApiController extends Controller {
|
||||
@@ -46,7 +46,7 @@ public class UserApiController extends Controller {
|
||||
if (nodeuser != null) {
|
||||
user = mapper.readValue(nodeuser.toString(), User.class);
|
||||
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||
SwaggerUtils.validate(user);
|
||||
OpenAPIUtils.validate(user);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("'User' parameter is required");
|
||||
@@ -65,7 +65,7 @@ public class UserApiController extends Controller {
|
||||
user = mapper.readValue(nodeuser.toString(), new TypeReference<List<User>>(){});
|
||||
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||
for (User curItem : user) {
|
||||
SwaggerUtils.validate(curItem);
|
||||
OpenAPIUtils.validate(curItem);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -85,7 +85,7 @@ public class UserApiController extends Controller {
|
||||
user = mapper.readValue(nodeuser.toString(), new TypeReference<List<User>>(){});
|
||||
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||
for (User curItem : user) {
|
||||
SwaggerUtils.validate(curItem);
|
||||
OpenAPIUtils.validate(curItem);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -109,7 +109,7 @@ public class UserApiController extends Controller {
|
||||
public CompletionStage<Result> getUserByName(String username) throws Exception {
|
||||
CompletionStage<User> stage = imp.getUserByName(username).thenApply(obj -> {
|
||||
if (configuration.getBoolean("useOutputBeanValidation")) {
|
||||
SwaggerUtils.validate(obj);
|
||||
OpenAPIUtils.validate(obj);
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
@@ -159,7 +159,7 @@ public class UserApiController extends Controller {
|
||||
if (nodeuser != null) {
|
||||
user = mapper.readValue(nodeuser.toString(), User.class);
|
||||
if (configuration.getBoolean("useInputBeanValidation")) {
|
||||
SwaggerUtils.validate(user);
|
||||
OpenAPIUtils.validate(user);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("'User' parameter is required");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package swagger;
|
||||
package openapitools;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import play.mvc.Action;
|
||||
@@ -8,7 +8,7 @@ import play.mvc.Result;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
|
||||
public class ApiCall extends Action<SwaggerUtils.ApiAction> {
|
||||
public class ApiCall extends Action<OpenAPIUtils.ApiAction> {
|
||||
|
||||
@Inject
|
||||
private ApiCall() {}
|
||||
@@ -1,4 +1,4 @@
|
||||
package swagger;
|
||||
package openapitools;
|
||||
|
||||
|
||||
import play.*;
|
||||
@@ -1,4 +1,4 @@
|
||||
package swagger;
|
||||
package openapitools;
|
||||
|
||||
import play.mvc.With;
|
||||
|
||||
@@ -14,7 +14,7 @@ import javax.validation.Validation;
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.ValidatorFactory;
|
||||
|
||||
public class SwaggerUtils {
|
||||
public class OpenAPIUtils {
|
||||
|
||||
@With(ApiCall.class)
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
play.filters.headers.contentSecurityPolicy=null
|
||||
|
||||
# When using bean validation with the swagger api, the validator will check that every constraint is respected
|
||||
# When using bean validation with the OpenAPI API, the validator will check that every constraint is respected
|
||||
# This is very useful when testing but could add a lot of overhead if you return a lot of data. Benchmark have
|
||||
# shown that the time it takes to validate is exponential.
|
||||
# If this is a concern in your application, or if you don't want to validate the output coming from your API for
|
||||
@@ -26,7 +26,7 @@ play.filters.headers.contentSecurityPolicy=null
|
||||
useInputBeanValidation=true
|
||||
useOutputBeanValidation=true
|
||||
|
||||
play.http.errorHandler="swagger.ErrorHandler"
|
||||
play.http.errorHandler="openapitools.ErrorHandler"
|
||||
|
||||
## Akka
|
||||
# https://www.playframework.com/documentation/latest/ScalaAkka#Configuration
|
||||
|
||||
@@ -1017,7 +1017,12 @@
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"description" : "Describes the result of uploading an image resource"
|
||||
"description" : "Describes the result of uploading an image resource",
|
||||
"example" : {
|
||||
"code" : 0,
|
||||
"type" : "type",
|
||||
"message" : "message"
|
||||
}
|
||||
}
|
||||
},
|
||||
"securitySchemes" : {
|
||||
Reference in New Issue
Block a user