Skip to content

Commit

Permalink
[typescript-fetch] fix circular imports being generated (#10798)
Browse files Browse the repository at this point in the history
templates based off of #6140 and @ajaska

closes #6140
  • Loading branch information
BeryJu authored Nov 22, 2021
1 parent e9f2ccd commit 49e9911
Show file tree
Hide file tree
Showing 32 changed files with 81 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { exists, mapValues } from '../runtime';
{{#hasImports}}
{{#imports}}
import {
{{#imports}}
{{{.}}},
{{.}}FromJSON,
{{.}}FromJSONTyped,
{{.}}ToJSON,
{{/imports}}
} from './';
} from './{{.}}';
{{/imports}}

{{/hasImports}}
{{#discriminator}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{{#hasImports}}
{{#oneOf}}
import {
{{#imports}}
{{{.}}},
{{/imports}}
{{#oneOf}}
{{{.}}}FromJSON,
{{{.}}}FromJSONTyped,
{{{.}}}ToJSON,
{{/oneOf}}
} from './';
} from './{{.}}';
{{/oneOf}}

{{/hasImports}}
{{>modelOneOfInterfaces}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ReadOnlyFirstFromJSON,
ReadOnlyFirstFromJSONTyped,
ReadOnlyFirstToJSON,
} from './';
} from './ReadOnlyFirst';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
AnimalFromJSON,
AnimalFromJSONTyped,
AnimalToJSON,
} from './Animal';
import {
CatAllOf,
CatAllOfFromJSON,
CatAllOfFromJSONTyped,
CatAllOfToJSON,
} from './';
} from './CatAllOf';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
AnimalFromJSON,
AnimalFromJSONTyped,
AnimalToJSON,
} from './Animal';
import {
DogAllOf,
DogAllOfFromJSON,
DogAllOfFromJSONTyped,
DogAllOfToJSON,
} from './';
} from './DogAllOf';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,25 @@ import {
OuterEnumFromJSON,
OuterEnumFromJSONTyped,
OuterEnumToJSON,
} from './OuterEnum';
import {
OuterEnumDefaultValue,
OuterEnumDefaultValueFromJSON,
OuterEnumDefaultValueFromJSONTyped,
OuterEnumDefaultValueToJSON,
} from './OuterEnumDefaultValue';
import {
OuterEnumInteger,
OuterEnumIntegerFromJSON,
OuterEnumIntegerFromJSONTyped,
OuterEnumIntegerToJSON,
} from './OuterEnumInteger';
import {
OuterEnumIntegerDefaultValue,
OuterEnumIntegerDefaultValueFromJSON,
OuterEnumIntegerDefaultValueFromJSONTyped,
OuterEnumIntegerDefaultValueToJSON,
} from './';
} from './OuterEnumIntegerDefaultValue';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
DecimalFromJSON,
DecimalFromJSONTyped,
DecimalToJSON,
} from './';
} from './Decimal';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
FooFromJSON,
FooFromJSONTyped,
FooToJSON,
} from './';
} from './Foo';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
AnimalFromJSON,
AnimalFromJSONTyped,
AnimalToJSON,
} from './';
} from './Animal';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
DeprecatedObjectFromJSON,
DeprecatedObjectFromJSONTyped,
DeprecatedObjectToJSON,
} from './';
} from './DeprecatedObject';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
OuterEnumIntegerFromJSON,
OuterEnumIntegerFromJSONTyped,
OuterEnumIntegerToJSON,
} from './';
} from './OuterEnumInteger';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
CategoryFromJSON,
CategoryFromJSONTyped,
CategoryToJSON,
} from './Category';
import {
Tag,
TagFromJSON,
TagFromJSONTyped,
TagToJSON,
} from './';
} from './Tag';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
CategoryFromJSON,
CategoryFromJSONTyped,
CategoryToJSON,
} from './Category';
import {
Tag,
TagFromJSON,
TagFromJSONTyped,
TagToJSON,
} from './';
} from './Tag';

/**
* A pet for sale in the pet store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
NumberEnumFromJSON,
NumberEnumFromJSONTyped,
NumberEnumToJSON,
} from './NumberEnum';
import {
StringEnum,
StringEnumFromJSON,
StringEnumFromJSONTyped,
StringEnumToJSON,
} from './';
} from './StringEnum';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
CategoryFromJSON,
CategoryFromJSONTyped,
CategoryToJSON,
} from './Category';
import {
Tag,
TagFromJSON,
TagFromJSONTyped,
TagToJSON,
} from './';
} from './Tag';

/**
* A pet for sale in the pet store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
CategoryFromJSON,
CategoryFromJSONTyped,
CategoryToJSON,
} from './Category';
import {
Tag,
TagFromJSON,
TagFromJSONTyped,
TagToJSON,
} from './';
} from './Tag';

/**
* A pet for sale in the pet store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
CategoryFromJSON,
CategoryFromJSONTyped,
CategoryToJSON,
} from './Category';
import {
Tag,
TagFromJSON,
TagFromJSONTyped,
TagToJSON,
} from './';
} from './Tag';

/**
* A pet for sale in the pet store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './';
} from './ResponseMeta';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
PetFromJSON,
PetFromJSONTyped,
PetToJSON,
} from './Pet';
import {
ResponseMeta,
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './';
} from './ResponseMeta';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './ResponseMeta';
import {
User,
UserFromJSON,
UserFromJSONTyped,
UserToJSON,
} from './';
} from './User';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './';
} from './ResponseMeta';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
BehaviorTypeFromJSON,
BehaviorTypeFromJSONTyped,
BehaviorTypeToJSON,
} from './BehaviorType';
import {
ResponseMeta,
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './';
} from './ResponseMeta';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
MatchingPartsFromJSON,
MatchingPartsFromJSONTyped,
MatchingPartsToJSON,
} from './MatchingParts';
import {
ResponseMeta,
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './';
} from './ResponseMeta';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import {
PetPartTypeFromJSON,
PetPartTypeFromJSONTyped,
PetPartTypeToJSON,
} from './PetPartType';
import {
ResponseMeta,
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './';
} from './ResponseMeta';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
PartFromJSON,
PartFromJSONTyped,
PartToJSON,
} from './';
} from './Part';

/**
* Contains all the matching parts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ItemIdFromJSON,
ItemIdFromJSONTyped,
ItemIdToJSON,
} from './';
} from './ItemId';

/**
* This represent an error normally linked to a specific item from a previous request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,25 @@ import {
CategoryFromJSON,
CategoryFromJSONTyped,
CategoryToJSON,
} from './Category';
import {
DeploymentRequestStatus,
DeploymentRequestStatusFromJSON,
DeploymentRequestStatusFromJSONTyped,
DeploymentRequestStatusToJSON,
} from './DeploymentRequestStatus';
import {
Tag,
TagFromJSON,
TagFromJSONTyped,
TagToJSON,
} from './Tag';
import {
WarningCode,
WarningCodeFromJSON,
WarningCodeFromJSONTyped,
WarningCodeToJSON,
} from './';
} from './WarningCode';

/**
* A pet for sale in the pet store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ResponseMetaFromJSON,
ResponseMetaFromJSONTyped,
ResponseMetaToJSON,
} from './';
} from './ResponseMeta';

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ErrorCodeFromJSON,
ErrorCodeFromJSONTyped,
ErrorCodeToJSON,
} from './';
} from './ErrorCode';

/**
* Mandatory part of each response given by our API
Expand Down
Loading

0 comments on commit 49e9911

Please sign in to comment.