forked from loafle/openapi-generator-original
[Java Play Framework] Warnings removal and default value fix (#5660)
* First commit of the Java Play Framework server generator. It is highly based on Spring so there might me a couple of things that don't make sense (like options or parameters) for the Play Framework. * Fix suggestions in the PR discussion + add .bat and .sh file as requested. * Updated Readme.md file * Remove unused mustache file + fix baseName vs paramName in all the mustache files. * Fix the compilation error when we have a body which is a list or map. Doesn't fix the problem with the annotation itself. * Fix the problem with the Http.MultipartFormData.FilePart * Removal of warning (final) and fix of a missing default value for boolean query parameters
This commit is contained in:
parent
ad0838f0a0
commit
ef2028e53f
@ -27,8 +27,8 @@ import swagger.SwaggerUtils.ApiAction;
|
||||
{{#operations}}
|
||||
public class {{classname}}Controller extends Controller {
|
||||
|
||||
private {{classname}}ControllerImp imp;
|
||||
private ObjectMapper mapper;
|
||||
private final {{classname}}ControllerImp imp;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private {{classname}}Controller({{classname}}ControllerImp imp) {
|
||||
@ -42,8 +42,7 @@ public class {{classname}}Controller extends Controller {
|
||||
public Result {{operationId}}({{#pathParams}}{{>pathParams}}{{#hasMore}},{{/hasMore}}{{/pathParams}}) {{^handleExceptions}}{{#bodyParams}}throws IOException{{/bodyParams}}{{/handleExceptions}}{{#handleExceptions}}throws Exception{{/handleExceptions}} {
|
||||
{{#bodyParams}}
|
||||
{{#collectionFormat}}
|
||||
//TODO: Maybe implement this in the future if we can support collection in the body params: see bug in swagger-play: https://github.com/swagger-api/swagger-play/issues/130
|
||||
//TODO: Tt seems it is not detected that it's a list based on the collectionFormat field?
|
||||
//TODO: Support this later
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}
|
||||
JsonNode node{{paramName}} = request().body().asJson();
|
||||
@ -60,9 +59,7 @@ public class {{classname}}Controller extends Controller {
|
||||
{{/bodyParams}}
|
||||
{{#queryParams}}
|
||||
{{#collectionFormat}}
|
||||
//TODO: Maybe implement this in the future if we can support collection in the body params: see bug in swagger-play: https://github.com/swagger-api/swagger-play/issues/130
|
||||
//TODO: Tt seems it is not detected that it's a list based on the collectionFormat field?
|
||||
//WIP when both bugs will be fixed
|
||||
//TODO: Support this later
|
||||
//List<Pair> {{paramName}}Pair = SwaggerUtils.parameterToPairs("{{collectionFormat}}", "{{paramName}}", request().getQueryString("{{baseName}}"));
|
||||
{{{dataType}}} {{paramName}} = new Array{{{dataType}}}();
|
||||
//for (Pair pair : {{paramName}}Pair) {
|
||||
@ -92,9 +89,7 @@ public class {{classname}}Controller extends Controller {
|
||||
{{/notFile}}
|
||||
{{#notFile}}
|
||||
{{#collectionFormat}}
|
||||
//TODO: Maybe implement this in the future if we can support collection in the body params: see bug in swagger-play: https://github.com/swagger-api/swagger-play/issues/130
|
||||
//TODO: Tt seems it is not detected that it's a list based on the collectionFormat field?
|
||||
//WIP when both bugs will be fixed
|
||||
//TODO: Support this later
|
||||
//List<Pair> {{paramName}}Pair = SwaggerUtils.parameterToPairs("{{collectionFormat}}", "{{paramName}}", ((String[]) request().body().asMultipartFormData().asFormUrlEncoded().get("{{baseName}}"))[0]);
|
||||
{{{dataType}}} {{paramName}} = new Array{{{dataType}}}();
|
||||
//for (Pair pair : {{paramName}}Pair) {
|
||||
@ -117,9 +112,7 @@ public class {{classname}}Controller extends Controller {
|
||||
{{/formParams}}
|
||||
{{#headerParams}}
|
||||
{{#collectionFormat}}
|
||||
//TODO: Maybe implement this in the future if we can support collection in the body params: see bug in swagger-play: https://github.com/swagger-api/swagger-play/issues/130
|
||||
//TODO: Tt seems it is not detected that it's a list based on the collectionFormat field?
|
||||
//WIP when both bugs will be fixed
|
||||
//TODO: Support this later
|
||||
//List<Pair> {{paramName}}Pair = SwaggerUtils.parameterToPairs("{{collectionFormat}}", "{{paramName}}", request().getHeader("{{baseName}}"));
|
||||
//{{{dataType}}} {{paramName}} = new Array{{{dataType}}}();
|
||||
//for (Pair pair : {{paramName}}Pair) {
|
||||
|
@ -1 +1 @@
|
||||
{{#isInteger}}0{{/isInteger}}{{#isDouble}}0.0{{/isDouble}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0{{/isFloat}}{{#isString}}""{{/isString}}
|
||||
{{#isBoolean}}false{{/isBoolean}}{{#isInteger}}0{{/isInteger}}{{#isDouble}}0.0{{/isDouble}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0{{/isFloat}}{{#isString}}""{{/isString}}
|
@ -23,8 +23,8 @@ import swagger.SwaggerUtils.ApiAction;
|
||||
|
||||
public class PetApiController extends Controller {
|
||||
|
||||
private PetApiControllerImp imp;
|
||||
private ObjectMapper mapper;
|
||||
private final PetApiControllerImp imp;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private PetApiController(PetApiControllerImp imp) {
|
||||
@ -62,9 +62,7 @@ public class PetApiController extends Controller {
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
//TODO: Maybe implement this in the future if we can support collection in the body params: see bug in swagger-play: https://github.com/swagger-api/swagger-play/issues/130
|
||||
//TODO: Tt seems it is not detected that it's a list based on the collectionFormat field?
|
||||
//WIP when both bugs will be fixed
|
||||
//TODO: Support this later
|
||||
//List<Pair> statusPair = SwaggerUtils.parameterToPairs("csv", "status", request().getQueryString("status"));
|
||||
List<String> status = new ArrayList<String>();
|
||||
//for (Pair pair : statusPair) {
|
||||
@ -78,9 +76,7 @@ public class PetApiController extends Controller {
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
//TODO: Maybe implement this in the future if we can support collection in the body params: see bug in swagger-play: https://github.com/swagger-api/swagger-play/issues/130
|
||||
//TODO: Tt seems it is not detected that it's a list based on the collectionFormat field?
|
||||
//WIP when both bugs will be fixed
|
||||
//TODO: Support this later
|
||||
//List<Pair> tagsPair = SwaggerUtils.parameterToPairs("csv", "tags", request().getQueryString("tags"));
|
||||
List<String> tags = new ArrayList<String>();
|
||||
//for (Pair pair : tagsPair) {
|
||||
|
@ -22,8 +22,8 @@ import swagger.SwaggerUtils.ApiAction;
|
||||
|
||||
public class StoreApiController extends Controller {
|
||||
|
||||
private StoreApiControllerImp imp;
|
||||
private ObjectMapper mapper;
|
||||
private final StoreApiControllerImp imp;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private StoreApiController(StoreApiControllerImp imp) {
|
||||
|
@ -22,8 +22,8 @@ import swagger.SwaggerUtils.ApiAction;
|
||||
|
||||
public class UserApiController extends Controller {
|
||||
|
||||
private UserApiControllerImp imp;
|
||||
private ObjectMapper mapper;
|
||||
private final UserApiControllerImp imp;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private UserApiController(UserApiControllerImp imp) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user