OpenAPITools / OpenAPITools/openapi-generator

[BUG] allOf doesn't create a new class but a method

Open
#18,782 1 comment 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

Issue happens after migrating from version 5.0.0 to 7.X
open api generator version 7.0.1 (also tested in 7.6)

This yaml results in a model class called "UpdateContractID". There should be no class called like this, but only a new model class called "UpdateContractRequest" as defined in allOf.

patch:
      consumes:
        - application/json-patch+json
      operationId: UpdateContractID
      tags:
        - Deprecated
      parameters:
        - $ref: '#/parameters/LastUpdateUser'
        - name: patchDocument
          in: body
          required: true
          schema:
            allOf:
              - type: object
                properties:
                  patchDocument:
                    type: array
                    items:
                      $ref: '#/definitions/updateContractRequest'

Things I tried and did not help:
--inline-schema-options REFACTOR_ALLOF_INLINE_SCHEMAS=true
--openapi-normalizer REF_AS_PARENT_IN_ALLOF=true, REFACTOR_ALLOF_WITH_PROPERTIES_ONLY=true

@wing328 Would be great if you can assist. thanks

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 by reproducing the provided YAML with OpenAPI Generator 7.0.1 or 7.6 and trace the allOf inline-schema handling; no source files or tests are named in the issue. Done means the operation no longer produces a model class named UpdateContractID and generates only the intended UpdateContractRequest model.

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
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.