From 67a504a2f342509c1f48085c64123fd3f26dd39f Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Fri, 3 May 2024 06:07:02 -0700 Subject: [PATCH] [typescript-fetch] Remove a cycle in the discriminator dependency graph. (#18503) --- .../main/resources/typescript-fetch/modelGeneric.mustache | 5 +---- .../typescript-fetch/builds/default-v3.0/models/Animal.ts | 7 ++----- .../builds/default-v3.0/models/ParentWithNullable.ts | 5 +---- .../builds/snakecase-discriminator/models/Animal.ts | 7 ++----- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache index b8fd70ec428..1062d5db958 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -11,12 +11,9 @@ import { {{/hasImports}} {{#discriminator}} -import { {{#discriminator.mappedModels}} - {{modelName}}FromJSONTyped{{^-last}},{{/-last}} +import { {{modelName}}FromJSONTyped } from './{{modelName}}{{importFileExtension}}'; {{/discriminator.mappedModels}} -} from './index{{importFileExtension}}'; - {{/discriminator}} {{>modelGenericInterfaces}} diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts index a1b091662a1..a5f85d1cc61 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts @@ -13,11 +13,8 @@ */ import { mapValues } from '../runtime'; -import { - CatFromJSONTyped, - DogFromJSONTyped -} from './index'; - +import { CatFromJSONTyped } from './Cat'; +import { DogFromJSONTyped } from './Dog'; /** * * @export diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts index a593c5a384f..c549674ec4a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts @@ -13,10 +13,7 @@ */ import { mapValues } from '../runtime'; -import { - ChildWithNullableFromJSONTyped -} from './index'; - +import { ChildWithNullableFromJSONTyped } from './ChildWithNullable'; /** * * @export diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts index c2394952c9d..5edd6e54fee 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts @@ -13,11 +13,8 @@ */ import { mapValues } from '../runtime'; -import { - CatFromJSONTyped, - DogFromJSONTyped -} from './index'; - +import { CatFromJSONTyped } from './Cat'; +import { DogFromJSONTyped } from './Dog'; /** * * @export