OpenAPITools / OpenAPITools/openapi-generator

Generated code includes deprecated @Api(description=...) in generated JAX-RS code

Open
#21,964 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)

Description

When generating JAX-RS server stubs using the jaxrs-spec generator, the generated Java code uses the Swagger 1.x annotation @Api(description = "...") from io.swagger.annotations. The description() method in this annotation is deprecated, resulting in numerous deprecation warnings (e.g., [deprecation] description() in Api has been deprecated) during compilation. This creates significant noise in the build output and makes it harder to spot real issues.

Expected output:
The generated code should use non-deprecated annotations, ideally migrating to Swagger Core v3 (io.swagger.v3.oas.annotations) or omitting the deprecated description attribute.

Actual output:
All generated API classes contain @Api(description = "..."), triggering deprecation warnings in modern Java builds.

This issue persists with OpenAPI Generator version 7.15.0 (latest as of September 2025).

  • The OpenAPI spec is valid and passes standard OpenAPI validation.
  • The issue is present with both minimal and full OpenAPI 3.0/3.1 specs.
  • No open issues were found in the issue tracker for this specific problem.

Generation Details

Generator: jaxrs-spec
Command:
openapi-generator-cli generate -g jaxrs-spec -i example.yaml -o out

No custom config/options required to reproduce.


Steps to reproduce
  1. Use the above minimal OpenAPI spec.
  2. Run the generator with the jaxrs-spec generator.
  3. Inspect the generated API classes for @Api(description = "...").
  4. Compile the generated code and observe deprecation warnings.

Related issues/PRs

No related issues found after searching the issue tracker.


Suggest a fix

Update the JAX-RS generators to use non-deprecated annotations, ideally migrating to Swagger Core v3 (io.swagger.v3.oas.annotations) or omitting the deprecated description attribute in @Api.


openapi-generator version

7.15.0

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: Example API
  version: 1.0.0
paths:
  /users:
    get:
      summary: Get users
      responses:
        '200':
          description: OK

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 by running the documented jaxrs-spec generation command with the provided minimal OpenAPI specification, then inspect the generated API classes for the deprecated annotation. Trace the jaxrs-spec generator templates or entry points that produce @Api(description = "..."). Done means generated JAX-RS code no longer emits the deprecated description usage and compiles without those deprecation warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.