forked from loafle/openapi-generator-original
Fix package declaration for play-framework (#332)
This commit is contained in:
@@ -14,13 +14,13 @@ 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 javax.validation.constraints.*;
|
||||
import play.Configuration;
|
||||
|
||||
import swagger.SwaggerUtils.ApiAction;
|
||||
import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
|
||||
public class PetApiController extends Controller {
|
||||
@@ -42,7 +42,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");
|
||||
@@ -68,7 +68,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()) {
|
||||
@@ -85,7 +85,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()) {
|
||||
@@ -108,7 +108,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");
|
||||
|
||||
@@ -13,13 +13,13 @@ 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 javax.validation.constraints.*;
|
||||
import play.Configuration;
|
||||
|
||||
import swagger.SwaggerUtils.ApiAction;
|
||||
import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
|
||||
public class StoreApiController extends Controller {
|
||||
@@ -56,7 +56,7 @@ 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");
|
||||
|
||||
@@ -13,13 +13,13 @@ 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 javax.validation.constraints.*;
|
||||
import play.Configuration;
|
||||
|
||||
import swagger.SwaggerUtils.ApiAction;
|
||||
import openapitools.OpenAPIUtils.ApiAction;
|
||||
|
||||
|
||||
public class UserApiController extends Controller {
|
||||
@@ -41,7 +41,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");
|
||||
@@ -57,7 +57,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 {
|
||||
@@ -74,7 +74,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 {
|
||||
@@ -124,7 +124,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