OpenAPITools / OpenAPITools/openapi-generator

[BUG][JAXRS-spec] useOneOfInterfaces option causes compilation error

Open
#17,419 11 comments 16 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

Description

When using the useOneOfInterfaces option, the generated code does not compile.

Children classes are OK, but the generated parent is a class instead of an interface.

openapi-generator version

I've reproduces the issue with openapi-generator-maven-plugin :
7.0.1, 7.1.0
6.6.0

The option does not seem supported on previous releases.

OpenAPI declaration file content or url

OpenAPI spec :

https://gist.github.com/jerui1/da605832f67667e32a96f5c4d346640e

Sample maven project to reproduce :

openapigen-oneofbug.zip

Generation Details

mvn clean install

(I've tried using Java 17 or Java 21)

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 linked OpenAPI declaration and the openapigen-oneofbug.zip sample project, then run mvn clean install with the JAXRS-spec useOneOfInterfaces option. Inspect the generated parent and child classes; done means the generated parent is an interface where expected and the Maven project compiles successfully on the reported Java versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.