OpenAPITools / OpenAPITools/openapi-generator

[BUG] CodegenConfigurator crashing when allOf overridden

Open
#2,811 4 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

When trying to override a basic type alias with a default I get a stacktrace failure and com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting ('true', 'false' or 'null') and SwaggerCompatConverter - failed to read resource listing.

The guilty part of the spec looks something like (obviously simplified):

SomeThing:
  properties:
    duration:
      description: "The duration of SomeThing"
      default: 0
      allOf:
        - $ref: 'Duration'
Duration:
  type: integer
  description: Duration in seconds

Alternative forms fail the same way:

SomeThing:
  properties:
    duration:
      allOf:
        - $ref: 'Duration'
        - description: "The duration of SomeThing"
          default: 0
 
Duration:
  type: integer
  description: Duration in seconds
openapi-generator version

master, I think its a regression as I was using an older version of master /wo the issue

Command line used for generation

Occurs when I just validate. Also when generating rust /w reqwest but the bug hits way before any codegen happens

Steps to reproduce

Validate a spec that sets a default for an inherited schema object. Deleting the default allows it to validate.

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 CodegenConfigurator validation path and the SwaggerCompatConverter failure described in the report. Reproduce it with the minimal YAML containing Duration, allOf, and default, then compare validation with and without the default; done means the spec validates without the Jackson parse failure.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.