Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [typescript-fetch] Broken files when mixing basic types and refs in oneOf #19909

Open
GregoryMerlet opened this issue Oct 18, 2024 · 0 comments · May be fixed by #20193
Open

[BUG] [typescript-fetch] Broken files when mixing basic types and refs in oneOf #19909

GregoryMerlet opened this issue Oct 18, 2024 · 0 comments · May be fixed by #20193

Comments

@GregoryMerlet
Copy link
Contributor

Description

When using basic types in a oneOf the generated code is importing the basic type like this:

Actual:
import type { TestA } from './TestA';
import type { TestB } from './TestB';
import type { string } from './string';

export type TestResponse = TestA | TestB | string;
Expected:
import type { TestA } from './TestA';
import type { TestB } from './TestB';

export type TestResponse = TestA | TestB | string;

When using arrays of refs in a oneOf it's the opposite, the referenced schemas are not imported:
Actual:
export type TestArrayResponse = Array<TestA> | Array<TestB> | Array<string>;
Expected:
import type { TestA } from './TestA';
import type { TestB } from './TestB';

export type TestArrayResponse = Array<TestA> | Array<TestB> | Array<string>;
openapi-generator version

7.9.0 and latest master

OpenAPI declaration file content or url

https://gist.github.com/GregoryMerlet/fc7d7c2cb750d8d27eb064a613312b0c

Generation Details

typescript-fetch generator

Steps to reproduce

Generate using the yaml previously linked.

thesn10 added a commit to thesn10/openapi-generator that referenced this issue Nov 26, 2024
thesn10 added a commit to thesn10/openapi-generator that referenced this issue Nov 27, 2024
thesn10 added a commit to thesn10/openapi-generator that referenced this issue Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant