Feature/success code responses
PR checklist
- [x] Read the contribution guidelines.
- [x] 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.shand./bin/security/{LANG}-petstore.shif 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.0branch for changes related to OpenAPI spec 3.0. Default:master. - [x] Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
@bbdouglas @JFCote @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger
Description of the PR
- Add attribute to CodegenOperations to obtain the response code
- Add response code to Java Play Framework Controller template
#7583 @JFCote
How is it going? @wing328 :sweat_smile:
@ignaciomolina let me review tomorrow. Sorry for the delay.
@ignaciomolina the change breaks the Pistache generator:
[main] INFO io.swagger.parser.Swagger20Parser - reading from modules/swagger-codegen/src/test/resources/2_0/petstore.yaml
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/ApiResponse.h
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/ApiResponse.cpp
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Category.h
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Category.cpp
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Order.h
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Order.cpp
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Pet.h
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Pet.cpp
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Tag.h
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/Tag.cpp
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/User.h
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /root/src/github.com/swagger-api/swagger-codegen/samples/server/petstore/pistache-server/model/User.cpp
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
Tag: Tag {
name: user
description: Operations about user
externalDocs: io.swagger.models.ExternalDocs@e1e57bab
extensions:{}}
Operation: createUser
Resource: post /user
Definitions: {Order=io.swagger.models.ModelImpl@6b904c51, Category=io.swagger.models.ModelImpl@ba13e696, User=io.swagger.models.ModelImpl@9db581f0, Tag=io.swagger.models.ModelImpl@d651f3db, Pet=io.swagger.models.ModelImpl@c9d5d174, ApiResponse=io.swagger.models.ModelImpl@16a9e5a9}
Exception: For input string: "default"
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:935)
at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:814)
at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:434)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:749)
at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.NumberFormatException: For input string: "default"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at io.swagger.codegen.languages.PistacheServerCodegen.fromOperation(PistacheServerCodegen.java:166)
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:884)
... 5 more
For the full log, please click on the link to the Shippable CI job.
I was able to repeat the issue locally by running ./bin/pistache-server-petstore.sh.
Shippable doesn't show me the logs, it says that I have to download it but I don't see any download button
@ignaciomolina can you try https://app.shippable.com/download/jobConsoles?jobId=5a965e1b9e550508008cef87? You will need to register an account at shippable and log in to obtain a valid token.
@wing328 solved!
Thanks. I will review tonight.
cc the following technical committees as the change affects multiple generators:
- Ada: @stcarrez @micheleISEP
- Apex: @asnelling
- C++: @ravinikam @stkrwork @fvarose
- Pistache: @sebymiano
If no further question/feedback, I"ll merge this PR on coming Friday.
@wing328 , it would be great if we could merge this PR :)
@ignaciomolina there is a merge conflict.