OpenAPITools / OpenAPITools/openapi-generator

[BUG] Invalid warning about inline schema usage in allOf

Open
#7,319 18 comments 3 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

Generator is logging More than one inline schema specified in allOf:. Only the first one is recognized. All others are ignored. warning, when generating Java, C# or TypeScript code from schema that is using allOf without discriminator and with more than 2 referenced schemas.

openapi-generator version

4.3.x, 5.0.0

OpenAPI declaration file content or url

Example file allOf_composition.yaml can be used to repeat this problem (schema SuperMan).
We have a use case that has 3 refs (and no inline schemas at all), which leads to the same warning.

Generation Details
    java \
        -jar openapi-generator-cli-5.0.0-beta.jar \
            generate \
            --input-spec $input_file \
            --generator-name typescript-axios \
            --output $output_folder
Steps to reproduce
  1. run generator
  2. check logs
Related issues/PRs

There are issues, which are discussing invalid inheritance/composition support and it seems that all of them are fixed now.
In our case generated code is correct (Java/C#/TypeScript) and all fields are there; it's a warning that is wrong.

Suggest a fix

Remove obsolete warning?

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

Use modules/openapi-generator/src/test/resources/3_0/allOf_composition.yaml, especially the SuperMan schema, as the reproduction input and run the shown Java CLI command with typescript-axios. Trace the warning for an allOf containing multiple referenced schemas, then confirm generation still preserves all fields without reporting an invalid inline-schema warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.