Skip to content

[BUG] Jaxrs-Jersey produces server that doesn't compile + doesn't handle parent tag in pom.xml correctly #8890

@robbieheywood

Description

@robbieheywood
Description

I've been testing out openapi-generator but have come up against a few issues, which I've repro'd using the petstore example found at https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml. I've been trying out server generation by running openapi-generator generate -i petstore.yaml -g jaxrs-jersey -o server, but have encountered the following issues:

  1. After generation, when I run mvn clean package jetty:run as instructed by the generated README, I get the following compilation error:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] ~/repos/OpenAPI-Specification/examples/v3.0/server/src/gen/java/org/openapitools/api/ApiResponseMessage.java:[3,33] package javax.xml.bind.annotation does not exist
[ERROR] ~/repos/OpenAPI-Specification/examples/v3.0/server/src/gen/java/org/openapitools/api/ApiResponseMessage.java:[5,27] package javax.xml.bind.annotation does not exist
[ERROR] ~/repos/OpenAPI-Specification/examples/v3.0/server/src/gen/java/org/openapitools/api/ApiResponseMessage.java:[45,6] cannot find symbol
  symbol:   class XmlTransient
  location: class org.openapitools.api.ApiResponseMessage
  1. If I run the generation step with openapi-generator generate -i petstore.yaml -g jaxrs-jersey -o server --additional-properties=parentArtifactId=parent-artifact,parentGroupId=parent-group,parentVersion=1.0-SNAPSHOT, then I don't see any parent tag in the generated pom.xml (as expected after reading the docs at https://openapi-generator.tech/docs/generators/jaxrs-jersey/). This is also true with the jaxrs-resteasy generator (where, again, the docs at https://openapi-generator.tech/docs/generators/jaxrs-resteasy/ say it's an available option).
openapi-generator version
> openapi-generator version
5.0.1
OpenAPI declaration file content or url

Repro'd with the petstore example:
https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml

Generation Details

openapi-generator generate -i petstore.yaml -g jaxrs-jersey -o server & openapi-generator generate -i petstore.yaml -g jaxrs-jersey -o server --additional-properties=parentArtifactId=parent-artifact,parentGroupId=parent-group,parentVersion=1.0-SNAPSHOT

Steps to reproduce

Run the above generation commands from inside https://github.com/OAI/OpenAPI-Specification/tree/master/examples/v3.0.

Related issues/PRs

n/a

Suggest a fix

Unsure

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