OpenAPITools / OpenAPITools/openapi-generator

[BUG] documented library configOption is not available.

Open
#6,189 2 comments 1 reaction 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?
    3.3.4
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
    Actual: Jackson annotations.
    Expected: Jsonp / Jsonb / Liberty
  • [Optional] Bounty to sponsor the fix
Description

The documentation at https://openapi-generator.tech/docs/generators/jaxrs-spec describes the configOption "library". However, it does not work:

java.lang.RuntimeException: Unknown library: openliberty
Available libraries:
  NONE
openapi-generator version

3.3.4

OpenAPI declaration file content or url

The other way round… I am Posting the maven part instead.

      <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <inputSpec>${project.basedir}/src/main/resources/pipeline.yaml</inputSpec>
              <generatorName>jaxrs-spec</generatorName>
              <configOptions>
                <sourceFolder>src/main/java</sourceFolder>
                <interfaceOnly>true</interfaceOnly>
                <useSwaggerAnnotations>false</useSwaggerAnnotations>
                <library>openliberty</library>
                <java8>true</java8>
                <dateLibrary>java8</dateLibrary>
              </configOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>
Command line used for generation

mvn clean verify

Steps to reproduce

mvn clean verify

With above configuration, it is 100% reproducible

Related issues/PRs

none found

Suggest a fix
  1. make sure the library option works

  2. document what library=openliberty actually does (I do not know of a OpenLiberty specific API)

  3. Implement jsonp or jsonb instead (<library>jsonb</library>). The current default is Jackson, which is not even an API and forces the application to ship Jackson :(
    More information: https://javaee.github.io/jsonb-spec/

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 the jaxrs-spec generator documentation and the Maven plugin configuration shown in the report, then run mvn clean verify with library=openliberty to confirm the failure. Compare the documented library values with the generator's accepted options; done means the configured library is recognized and its behavior is documented, or the unsupported option is removed from the documentation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.