Skip to content

Conversation

@MZinchenko
Copy link
Contributor

@MZinchenko MZinchenko commented Nov 5, 2017

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming langauge.

Description of the PR

Issue #4680 fixed in proper way

@wing328
Copy link
Contributor

wing328 commented Nov 9, 2017

@MZinchenko thanks for the PR. Please run ./bin/spring-all-pestore.sh to update Spring Petstore samples so that CI can verify the change.

@MZinchenko
Copy link
Contributor Author

Sorry for long time reply.
I found mistake in my merge and fix it.

Also when I update java samples, my samples\server\petstore\spring-mvc\pom.xml always going wrong.
Artefact and module name changes to swagger-spring (must be swagger-spring-mvc-server).
Am I doing smth wrong?

@wing328
Copy link
Contributor

wing328 commented Nov 14, 2017

Artefact and module name changes to swagger-spring (must be swagger-spring-mvc-server).

I'll take a look...

@wing328
Copy link
Contributor

wing328 commented Nov 14, 2017

I'm doing some tests as well...

cc @cbornet

@wing328
Copy link
Contributor

wing328 commented Nov 14, 2017

Tests passed via https://circleci.com/gh/swagger-api/swagger-codegen/2594 (after updating Spring Petstore samples)

@cbornet
Copy link
Contributor

cbornet commented Nov 15, 2017

The samples of this PR are not OK so it's hard to review...

@MZinchenko
Copy link
Contributor Author

MZinchenko commented Nov 15, 2017 via email

@cbornet
Copy link
Contributor

cbornet commented Nov 15, 2017

There are @Generated annotations everywhere instead of being hidden, the examples have been removed from spring controllers, etc...

@MZinchenko
Copy link
Contributor Author

MZinchenko commented Nov 16, 2017 via email

@cbornet
Copy link
Contributor

cbornet commented Nov 16, 2017

The windows scripts are incorrect...

@MZinchenko
Copy link
Contributor Author

MZinchenko commented Nov 17, 2017 via email

method = RequestMethod.POST)
default CompletableFuture<ResponseEntity<Void>> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
default CompletableFuture<ResponseEntity<Void>> addPet(
@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment is wrong

method = RequestMethod.DELETE)
default CompletableFuture<ResponseEntity<Void>> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
default CompletableFuture<ResponseEntity<Void>> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId
,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comma should not be here

method = RequestMethod.GET)
default CompletableFuture<ResponseEntity<List<Pet>>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status) {
default CompletableFuture<ResponseEntity<List<Pet>>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be on this line

return new ApiInfoBuilder()
.title("Swagger Petstore")
.description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\")
.description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swagger spec used seems different than before. Still an issue with Windows script ?

method = RequestMethod.GET)
ResponseEntity<Order> getOrderById(@Min(1) @Max(5) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId);
ResponseEntity<Order> getOrderById(@Min(1) @Max(5) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("orderId") Long orderId
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be on this line

@MZinchenko
Copy link
Contributor Author

MZinchenko commented Nov 20, 2017 via email

@cbornet
Copy link
Contributor

cbornet commented Nov 20, 2017

Correct and most used scripts are Unix ones. I think the windows scripts have been added as a block without checking each particular languages so that's why there are differences.

@@ -1 +1 @@
{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @PathVariable("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isPathParam}}
{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambdaEscapeDoubleQuote}}{{{value}}}{{/lambdaEscapeDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @PathVariable("{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isPathParam}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is were the extra line has been added. Remove it and regenerate the samples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You means new line after {{/isPathParam}}?
I already done that and regenerate the samples, but new lines not removed.
Also I revert all changes in my branch and regenerate the samples, but new lines not removed.
As you can see, new lines appears in blocks generated by other templates, not pathParams.mustache only. First of all PetApi.java using bodyParams.mustache for addPet method, but I don't change bodyParams.mustache

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed this change and some windows scripts changes, but samples still have some differences

@MZinchenko
Copy link
Contributor Author

MZinchenko commented Nov 21, 2017

Ok. I done update samples under CentOS inside Docker.
New lines vanished, so that's some type of environment bug.
That's no good, some users may use codegen under Windows with default setting and they are suffering.

@wing328 wing328 merged commit a8642db into swagger-api:master Nov 27, 2017
@wing328 wing328 changed the title [Java][Spring][Server] Issue #4680 [Java][Spring][Server] fix spring-mvc path enum issue Nov 27, 2017
@wing328
Copy link
Contributor

wing328 commented Nov 27, 2017

@MZinchenko PR merged into master. Thanks for your contribution.

When you've time, I wonder if you can contact me via the email address on my Github profile. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants