OpenAPITools / OpenAPITools/openapi-generator

[BUG][jaxrs-spec] When using the "jackson" option to disable use of Jackson, some jackson annotations and imports are still generated

Open
#7,095 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 (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When using the jaxrs-spec server generator with the option "jackson" set to "false", I expect the generated code to not contain any imports or annotations referring to Jackson. Instead the code is generated with many Jackson annotations. This can be seen when using the test spec "modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml" as input, for example in generated class FormatTest.java.

It is also evident, when looking at the template files, that use Jackson unfenced:

In modules/openapi-generator/src/main/resources/JavaJaxRS/spec:

  • enumClass.mustache
  • enumOuterClass.mustache
  • pojo.mustache
  • pom.mustache

And in:

  • modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/openliberty/pom.mustache
openapi-generator version

Latest 5.0.0-SNAPSHOT

Suggest a fix

I will open a PR with the fix.

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 enumClass.mustache, enumOuterClass.mustache, pojo.mustache, pom.mustache, and libraries/openliberty/pom.mustache under modules/openapi-generator/src/main/resources/JavaJaxRS/spec. Use petstore-with-fake-endpoints-models-for-testing.yaml and inspect generated FormatTest.java with the jackson option disabled. Done means the generated code contains no Jackson imports or annotations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.