Skip to content

Commit

Permalink
[typescript-fetch][Fix] oneOf models are generated without `...ToJS…
Browse files Browse the repository at this point in the history
…ONTyped` functions but models referencing still try to import (#20046)

* Fix #19858

* re-generate the samples
  • Loading branch information
guizmaii authored Nov 7, 2024
1 parent 28e02fc commit 2c38d0d
Show file tree
Hide file tree
Showing 163 changed files with 654 additions and 646 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
{{/hasVars}}
}

export function {{classname}}ToJSON(json: any): {{classname}} {
return {{classname}}ToJSONTyped(json, false);
}
export function {{classname}}ToJSON(json: any): {{classname}} {
return {{classname}}ToJSONTyped(json, false);
}

export function {{classname}}ToJSONTyped(value?: {{#hasReadOnly}}Omit<{{classname}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{classname}}{{/hasReadOnly}} | null, ignoreDiscriminator: boolean = false): any {
export function {{classname}}ToJSONTyped(value?: {{#hasReadOnly}}Omit<{{classname}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{classname}}{{/hasReadOnly}} | null, ignoreDiscriminator: boolean = false): any {
{{#hasVars}}
if (value == null) {
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
{{/discriminator}}
}

export function {{classname}}ToJSON(value?: {{classname}} | null): any {
export function {{classname}}ToJSON(json: any): any {
return {{classname}}ToJSONTyped(json, false);
}

export function {{classname}}ToJSONTyped(value?: {{classname}} | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ export function AbstractUserDtoFromJSONTyped(json: any, ignoreDiscriminator: boo
};
}

export function AbstractUserDtoToJSON(json: any): AbstractUserDto {
return AbstractUserDtoToJSONTyped(json, false);
}
export function AbstractUserDtoToJSON(json: any): AbstractUserDto {
return AbstractUserDtoToJSONTyped(json, false);
}

export function AbstractUserDtoToJSONTyped(value?: AbstractUserDto | null, ignoreDiscriminator: boolean = false): any {
export function AbstractUserDtoToJSONTyped(value?: AbstractUserDto | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function BranchDtoFromJSONTyped(json: any, ignoreDiscriminator: boolean):
};
}

export function BranchDtoToJSON(json: any): BranchDto {
return BranchDtoToJSONTyped(json, false);
}
export function BranchDtoToJSON(json: any): BranchDto {
return BranchDtoToJSONTyped(json, false);
}

export function BranchDtoToJSONTyped(value?: BranchDto | null, ignoreDiscriminator: boolean = false): any {
export function BranchDtoToJSONTyped(value?: BranchDto | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export function InternalAuthenticatedUserDtoFromJSONTyped(json: any, ignoreDiscr
return json;
}

export function InternalAuthenticatedUserDtoToJSON(json: any): InternalAuthenticatedUserDto {
return InternalAuthenticatedUserDtoToJSONTyped(json, false);
}
export function InternalAuthenticatedUserDtoToJSON(json: any): InternalAuthenticatedUserDto {
return InternalAuthenticatedUserDtoToJSONTyped(json, false);
}

export function InternalAuthenticatedUserDtoToJSONTyped(value?: InternalAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any {
export function InternalAuthenticatedUserDtoToJSONTyped(value?: InternalAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any {
return value;
}

Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export function RemoteAuthenticatedUserDtoFromJSONTyped(json: any, ignoreDiscrim
return json;
}

export function RemoteAuthenticatedUserDtoToJSON(json: any): RemoteAuthenticatedUserDto {
return RemoteAuthenticatedUserDtoToJSONTyped(json, false);
}
export function RemoteAuthenticatedUserDtoToJSON(json: any): RemoteAuthenticatedUserDto {
return RemoteAuthenticatedUserDtoToJSONTyped(json, false);
}

export function RemoteAuthenticatedUserDtoToJSONTyped(value?: RemoteAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any {
export function RemoteAuthenticatedUserDtoToJSONTyped(value?: RemoteAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any {
return value;
}

Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club
};
}

export function ClubToJSON(json: any): Club {
return ClubToJSONTyped(json, false);
}
export function ClubToJSON(json: any): Club {
return ClubToJSONTyped(json, false);
}

export function ClubToJSONTyped(value?: Club | null, ignoreDiscriminator: boolean = false): any {
export function ClubToJSONTyped(value?: Club | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Own
};
}

export function OwnerToJSON(json: any): Owner {
return OwnerToJSONTyped(json, false);
}
export function OwnerToJSON(json: any): Owner {
return OwnerToJSONTyped(json, false);
}

export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any {
export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club
};
}

export function ClubToJSON(json: any): Club {
return ClubToJSONTyped(json, false);
}
export function ClubToJSON(json: any): Club {
return ClubToJSONTyped(json, false);
}

export function ClubToJSONTyped(value?: Omit<Club, 'owner'> | null, ignoreDiscriminator: boolean = false): any {
export function ClubToJSONTyped(value?: Omit<Club, 'owner'> | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Own
};
}

export function OwnerToJSON(json: any): Owner {
return OwnerToJSONTyped(json, false);
}
export function OwnerToJSON(json: any): Owner {
return OwnerToJSONTyped(json, false);
}

export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any {
export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export function AdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscrimi
};
}

export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass {
return AdditionalPropertiesClassToJSONTyped(json, false);
}
export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass {
return AdditionalPropertiesClassToJSONTyped(json, false);
}

export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any {
export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export function AllOfWithSingleRefFromJSONTyped(json: any, ignoreDiscriminator:
};
}

export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef {
return AllOfWithSingleRefToJSONTyped(json, false);
}
export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef {
return AllOfWithSingleRefToJSONTyped(json, false);
}

export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any {
export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An
};
}

export function AnimalToJSON(json: any): Animal {
return AnimalToJSONTyped(json, false);
}
export function AnimalToJSON(json: any): Animal {
return AnimalToJSONTyped(json, false);
}

export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any {
export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function ArrayOfArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscrimin
};
}

export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly {
return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false);
}
export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly {
return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false);
}

export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any {
export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function ArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: b
};
}

export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly {
return ArrayOfNumberOnlyToJSONTyped(json, false);
}
export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly {
return ArrayOfNumberOnlyToJSONTyped(json, false);
}

export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any {
export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ export function ArrayTestFromJSONTyped(json: any, ignoreDiscriminator: boolean):
};
}

export function ArrayTestToJSON(json: any): ArrayTest {
return ArrayTestToJSONTyped(json, false);
}
export function ArrayTestToJSON(json: any): ArrayTest {
return ArrayTestToJSONTyped(json, false);
}

export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any {
export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ export function CapitalizationFromJSONTyped(json: any, ignoreDiscriminator: bool
};
}

export function CapitalizationToJSON(json: any): Capitalization {
return CapitalizationToJSONTyped(json, false);
}
export function CapitalizationToJSON(json: any): Capitalization {
return CapitalizationToJSONTyped(json, false);
}

export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any {
export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export function CatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cat {
};
}

export function CatToJSON(json: any): Cat {
return CatToJSONTyped(json, false);
}
export function CatToJSON(json: any): Cat {
return CatToJSONTyped(json, false);
}

export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any {
export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean):
};
}

export function CategoryToJSON(json: any): Category {
return CategoryToJSONTyped(json, false);
}
export function CategoryToJSON(json: any): Category {
return CategoryToJSONTyped(json, false);
}

export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any {
export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export function ChildWithNullableFromJSONTyped(json: any, ignoreDiscriminator: b
};
}

export function ChildWithNullableToJSON(json: any): ChildWithNullable {
return ChildWithNullableToJSONTyped(json, false);
}
export function ChildWithNullableToJSON(json: any): ChildWithNullable {
return ChildWithNullableToJSONTyped(json, false);
}

export function ChildWithNullableToJSONTyped(value?: ChildWithNullable | null, ignoreDiscriminator: boolean = false): any {
export function ChildWithNullableToJSONTyped(value?: ChildWithNullable | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function ClassModelFromJSONTyped(json: any, ignoreDiscriminator: boolean)
};
}

export function ClassModelToJSON(json: any): ClassModel {
return ClassModelToJSONTyped(json, false);
}
export function ClassModelToJSON(json: any): ClassModel {
return ClassModelToJSONTyped(json, false);
}

export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any {
export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cl
};
}

export function ClientToJSON(json: any): Client {
return ClientToJSONTyped(json, false);
}
export function ClientToJSON(json: any): Client {
return ClientToJSONTyped(json, false);
}

export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any {
export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function DeprecatedObjectFromJSONTyped(json: any, ignoreDiscriminator: bo
};
}

export function DeprecatedObjectToJSON(json: any): DeprecatedObject {
return DeprecatedObjectToJSONTyped(json, false);
}
export function DeprecatedObjectToJSON(json: any): DeprecatedObject {
return DeprecatedObjectToJSONTyped(json, false);
}

export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any {
export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export function DogFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dog {
};
}

export function DogToJSON(json: any): Dog {
return DogToJSONTyped(json, false);
}
export function DogToJSON(json: any): Dog {
return DogToJSONTyped(json, false);
}

export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any {
export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export function EnumArraysFromJSONTyped(json: any, ignoreDiscriminator: boolean)
};
}

export function EnumArraysToJSON(json: any): EnumArrays {
return EnumArraysToJSONTyped(json, false);
}
export function EnumArraysToJSON(json: any): EnumArrays {
return EnumArraysToJSONTyped(json, false);
}

export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any {
export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Loading

0 comments on commit 2c38d0d

Please sign in to comment.