[Spring] put spring-mvc and spring-boot under the same language gen#3133
[Spring] put spring-mvc and spring-boot under the same language gen#3133wing328 merged 4 commits intoswagger-api:masterfrom
Conversation
|
@diyfr this is a pretty big one, can you help reviewing ? |
|
I try to watch it this week @cbornet |
|
My apologies if this is not the right place to ask, but I’m interested to know if there’s any timeframe when swagger-codegen 2.2.0 might be released? The most recent version I can find is 2.1.6, but this does not have the “springboot” language support. Thanks, -PiersPiers Bowness – piers.bowness@rsa.com From: Stéphane [mailto:notifications@github.com] I try to watch it this week @cbornethttps://github.com/cbornet — |
|
@pbowness usually it takes 3 to 4 months for a minor release and I would foresee 2.2.0 would take a bit more time. Please pull the latest master to use spring boot generator. |
|
I see you've solved the problem by moving the requestMapping on methods rather than on the class. Would not it interesting move implementations in a sub-package "impl" . I'm still on my problematic regeneration .. |
|
Jersey gen does it by putting the interfaces in /src/gen/java and the impl in /src/main/java. |
|
And it also doesn't override the impl if it already exists. |
|
Can you upgrade dependencies Version ? (1.3.5.RELEASE for springboot Parent , and for spiringfox is (i think) 2.5.0) |
|
Done. I also upgraded to latest model with better enums, fluent setters, ... |
|
I have enums for query parameters. Current codegen doesn't seem to translate them to Java Enums. I think the same goes for path parameters. Tried to change datatype to datatypeWithEnum in pathParams.mustache and queryParams.mustache to no luck. Can't seem to figure out what's wrong. This could go in a separate issue, but since this PR includes better enums, if you know how to solve this. |
Upgrade NoteStarting from 2.2.0, To generate Spring MVC server stub, please supply |
|
@thebignet see #1347 #2282 |
|
I've added #3198 for these issues |
|
@cbornet |
|
@diyfr Detecting a Paged resource would indeed be nice. Do you know if springfox can also detect them ? |
|
This could also be done easily with a "x-paged" vendor-extension |
|
Yes same idea x-java-pageable ? |
|
@wing328 it's very difficult to find this page [https://github.com/swagger-api/swagger-codegen/wiki/Vendor-Extensions] |
|
@diyfr pagination is more linked to spring than to java. |
|
If you're working with pagination, it would also be useful to add a rfc5988 "Link" header and provide a utility class to generate "next" and "previous" links. See for instance https://github.com/jhipster/generator-jhipster/blob/master/generators/server/templates/src/main/java/package/web/rest/util/_PaginationUtil.java |
|
@cbornet Il see this issue (https://github.com/springfox/springfox/issues/755 and today ParameterBuilderPlugin is not merged. A "Link" it's a HATEOS format ? |
|
ParameterBuilderPlugin is not merged but we can generate it. |
|
And I think with @ApiImplicitParams we can generate the same swagger spec. What bothers you ? |
|
You shouldn't return |
|
That way it's the same body format as if the result was not paged |
@diyfr you want to put it in the README.md instead? Personally I prefer not making README.md too long and that's why I've moved some of the documentations to the wiki. |
|
@wing328 And i don't know why github search engine doesn't get an result to [https://github.com/swagger-api/swagger-codegen/wiki/Vendor-Extensions](Wiki Vendor Extension) |
|
@cbornet work in progress... |
|
This feels very awkward... |
|
What makes you need to declare a datasource ? Spring-boot autoconfig ? There may be some configuration to do to disable it. |
|
I just tried public ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags, Pageable pageable) {
ArrayList<Pet> petList = new ArrayList<Pet>();
Page<Pet> page = new PageImpl(petList, pageable, 0);
// do some magic!
return new ResponseEntity<List<Pet>>(page.getContent(), HttpStatus.OK);
}in spring-boot after including spring-data-commons and didn't have any issue. |
|
I have opened another issue to track the discussion on this feature |
This PR does the following: