Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jaxrs-Resteasy] Improvements for Jaxrs-Resteasy #4512

Open
10 tasks done
jfiala opened this issue Jan 6, 2017 · 12 comments
Open
10 tasks done

[Jaxrs-Resteasy] Improvements for Jaxrs-Resteasy #4512

jfiala opened this issue Jan 6, 2017 · 12 comments

Comments

@jfiala
Copy link
Contributor

jfiala commented Jan 6, 2017

Description

The generated code stubs are way to complicated, in fact only the following files are needed for Resteasy (verified with Jboss EAP 7):

  • Api-Interface (with all JaxRS-annotations)
  • Implementation class implementing the interface
  • Class to activate Jax-RS: @ApplicationPath / extends RestApplication
Additional Fixes
  • the api is generated as class, but IMHO this should be an interface!?
  • @ApiResponse are missing

this has already been fixed in the master branch

this has already been fixed in #4447

The current state of #4712 allows to generate a simple structure with interfaces holding all JaxRS-annotations and a simple implementation class. Registration for JaxRS is done by extending Jaxrs Application. It has been verified to work for Jboss EAP 6 + 7 as no resteasy-specific libraries are included ( resteasy-jackson2-provider is now provided as opposed to jaxrs-resteasy).

Datetime-Support
  • joda datetime support (using configuration of Jackson ObjectMapper)
  • java8 datetime support (using configuration of Jackson ObjectMapper)

This language supports Java8 and Joda datetime using the JacksonConfig, the needed dependencies included automatically (see pom.mustache).

I added the flag "joda" to AbstractJavaCodegen.java to allow checking for joda in the mustache templates.

Further Enhancements
  • javax.ws.rs.core.Response is used instead of the real response data type

should better be changed separately see #4713

  • optional: activate Swagger contract generator (ApiListingResource / SwaggerSerializers)
Questions
Swagger-codegen version

2.2.2-SNAPSHOT

Related issues

#4447 regarding the Swagger annotations
#4461 regarding WAR-file
#4123 for enums
#3446 for tag support

Suggest a Fix

If you like, I can provide a new simplified Resteasy language.
Using the dynamic Swagger contract generator it provides true turnaround development...

@mbucc
Copy link

mbucc commented Jan 21, 2017

@jfiala What do you think about putting the EAP version in the language name? For example, renaming jaxrs-resteasy to jaxrs-reasteasy-eap7? RestEasy 3 (and other libs in pom) are not included in EAP6, so jaxrs-resteasy did not build for me out of the box.

@jfiala
Copy link
Contributor Author

jfiala commented Jan 21, 2017

@mbucc I think this would be a good starting point, as I worked only with EAP 7 here, this way we can also target for 2.2.2.
Later if we can warrant backwards compatibility somehow for EAP 6 we can then replace jaxrs-resteasy (for 2.3).

I'd add a new language jaxrs-resteasy-eap7 and wouldn't change the existing jaxrs-resteasy in the first place.

@wing328 what do you think?

@mbucc
Copy link

mbucc commented Jan 21, 2017

@jfiala FWIW, you can rename existing jaxrs-resteasy if you like. It will not work with eap6.

@jfiala
Copy link
Contributor Author

jfiala commented Jan 22, 2017

@mbucc for which Resteasy/Jboss version was the current implementation supposed for?
I'd like to greatly simplify the generated files as there are only interfaces/models and one initialization class needed to work with Jboss EAP 7.

@mbucc
Copy link

mbucc commented Jan 22, 2017

@jfiala here is my understanding: existing jaxrs-resteasy codegen only works for EAP 7.

Note that the servlet api version could be upgraded as well; 2.5 was last used in EAP 5: (https://access.redhat.com/articles/113373)

I can contribute files for eap 6, assuming I can get past the ApiResponse issue I opened in #4617.

@mbucc
Copy link

mbucc commented Jan 22, 2017

@jfiala I just realized something. Resteasy is a stand alone library, so I suspect the author built this codegen for that scenario.

At work, I use JBoss container, which provides RestEasy, so I was only thinking about this codegen in context of JBoss. But there are other containers where the war artifact built here will work just fine.

Sorry for the diversion!

(Seems like I should simply create a jboss6-resteasy codegen based on this one. Sound reasonable to you?)

@jfiala
Copy link
Contributor Author

jfiala commented Jan 23, 2017

@mbucc OK, thx for the clarification. I'd like to provide the first draft with name resteasy-jboss and I'll test it for both jboss 6 and 7 eap (better put language first, then target jee server). In the next step/release 2.3, we could replace the existing resteasy language.
It would be great if you can give it a test run, we can then also check how to fix your issue #4617.

@wing328 wing328 added this to the v2.2.2 milestone Jan 25, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
@jfiala
Copy link
Contributor Author

jfiala commented Feb 4, 2017

@mbucc I added a first re-implementation of Jaxrs Resteasy in PR #4712, please take a look when you have time.

I added all resteasy dependencies (also resteasy-jackson2-provider) as provided, so it doesn't depend on a specific resteasy version. I verified it to deploy on Jboss EAP 6 + 7 without errors.

jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
@jfiala
Copy link
Contributor Author

jfiala commented Feb 4, 2017

I also added the option to generate the Swagger contract dynamically.

jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 4, 2017
@jfiala
Copy link
Contributor Author

jfiala commented Feb 4, 2017

@mbucc @wing328 Jaxrs Resteasy for EAP 6 + 7 is now fully implemented and tested with Joda + Java8 datetime support. Pls take a look when you have time, see PR #4517 .

@wing328
Copy link
Contributor

wing328 commented Feb 6, 2017

@mbucc may I know if you've time to run some tests for this change? Here are the steps:

git checkout -b jfiala-jaxrs_resteasy-eap_4512 master
git pull https://github.com/jfiala/swagger-codegen.git jaxrs_resteasy-eap_4512

@mbucc
Copy link

mbucc commented Feb 6, 2017

@wing328 @jfiala Would be happy to. Give me a week or two.

BTW, is there a docker container for JBoss 7 you like to test with?

jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 8, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 8, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 8, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 8, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 8, 2017
@wing328 wing328 removed this from the v2.2.2 milestone Feb 22, 2017
@wing328 wing328 modified the milestones: v2.2.3, v2.2.2 Feb 22, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 28, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 28, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 28, 2017
jfiala added a commit to jfiala/swagger-codegen that referenced this issue Feb 28, 2017
wing328 pushed a commit that referenced this issue Feb 28, 2017
* add language for resteasy eap #4512

* first implementation of jaxrs-resteasy-eap #4512

* add support for joda and java8 datetime types #4512

* add new file JacksonConfig and new sample eap-joda #4512

* add dynamic swagger support to jaxrs-resteasy-eap #4512

* adapt readme for eap #4512

* add tests for jaxrs-resteasy-eap #4512

* cleanup tabs #4512

* cleanup tabs #4512

* cleanup tabs #4512

* cleanup tabs / regenerate without joda #4512

* regenerate with updated templates #4512

* fix test (wrong setter invoked) #4512

* fix test #4512

* fix no invocation #4512

* replace tabs with spaces #4512
davidgri pushed a commit to davidgri/swagger-codegen that referenced this issue May 11, 2017
…-api#4712)

* add language for resteasy eap swagger-api#4512

* first implementation of jaxrs-resteasy-eap swagger-api#4512

* add support for joda and java8 datetime types swagger-api#4512

* add new file JacksonConfig and new sample eap-joda swagger-api#4512

* add dynamic swagger support to jaxrs-resteasy-eap swagger-api#4512

* adapt readme for eap swagger-api#4512

* add tests for jaxrs-resteasy-eap swagger-api#4512

* cleanup tabs swagger-api#4512

* cleanup tabs swagger-api#4512

* cleanup tabs swagger-api#4512

* cleanup tabs / regenerate without joda swagger-api#4512

* regenerate with updated templates swagger-api#4512

* fix test (wrong setter invoked) swagger-api#4512

* fix test swagger-api#4512

* fix no invocation swagger-api#4512

* replace tabs with spaces swagger-api#4512
@wing328 wing328 modified the milestones: v2.2.3, v2.3.0 Jul 16, 2017
@wing328 wing328 modified the milestones: Future, v2.3.0 Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants