Skip to content

Commit e80b263

Browse files
committed
fix: enhance model imports for oneOf arrays in mustache templates
1 parent 2e42fa8 commit e80b263

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
{{#hasImports}}
2+
{{#oneOfArrays}}
3+
import type { {{{.}}} } from './{{.}}{{importFileExtension}}';
4+
import {
5+
instanceOf{{{.}}},
6+
{{{.}}}FromJSON,
7+
{{{.}}}FromJSONTyped,
8+
{{{.}}}ToJSON,
9+
} from './{{.}}{{importFileExtension}}';
10+
{{/oneOfArrays}}
211
{{#oneOfModels}}
312
import type { {{{.}}} } from './{{.}}{{importFileExtension}}';
413
import {

samples/client/petstore/typescript-fetch/builds/oneOf/models/TestArrayResponse.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212
* Do not edit the class manually.
1313
*/
1414

15+
import type { TestA } from './TestA';
16+
import {
17+
instanceOfTestA,
18+
TestAFromJSON,
19+
TestAFromJSONTyped,
20+
TestAToJSON,
21+
} from './TestA';
22+
import type { TestB } from './TestB';
23+
import {
24+
instanceOfTestB,
25+
TestBFromJSON,
26+
TestBFromJSONTyped,
27+
TestBToJSON,
28+
} from './TestB';
1529

1630
/**
1731
* @type TestArrayResponse

0 commit comments

Comments
 (0)