OpenAPITools / OpenAPITools/openapi-generator

[BUG][JAVA] Upgrading java-camel generator from version 7.8.0 to 7.9.0 breaks processing of oneOf / anyOf definitions

Open
#20,312 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

Description

We upgraded from version 7.8.0 to 7.9.0 and found that changes between these versions break the java-camel generator's processing of the oneOf/anyOf definitions.

For example, the following schema generates proper code with version 7.8.0, but the generator version 7.9.0 creates a class with no fields. We are using version 3.0.3 of the OpenAPI spec.

"Request": {
      "type": "object",
      "properties": {
        "referenceNumber": {"type": "string", "nullable": true},
        "documentNumber": { "type": "string", "nullable": true},
        "stockNumber": {"type": "string", "nullable": true}
      },
      "oneOf": [
        {
          "required" : [ "referenceNumber" ]
        },
        {
          "anyOf": [
            {
              "required": [ "documentNumber" ]
            },
            {
              "required": [ "stockNumber" ]
            }
          ]
        }
      ]
    }
openapi-generator version

version 7.9.0 of the java-camel generator

OpenAPI declaration file content or url

The full test project including the OpenAPI spec and the generators configuration can be found at
https://github.com/kulon/code-samples/tree/main/openapi-generator-sample

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-generator-sample project and reproduce its java-camel output using generator versions 7.8.0 and 7.9.0. Trace how the nested oneOf/anyOf schema is processed and compare the generated Request class; done means the 7.9.0 output preserves the expected fields.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.