OpenAPITools / OpenAPITools/openapi-generator
[BUG] CodegenConfigurator crashing when allOf overridden
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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