Repository navigation
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
A schema with two structural identical properties is generated differently with 7.22 and 7.23
Might be related/introduced by #23856
"schema": {
"type": "object",
"properties": {
"abc": {
"type": "object",
"description": "first container",
"properties": {
"result": {
"type": "string",
"description": "ABC Result"
}
}
},
"def": {
"type": "object",
"description": "second container",
"properties": {
"result": {
"type": "string",
"description": "DEF Result"
}
}
}
}
}7.22 generates basically this class
public class ApiGetDefaultResponse {
private ApiGetDefaultResponseAbc abc;
private ApiGetDefaultResponseDef def;but 7.23 (or 7.24-snapshot) generates
public class ApiGetDefaultResponse {
private ApiGetDefaultResponseAbc abc;
private ApiGetDefaultResponseAbc def;Note the field def is of type ApiGetDefaultResponseAbc which breaks code that expects ApiGetDefaultResponseDef
openapi-generator version
7.23 ; with 7.22 it works fine
OpenAPI declaration file content or url
Generation Details
https://github.com/pe-st/openapi-generator-deduplicate contains a project with maven plugin configuration and Java code using the generated code, using the JAVA generator
Steps to reproduce
mvn package in the provided reproducer repository fails to compile when using 7.23 instead of 7.22
Related issues/PRs
Suggest a fix
Reacted by Jan-Nick Kemming @OTTO and Charles Dubois
Activity
staktrace commentedon Jun 14, 2026
If you need another example, The github openapi spec at https://github.com/github/rest-api-description/blob/827686c437e24828da43ba00f23dbc99909ce1c9/descriptions/ghec/ghec.2022-11-28.json also is affected with 7.23.0. The code generated with 7.22.0 works but 7.23.0 is missing at least
IssuesUpdateCommentRequestand code depending on it fails to compile.fluett commentedon Jun 18, 2026
I have the same issue, but not with inline objects, but with named references (which have the same properties):
"MyField": { "title": "MyField", "type": "object", "properties": { "hidden": { "$ref": "#/definitions/HiddenConfig" }, "type": { "type": "string" }, "required": { "$ref": "#/definitions/RequiredConfig" }, } }In version 22 the HiddenConfig and RequiredConfig lead to two different Java Classes, in version 23 the required class is missing and the type of the required field is of type HiddenConfig
janko-dataport commentedon Jun 19, 2026
Same here. It looks like 7.23.0 is using the same type in different locations.
When the api defines several responses with the same content structure:
Then the return type, that is first declared in the api.yaml, will be used as the return type for the latter:
fix(InlineModelResolver): do not merge untitled inline schemas differ…
fix(InlineModelResolver): do not merge untitled inline schemas differ…
fix(InlineModelResolver): do not merge untitled inline schemas differ…
wing328 commentedon Jul 3, 2026
just merged a fix via #24192 (by @seonwooj0810 )
please give it a try with the latest master.
Fix access_token description in revokeChannelToken (line#130)
Fix access_token description in revokeChannelToken (line#1050)
Fix access_token description in revokeChannelToken (line#1950)