Skip to content

[BUG] Description #8320

@tkalmar

Description

@tkalmar

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • 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

After generating a native client with the maven plugin, our project no longer compiles with version 5.0.0
The culprit are the

import javax.ws.rs.core.GenericType;
import javax.ws.rs.ext.ContextResolver;

statements in the new JSON.java. The cause of this is AFAICT: #7263
which introduces the dependencies to the jersey classes in the templates.

AbstractOpenApiSchema also has an import:

import javax.ws.rs.core.GenericType;

The generated client is no longer native but depends on jakarta.ws.rs, the new Dependency is nowhere documented

openapi-generator version

5.0.0 java (library:native) - works in 4.X so this is a regression

OpenAPI declaration file content or url

Any file should do, here is a minimal example

{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "api"
  },
  "host": "example.org",
  "basePath": "/api",
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/ping": {
      "get": {
        "description": "ping",
        "operationId": "ping",
        "responses": {
          "200": {
            "description": "ping successful"
          }
        }
      }
    }
  }
}
Generation Details

java - library: native

Steps to reproduce

generate the api and try to compile it. (In our case a project which does not depend on jakarta.ws.rs)

Related issues/PRs
Suggest a fix

Remove the jakarta.ws.rsdependencies from the templates if no anyOf, allOf is used
JSON.java and AbstractOpenApiSchema.java are not needed in this case. The unuses import in all model classes to JSON.java can also be left out

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