Skip to content

[REQ] New Jakarta+Eclipse JAX-RS templates #6881

Closed

Description

@bmarwell

Is your feature request related to a problem? Please describe.

This feature requests is intended to get another, completely different implementation of the current jax-rs one.
The current implementation depends on io.swagger imports, as well as jackson as Json provider.

However, with microprofile, new vendor-agnostic APIs have arrived.

Describe the solution you'd like

The new implementation is implementation- and vendor-agnostic.
It is "just" a new set of templates which can easily be derived from the existing ones.

  • org.eclipse.microprofile.openapi.annotations instead of io.swagger.
  • javax.json instead of com.fasterxml.jackson.

Benefits:
Most applicaiton servers, like OpenLiberty, already ship those MicroProfile standards.
When not using this generator, we could ship our applications without jackson and/or swagger dependencies.

The new dependencies are:

    <dependency>
      <groupId>jakarta.validation</groupId>
      <artifactId>jakarta.validation-api</artifactId>
      <version>2.0.2</version>
      <scope>provided</scope>
    </dependency>
    <!-- JSON-B API -->
    <dependency>
      <groupId>jakarta.json.bind</groupId>
      <artifactId>jakarta.json.bind-api</artifactId>
      <version>1.0.2</version>
      <scope>provided</scope>
    </dependency>
    <!-- JSON API -->
    <dependency>
      <groupId>jakarta.json</groupId>
      <artifactId>jakarta.json-api</artifactId>
      <version>1.1.6</version>
      <scope>provided</scope>
    </dependency>
    <!-- OpenAPI -->
    <dependency>
      <groupId>org.eclipse.microprofile.openapi</groupId>
      <artifactId>microprofile-openapi-api</artifactId>
      <version>1.1.2</version>
      <scope>provided</scope>
    </dependency>

Optional:
Instead of javax, prefer the new jakarta namespace:

    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
      <version>2.1.6</version>
      <scope>provided</scope>
    </dependency>

Describe alternatives you've considered

Using the current "jax-rs" implementation which is in fact "non-jakarta jax-rs plus Jackson plus swagger".
Bloats the war file due to shipping jackson and swagger

Additional context

Activity

  1. bmarwell commented on Jul 7, 2020

    @bmarwell
    Author

    Example for a value class using jsonb and OpenAPI annotations:

    package impl;
    
    import org.eclipse.microprofile.openapi.annotations.media.Schema;
    
    import javax.json.bind.annotation.JsonbProperty;
    
    @Schema(
        name = "TaskStatus",
        description = "Current status of the requested task."
    )
    public class JobStatus {
      @JsonbProperty("current_step")
      @Schema(required = true, name = "current_step", example = "received")
      private final String currentStep;
    
      // constructor
    
      // getter
    
      // toString method
    }
  2. yeekangc commented on Jul 7, 2020

    @yeekangc
  3. asterisk360-admin commented on Nov 25, 2020

    @asterisk360-admin

    there is any update of this enhancement?

  4. bmarwell commented on Nov 25, 2020

    @bmarwell
    Author

    I would still like to see this as well. Currently I am recreating my classes by hand

  5. bmarwell commented on Dec 1, 2020

    @bmarwell
    Author

    @yeekangc @turkeylurkey can you ping someone to look at this?

  6. yeekangc commented on Dec 1, 2020

    @yeekangc

    Taking a look, @bmarwell. Will see what can be done. Thanks.

  7. asterisk360-admin commented on Dec 1, 2020

    @asterisk360-admin

    @bmarwell @yeekangc @turkeylurkey.
    It would be great to generate the client using the microprofile-rest-client api.

  8. Emily-Jiang commented on Dec 8, 2021

    @Emily-Jiang

    Any progress made on this one @yeekangc @turkeylurkey ?

  9. joschi commented on Dec 18, 2021

    @joschi
    Contributor

    Given the combined expertise of the people commenting in this issue, maybe one of you would like to contribute a generator: https://openapi-generator.tech/docs/new-generator

  10. bmarwell commented on Dec 19, 2021

    @bmarwell
    Author

    it is even easier. You don't need a new generator, just a modified copy of some templates!

    See: https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/JavaJaxRS

  11. igbluz commented on Mar 1, 2022

    @igbluz

    Hi @bmarwell, @yeekangc @turkeylurkey I am also interested in using openapi-generator within the new OL 22.0.0.x Version with Microprofile 5. Actually there is missing the jakarta imports. Is there somebody doing some effort in adapting the templates? Shouldn't the community provide some templates compatible with JakartaEE? I am not an expert on openapi-generator enhancing, we just use it, but I'm willing to contribute. How can we assure that the right solution will be done?

  12. Krabbee commented on Apr 26, 2022

    @Krabbee

    Hi, is there any updates on Jakarta upgrade?

  13. sans17 commented on Sep 13, 2022

    @sans17
    Contributor

    I see another issue open:
    #13124

  14. rignicat commented on Oct 17, 2025

    @rignicat
    Contributor

    I created a PR that (mostly) implements this - at least good enough for my use case. Feel free to comment or expand this initial PR #22169

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions