Bug Report Checklist
Description
The typescript-fetch generator generates interfaces which reference themselves for oneOf object schemas where the property names of these objects are the same as the type names, since it generates intermediate types with the same name, eg:
/**
* @type FooOrBar
*
* @export
*/
export type FooOrBar = Bar | Foo;
/**
*
* @export
* @interface Foo
*/
export interface Foo {
/**
*
* @type {Foo}
* @memberof Foo
*/
foo: Foo;
}
openapi-generator version
6.3.0. Also tried with latest mainline.
OpenAPI declaration file content or url
Full example: https://gist.github.com/cogwirrel/6f6355e04b831bfbbbe57337b3429b9c
Example of just the schema part below
{
"oneOf": [
{
"type": "object",
"title": "foo",
"properties": {
"foo": {
"$ref": "#/components/schemas/Foo"
}
},
"required": [
"foo"
]
},
{
"type": "object",
"title": "bar",
"properties": {
"bar": {
"$ref": "#/components/schemas/Bar"
}
},
"required": [
"bar"
]
}
]
}
Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g typescript-fetch -i https://gist.githubusercontent.com/cogwirrel/6f6355e04b831bfbbbe57337b3429b9c/raw/38c4af6ae02d8dd0c8bfc7a29c9f9d63069154ad/example-api-oneof-issue.json -o ./oneof-test
Steps to reproduce
- Checkout latest mainline
- Build with
./mvnw clean install
- Run
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g typescript-fetch -i https://gist.githubusercontent.com/cogwirrel/6f6355e04b831bfbbbe57337b3429b9c/raw/38c4af6ae02d8dd0c8bfc7a29c9f9d63069154ad/example-api-oneof-issue.json -o ./oneof-test
Bug Report Checklist
Description
The typescript-fetch generator generates interfaces which reference themselves for
oneOfobject schemas where the property names of these objects are the same as the type names, since it generates intermediate types with the same name, eg:openapi-generator version
6.3.0. Also tried with latest mainline.
OpenAPI declaration file content or url
Full example: https://gist.github.com/cogwirrel/6f6355e04b831bfbbbe57337b3429b9c
Example of just the schema part below
{ "oneOf": [ { "type": "object", "title": "foo", "properties": { "foo": { "$ref": "#/components/schemas/Foo" } }, "required": [ "foo" ] }, { "type": "object", "title": "bar", "properties": { "bar": { "$ref": "#/components/schemas/Bar" } }, "required": [ "bar" ] } ] }Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g typescript-fetch -i https://gist.githubusercontent.com/cogwirrel/6f6355e04b831bfbbbe57337b3429b9c/raw/38c4af6ae02d8dd0c8bfc7a29c9f9d63069154ad/example-api-oneof-issue.json -o ./oneof-testSteps to reproduce
./mvnw clean installjava -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g typescript-fetch -i https://gist.githubusercontent.com/cogwirrel/6f6355e04b831bfbbbe57337b3429b9c/raw/38c4af6ae02d8dd0c8bfc7a29c9f9d63069154ad/example-api-oneof-issue.json -o ./oneof-test