Bug Report Checklist
Description
Hi, it seems there is case collision issue with schema names in typescript generator.
When schema names conflict due to case differences, the generated model file names are suffixed with index,
but the model import and export statements don’t reflect those file names, causing broken references.
I first encountered this with typescript-axios generator, but the issue is reproducible with typescript generator.
I think I found related change #19715, and following fix #19913 although it is not directly related to typescript.
openapi-generator version
v7.9.0 or higher
OpenAPI declaration file content or url
{
"openapi": "3.0.1",
"info": {},
"paths": {},
"components": {
"schemas": {
"Response": {
"required": ["upper", "lower"],
"type": "object",
"properties": {
"upper": {
"$ref": "#/components/schemas/ModelA"
},
"lower": {
"$ref": "#/components/schemas/Modela"
}
}
},
"ModelA": {
"type": "string",
"enum": ["A", "B"]
},
"Modela": {
"type": "string",
"enum": ["A", "B"]
}
}
}
}
openapitools.json
{
"generator-cli": {
"version": "7.12.0",
"generators": {
"typescript": {
"inputSpec": "./spec.json",
"output": "./generated",
"generatorName": "typescript-axios",
"additionalProperties": {
"withSeparateModelsAndApi": true,
"apiPackage": "apis",
"modelPackage": "models"
}
}
}
}
}
Generation Details
The schema Modela creates modela0.ts, but the model is not referenced with index-suffixed file name.
// response.ts
import type { ModelA } from './model-a';
import type { Modela } from './modela';
export interface Response {
'upper': ModelA;
'lower': Modela;
}
// index.ts
export * from './model-a';
export * from './modela';
export * from './response';
Steps to reproduce
java -jar "openapi-generator-cli.jar" generate --input-spec ./spec.json --output ./generated --generator-name typescript-axios --additional-properties withSeparateModelsAndApi=true,apiPackage=apis,modelPackage=models
Related issues/PRs
#19715
Suggest a fix
Not sure but changes regarding seenModelFilenames needs to be reverted just like #19913?
Bug Report Checklist
Description
Hi, it seems there is case collision issue with schema names in typescript generator.
When schema names conflict due to case differences, the generated model file names are suffixed with index,
but the model import and export statements don’t reflect those file names, causing broken references.
I first encountered this with typescript-axios generator, but the issue is reproducible with typescript generator.
I think I found related change #19715, and following fix #19913 although it is not directly related to typescript.
openapi-generator version
v7.9.0 or higher
OpenAPI declaration file content or url
{ "openapi": "3.0.1", "info": {}, "paths": {}, "components": { "schemas": { "Response": { "required": ["upper", "lower"], "type": "object", "properties": { "upper": { "$ref": "#/components/schemas/ModelA" }, "lower": { "$ref": "#/components/schemas/Modela" } } }, "ModelA": { "type": "string", "enum": ["A", "B"] }, "Modela": { "type": "string", "enum": ["A", "B"] } } } }openapitools.json
{ "generator-cli": { "version": "7.12.0", "generators": { "typescript": { "inputSpec": "./spec.json", "output": "./generated", "generatorName": "typescript-axios", "additionalProperties": { "withSeparateModelsAndApi": true, "apiPackage": "apis", "modelPackage": "models" } } } } }Generation Details
The schema
Modelacreatesmodela0.ts, but the model is not referenced with index-suffixed file name.Steps to reproduce
java -jar "openapi-generator-cli.jar" generate --input-spec ./spec.json --output ./generated --generator-name typescript-axios --additional-properties withSeparateModelsAndApi=true,apiPackage=apis,modelPackage=modelsRelated issues/PRs
#19715
Suggest a fix
Not sure but changes regarding
seenModelFilenamesneeds to be reverted just like #19913?