swagger-api / swagger-api/swagger-codegen

[Jaxrs-Resteasy] Improvements for Jaxrs-Resteasy

Open
#4,512 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: General help wanted Server: Java
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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

  • @Api annotation is missing (see #4447)

this has already been fixed in #4447

  • create deployable WAR file (see #4461)

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...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AbstractJavaCodegen.java and pom.mustache, then review the current Jaxrs-Resteasy templates and the status of related issues #4447, #4461, and #4713. Verify which listed improvements remain after the changes attributed to master and #4712. Done means an agreed simplified Resteasy structure with the required JAX-RS annotations, application activation, datetime support, and dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.