diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache index 5bab7a5a98c2..35e0303d986a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache @@ -22,3 +22,7 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole export function {{classname}}ToJSON(value?: {{classname}} | null): any { return value as any; } + +export function {{classname}}ToJSONTyped(value: any, ignoreDiscriminator: boolean): {{classname}} { + return value as {{classname}}; +} 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 803b27608ea1..c6d384855b5f 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -6,13 +6,14 @@ import { {{classname}}FromJSON, {{classname}}FromJSONTyped, {{classname}}ToJSON, + {{classname}}ToJSONTyped, } from './{{filename}}{{importFileExtension}}'; {{/tsImports}} {{/hasImports}} {{#discriminator}} {{#discriminator.mappedModels}} -import { {{modelName}}FromJSONTyped } from './{{modelName}}{{importFileExtension}}'; +import { {{modelName}}, {{modelName}}FromJSONTyped, {{modelName}}ToJSON, {{modelName}}ToJSONTyped } from './{{modelName}}{{importFileExtension}}'; {{/discriminator.mappedModels}} {{/discriminator}} {{>modelGenericInterfaces}} @@ -42,13 +43,13 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole if (!ignoreDiscriminator) { {{#discriminator.mappedModels}} if (json['{{discriminator.propertyBaseName}}'] === '{{mappingName}}') { - return {{modelName}}FromJSONTyped(json, true); + return {{modelName}}FromJSONTyped(json, ignoreDiscriminator); } {{/discriminator.mappedModels}} } {{/discriminator}} return { - {{#parent}}...{{{.}}}FromJSONTyped(json, ignoreDiscriminator),{{/parent}} + {{#parent}}...{{{.}}}FromJSONTyped(json, true),{{/parent}} {{#additionalPropertiesType}} ...json, {{/additionalPropertiesType}} @@ -97,13 +98,31 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole {{/hasVars}} } -export function {{classname}}ToJSON(value?: {{#hasReadOnly}}Omit<{{classname}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{classname}}{{/hasReadOnly}} | null): any { + 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 { {{#hasVars}} if (value == null) { return value; } + {{#discriminator}} + + if (!ignoreDiscriminator) { + switch (value['{{discriminator.propertyName}}']) { + {{#discriminator.mappedModels}} + case '{{mappingName}}': + return {{modelName}}ToJSONTyped(value as {{modelName}}, ignoreDiscriminator); + {{/discriminator.mappedModels}} + default: + throw new Error(`No variant of {{classname}} exists with '{{discriminator.propertyName}}=${value['{{discriminator.propertyName}}']}'`); + } + } + {{/discriminator}} + return { - {{#parent}}...{{{.}}}ToJSON(value),{{/parent}} + {{#parent}}...{{{.}}}ToJSONTyped(value, true),{{/parent}} {{#additionalPropertiesType}} ...value, {{/additionalPropertiesType}} diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts index 0b133d0c066c..53bf52f50bb9 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts @@ -18,10 +18,11 @@ import { BranchDtoFromJSON, BranchDtoFromJSONTyped, BranchDtoToJSON, + BranchDtoToJSONTyped, } from './BranchDto'; -import { InternalAuthenticatedUserDtoFromJSONTyped } from './InternalAuthenticatedUserDto'; -import { RemoteAuthenticatedUserDtoFromJSONTyped } from './RemoteAuthenticatedUserDto'; +import { InternalAuthenticatedUserDto, InternalAuthenticatedUserDtoFromJSONTyped, InternalAuthenticatedUserDtoToJSON, InternalAuthenticatedUserDtoToJSONTyped } from './InternalAuthenticatedUserDto'; +import { RemoteAuthenticatedUserDto, RemoteAuthenticatedUserDtoFromJSONTyped, RemoteAuthenticatedUserDtoToJSON, RemoteAuthenticatedUserDtoToJSONTyped } from './RemoteAuthenticatedUserDto'; /** * * @export @@ -65,10 +66,10 @@ export function AbstractUserDtoFromJSONTyped(json: any, ignoreDiscriminator: boo } if (!ignoreDiscriminator) { if (json['type'] === 'internal-authenticated') { - return InternalAuthenticatedUserDtoFromJSONTyped(json, true); + return InternalAuthenticatedUserDtoFromJSONTyped(json, ignoreDiscriminator); } if (json['type'] === 'remote-authenticated') { - return RemoteAuthenticatedUserDtoFromJSONTyped(json, true); + return RemoteAuthenticatedUserDtoFromJSONTyped(json, ignoreDiscriminator); } } return { @@ -79,10 +80,26 @@ export function AbstractUserDtoFromJSONTyped(json: any, ignoreDiscriminator: boo }; } -export function AbstractUserDtoToJSON(value?: AbstractUserDto | null): any { + export function AbstractUserDtoToJSON(json: any): AbstractUserDto { + return AbstractUserDtoToJSONTyped(json, false); + } + + export function AbstractUserDtoToJSONTyped(value?: AbstractUserDto | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + + if (!ignoreDiscriminator) { + switch (value['type']) { + case 'internal-authenticated': + return InternalAuthenticatedUserDtoToJSONTyped(value as InternalAuthenticatedUserDto, ignoreDiscriminator); + case 'remote-authenticated': + return RemoteAuthenticatedUserDtoToJSONTyped(value as RemoteAuthenticatedUserDto, ignoreDiscriminator); + default: + throw new Error(`No variant of AbstractUserDto exists with 'type=${value['type']}'`); + } + } + return { 'username': value['username'], diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts index 916a5431fdb9..5de31fa073f8 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts @@ -48,10 +48,15 @@ export function BranchDtoFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function BranchDtoToJSON(value?: BranchDto | null): any { + export function BranchDtoToJSON(json: any): BranchDto { + return BranchDtoToJSONTyped(json, false); + } + + export function BranchDtoToJSONTyped(value?: BranchDto | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts index 9d4c67613353..14a4f768ac4f 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts @@ -18,12 +18,14 @@ import { BranchDtoFromJSON, BranchDtoFromJSONTyped, BranchDtoToJSON, + BranchDtoToJSONTyped, } from './BranchDto'; import type { AbstractUserDto } from './AbstractUserDto'; import { AbstractUserDtoFromJSON, AbstractUserDtoFromJSONTyped, AbstractUserDtoToJSON, + AbstractUserDtoToJSONTyped, } from './AbstractUserDto'; /** @@ -49,7 +51,11 @@ export function InternalAuthenticatedUserDtoFromJSONTyped(json: any, ignoreDiscr return json; } -export function InternalAuthenticatedUserDtoToJSON(value?: InternalAuthenticatedUserDto | null): any { + export function InternalAuthenticatedUserDtoToJSON(json: any): InternalAuthenticatedUserDto { + return InternalAuthenticatedUserDtoToJSONTyped(json, false); + } + + export function InternalAuthenticatedUserDtoToJSONTyped(value?: InternalAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any { return value; } diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts index 041a56577027..6791e2e1216f 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts @@ -18,12 +18,14 @@ import { BranchDtoFromJSON, BranchDtoFromJSONTyped, BranchDtoToJSON, + BranchDtoToJSONTyped, } from './BranchDto'; import type { AbstractUserDto } from './AbstractUserDto'; import { AbstractUserDtoFromJSON, AbstractUserDtoFromJSONTyped, AbstractUserDtoToJSON, + AbstractUserDtoToJSONTyped, } from './AbstractUserDto'; /** @@ -49,7 +51,11 @@ export function RemoteAuthenticatedUserDtoFromJSONTyped(json: any, ignoreDiscrim return json; } -export function RemoteAuthenticatedUserDtoToJSON(value?: RemoteAuthenticatedUserDto | null): any { + export function RemoteAuthenticatedUserDtoToJSON(json: any): RemoteAuthenticatedUserDto { + return RemoteAuthenticatedUserDtoToJSONTyped(json, false); + } + + export function RemoteAuthenticatedUserDtoToJSONTyped(value?: RemoteAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts index fade52e7172e..cce6b72e169a 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts @@ -18,6 +18,7 @@ import { OwnerFromJSON, OwnerFromJSONTyped, OwnerToJSON, + OwnerToJSONTyped, } from './Owner'; /** @@ -55,10 +56,15 @@ export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club }; } -export function ClubToJSON(value?: Club | null): any { + export function ClubToJSON(json: any): Club { + return ClubToJSONTyped(json, false); + } + + export function ClubToJSONTyped(value?: Club | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'owner': OwnerToJSON(value['owner']), diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts index 58df8cbac491..0ed8fde3a930 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts @@ -48,10 +48,15 @@ export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Own }; } -export function OwnerToJSON(value?: Owner | null): any { + export function OwnerToJSON(json: any): Owner { + return OwnerToJSONTyped(json, false); + } + + export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts index c35b4f285e3f..b815ab07d2c6 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts @@ -18,6 +18,7 @@ import { OwnerFromJSON, OwnerFromJSONTyped, OwnerToJSON, + OwnerToJSONTyped, } from './Owner'; /** @@ -55,10 +56,15 @@ export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club }; } -export function ClubToJSON(value?: Omit | null): any { + export function ClubToJSON(json: any): Club { + return ClubToJSONTyped(json, false); + } + + export function ClubToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { }; diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts index 58df8cbac491..0ed8fde3a930 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts @@ -48,10 +48,15 @@ export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Own }; } -export function OwnerToJSON(value?: Owner | null): any { + export function OwnerToJSON(json: any): Owner { + return OwnerToJSONTyped(json, false); + } + + export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts index a83efbc1155a..c15b937e8a1c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts @@ -55,10 +55,15 @@ export function AdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscrimi }; } -export function AdditionalPropertiesClassToJSON(value?: AdditionalPropertiesClass | null): any { + export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass { + return AdditionalPropertiesClassToJSONTyped(json, false); + } + + export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'map_property': value['mapProperty'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts index 4d81b3f96989..826ea603e2db 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts @@ -18,6 +18,7 @@ import { SingleRefTypeFromJSON, SingleRefTypeFromJSONTyped, SingleRefTypeToJSON, + SingleRefTypeToJSONTyped, } from './SingleRefType'; /** @@ -64,10 +65,15 @@ export function AllOfWithSingleRefFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function AllOfWithSingleRefToJSON(value?: AllOfWithSingleRef | null): any { + export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef { + return AllOfWithSingleRefToJSONTyped(json, false); + } + + export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'username': value['username'], 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 236ba544d0d8..0f87e6dd367e 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,8 +13,8 @@ */ import { mapValues } from '../runtime'; -import { CatFromJSONTyped } from './Cat'; -import { DogFromJSONTyped } from './Dog'; +import { Cat, CatFromJSONTyped, CatToJSON, CatToJSONTyped } from './Cat'; +import { Dog, DogFromJSONTyped, DogToJSON, DogToJSONTyped } from './Dog'; /** * * @export @@ -53,10 +53,10 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An } if (!ignoreDiscriminator) { if (json['className'] === 'CAT') { - return CatFromJSONTyped(json, true); + return CatFromJSONTyped(json, ignoreDiscriminator); } if (json['className'] === 'DOG') { - return DogFromJSONTyped(json, true); + return DogFromJSONTyped(json, ignoreDiscriminator); } } return { @@ -66,10 +66,26 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An }; } -export function AnimalToJSON(value?: Animal | null): any { + export function AnimalToJSON(json: any): Animal { + return AnimalToJSONTyped(json, false); + } + + export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + + if (!ignoreDiscriminator) { + switch (value['className']) { + case 'CAT': + return CatToJSONTyped(value as Cat, ignoreDiscriminator); + case 'DOG': + return DogToJSONTyped(value as Dog, ignoreDiscriminator); + default: + throw new Error(`No variant of Animal exists with 'className=${value['className']}'`); + } + } + return { 'className': value['className'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts index dbffd74a5723..18264d15d7cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts @@ -48,10 +48,15 @@ export function ArrayOfArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscrimin }; } -export function ArrayOfArrayOfNumberOnlyToJSON(value?: ArrayOfArrayOfNumberOnly | null): any { + export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly { + return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false); + } + + export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'ArrayArrayNumber': value['arrayArrayNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts index 8029e9dd15bc..fa5c6dc5edd1 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts @@ -48,10 +48,15 @@ export function ArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function ArrayOfNumberOnlyToJSON(value?: ArrayOfNumberOnly | null): any { + export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly { + return ArrayOfNumberOnlyToJSONTyped(json, false); + } + + export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'ArrayNumber': value['arrayNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts index fefc0e842b6f..b31c80207b2f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts @@ -18,6 +18,7 @@ import { ReadOnlyFirstFromJSON, ReadOnlyFirstFromJSONTyped, ReadOnlyFirstToJSON, + ReadOnlyFirstToJSONTyped, } from './ReadOnlyFirst'; /** @@ -69,10 +70,15 @@ export function ArrayTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function ArrayTestToJSON(value?: ArrayTest | null): any { + export function ArrayTestToJSON(json: any): ArrayTest { + return ArrayTestToJSONTyped(json, false); + } + + export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'array_of_string': value['arrayOfString'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts index f9f38b2ed71f..ace2ede88477 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts @@ -84,10 +84,15 @@ export function CapitalizationFromJSONTyped(json: any, ignoreDiscriminator: bool }; } -export function CapitalizationToJSON(value?: Capitalization | null): any { + export function CapitalizationToJSON(json: any): Capitalization { + return CapitalizationToJSONTyped(json, false); + } + + export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'smallCamel': value['smallCamel'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts index 05ffd9e8fab5..a1b44d02d26d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts @@ -18,6 +18,7 @@ import { AnimalFromJSON, AnimalFromJSONTyped, AnimalToJSON, + AnimalToJSONTyped, } from './Animal'; /** @@ -50,17 +51,22 @@ export function CatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cat { return json; } return { - ...AnimalFromJSONTyped(json, ignoreDiscriminator), + ...AnimalFromJSONTyped(json, true), 'declawed': json['declawed'] == null ? undefined : json['declawed'], }; } -export function CatToJSON(value?: Cat | null): any { + export function CatToJSON(json: any): Cat { + return CatToJSONTyped(json, false); + } + + export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { - ...AnimalToJSON(value), + ...AnimalToJSONTyped(value, true), 'declawed': value['declawed'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts index 640b1883c524..7c8caddd4969 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts @@ -56,10 +56,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts index 24167b77a66b..0a5dd717f208 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts @@ -18,6 +18,7 @@ import { ParentWithNullableFromJSON, ParentWithNullableFromJSONTyped, ParentWithNullableToJSON, + ParentWithNullableToJSONTyped, } from './ParentWithNullable'; /** @@ -52,17 +53,22 @@ export function ChildWithNullableFromJSONTyped(json: any, ignoreDiscriminator: b return json; } return { - ...ParentWithNullableFromJSONTyped(json, ignoreDiscriminator), + ...ParentWithNullableFromJSONTyped(json, true), 'otherProperty': json['otherProperty'] == null ? undefined : json['otherProperty'], }; } -export function ChildWithNullableToJSON(value?: ChildWithNullable | null): any { + export function ChildWithNullableToJSON(json: any): ChildWithNullable { + return ChildWithNullableToJSONTyped(json, false); + } + + export function ChildWithNullableToJSONTyped(value?: ChildWithNullable | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { - ...ParentWithNullableToJSON(value), + ...ParentWithNullableToJSONTyped(value, true), 'otherProperty': value['otherProperty'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts index 1789763aaecc..813177eb3d50 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts @@ -48,10 +48,15 @@ export function ClassModelFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function ClassModelToJSON(value?: ClassModel | null): any { + export function ClassModelToJSON(json: any): ClassModel { + return ClassModelToJSONTyped(json, false); + } + + export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { '_class': value['_class'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts index 21c3a1f3b798..c6aa7163b0b3 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts @@ -48,10 +48,15 @@ export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cl }; } -export function ClientToJSON(value?: Client | null): any { + export function ClientToJSON(json: any): Client { + return ClientToJSONTyped(json, false); + } + + export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'client': value['client'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts index 38ae523f5b96..d2acf418fded 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts @@ -48,10 +48,15 @@ export function DeprecatedObjectFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function DeprecatedObjectToJSON(value?: DeprecatedObject | null): any { + export function DeprecatedObjectToJSON(json: any): DeprecatedObject { + return DeprecatedObjectToJSONTyped(json, false); + } + + export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts index 5df4d5123a82..1d66d5c04bf8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts @@ -18,6 +18,7 @@ import { AnimalFromJSON, AnimalFromJSONTyped, AnimalToJSON, + AnimalToJSONTyped, } from './Animal'; /** @@ -50,17 +51,22 @@ export function DogFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dog { return json; } return { - ...AnimalFromJSONTyped(json, ignoreDiscriminator), + ...AnimalFromJSONTyped(json, true), 'breed': json['breed'] == null ? undefined : json['breed'], }; } -export function DogToJSON(value?: Dog | null): any { + export function DogToJSON(json: any): Dog { + return DogToJSONTyped(json, false); + } + + export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { - ...AnimalToJSON(value), + ...AnimalToJSONTyped(value, true), 'breed': value['breed'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts index ddff5eeb796e..27f42e0a652b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts @@ -75,10 +75,15 @@ export function EnumArraysFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function EnumArraysToJSON(value?: EnumArrays | null): any { + export function EnumArraysToJSON(json: any): EnumArrays { + return EnumArraysToJSONTyped(json, false); + } + + export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'just_symbol': value['justSymbol'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts index c58c82e92569..6878b8591431 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts @@ -48,3 +48,7 @@ export function EnumClassToJSON(value?: EnumClass | null): any { return value as any; } +export function EnumClassToJSONTyped(value: any, ignoreDiscriminator: boolean): EnumClass { + return value as EnumClass; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts index 0ed65225ddc0..de99ab4dc662 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts @@ -18,24 +18,28 @@ import { OuterEnumFromJSON, OuterEnumFromJSONTyped, OuterEnumToJSON, + OuterEnumToJSONTyped, } from './OuterEnum'; import type { OuterEnumIntegerDefaultValue } from './OuterEnumIntegerDefaultValue'; import { OuterEnumIntegerDefaultValueFromJSON, OuterEnumIntegerDefaultValueFromJSONTyped, OuterEnumIntegerDefaultValueToJSON, + OuterEnumIntegerDefaultValueToJSONTyped, } from './OuterEnumIntegerDefaultValue'; import type { OuterEnumInteger } from './OuterEnumInteger'; import { OuterEnumIntegerFromJSON, OuterEnumIntegerFromJSONTyped, OuterEnumIntegerToJSON, + OuterEnumIntegerToJSONTyped, } from './OuterEnumInteger'; import type { OuterEnumDefaultValue } from './OuterEnumDefaultValue'; import { OuterEnumDefaultValueFromJSON, OuterEnumDefaultValueFromJSONTyped, OuterEnumDefaultValueToJSON, + OuterEnumDefaultValueToJSONTyped, } from './OuterEnumDefaultValue'; /** @@ -163,10 +167,15 @@ export function EnumTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function EnumTestToJSON(value?: EnumTest | null): any { + export function EnumTestToJSON(json: any): EnumTest { + return EnumTestToJSONTyped(json, false); + } + + export function EnumTestToJSONTyped(value?: EnumTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'enum_string': value['enumString'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts index dc65ebf50f77..5c97b9928efa 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts @@ -55,10 +55,15 @@ export function FakeBigDecimalMap200ResponseFromJSONTyped(json: any, ignoreDiscr }; } -export function FakeBigDecimalMap200ResponseToJSON(value?: FakeBigDecimalMap200Response | null): any { + export function FakeBigDecimalMap200ResponseToJSON(json: any): FakeBigDecimalMap200Response { + return FakeBigDecimalMap200ResponseToJSONTyped(json, false); + } + + export function FakeBigDecimalMap200ResponseToJSONTyped(value?: FakeBigDecimalMap200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'someId': value['someId'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts index 9da5b93a1a20..557abed7403e 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts @@ -55,10 +55,15 @@ export function FileSchemaTestClassFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function FileSchemaTestClassToJSON(value?: FileSchemaTestClass | null): any { + export function FileSchemaTestClassToJSON(json: any): FileSchemaTestClass { + return FileSchemaTestClassToJSONTyped(json, false); + } + + export function FileSchemaTestClassToJSONTyped(value?: FileSchemaTestClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'file': value['file'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts index 94845a52698d..118b6190f280 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts @@ -48,10 +48,15 @@ export function FooFromJSONTyped(json: any, ignoreDiscriminator: boolean): Foo { }; } -export function FooToJSON(value?: Foo | null): any { + export function FooToJSON(json: any): Foo { + return FooToJSONTyped(json, false); + } + + export function FooToJSONTyped(value?: Foo | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'bar': value['bar'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts index 86af8d7e7cc0..721b08a2242d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts @@ -18,6 +18,7 @@ import { FooFromJSON, FooFromJSONTyped, FooToJSON, + FooToJSONTyped, } from './Foo'; /** @@ -55,10 +56,15 @@ export function FooGetDefaultResponseFromJSONTyped(json: any, ignoreDiscriminato }; } -export function FooGetDefaultResponseToJSON(value?: FooGetDefaultResponse | null): any { + export function FooGetDefaultResponseToJSON(json: any): FooGetDefaultResponse { + return FooGetDefaultResponseToJSONTyped(json, false); + } + + export function FooGetDefaultResponseToJSONTyped(value?: FooGetDefaultResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'string': FooToJSON(value['string']), diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts index 328ec809ee95..a47a1b03c571 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts @@ -18,6 +18,7 @@ import { DecimalFromJSON, DecimalFromJSONTyped, DecimalToJSON, + DecimalToJSONTyped, } from './Decimal'; /** @@ -164,10 +165,15 @@ export function FormatTestFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function FormatTestToJSON(value?: FormatTest | null): any { + export function FormatTestToJSON(json: any): FormatTest { + return FormatTestToJSONTyped(json, false); + } + + export function FormatTestToJSONTyped(value?: FormatTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'integer': value['integer'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts index db19db8f72cf..0eb9accdc1f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts @@ -55,10 +55,15 @@ export function HasOnlyReadOnlyFromJSONTyped(json: any, ignoreDiscriminator: boo }; } -export function HasOnlyReadOnlyToJSON(value?: Omit | null): any { + export function HasOnlyReadOnlyToJSON(json: any): HasOnlyReadOnly { + return HasOnlyReadOnlyToJSONTyped(json, false); + } + + export function HasOnlyReadOnlyToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { }; diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts index c921f52f4c93..c62de4d9fb83 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts @@ -48,10 +48,15 @@ export function HealthCheckResultFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function HealthCheckResultToJSON(value?: HealthCheckResult | null): any { + export function HealthCheckResultToJSON(json: any): HealthCheckResult { + return HealthCheckResultToJSONTyped(json, false); + } + + export function HealthCheckResultToJSONTyped(value?: HealthCheckResult | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'NullableMessage': value['nullableMessage'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts index 2b979862b769..fb9a30ea0e5b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts @@ -48,10 +48,15 @@ export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List }; } -export function ListToJSON(value?: List | null): any { + export function ListToJSON(json: any): List { + return ListToJSONTyped(json, false); + } + + export function ListToJSONTyped(value?: List | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { '123-list': value['_123list'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts index 7a2a4b27fef8..a88b84fd1027 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts @@ -80,10 +80,15 @@ export function MapTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): M }; } -export function MapTestToJSON(value?: MapTest | null): any { + export function MapTestToJSON(json: any): MapTest { + return MapTestToJSONTyped(json, false); + } + + export function MapTestToJSONTyped(value?: MapTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'map_map_of_string': value['mapMapOfString'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts index 599422a3417b..1f69153ef85c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts @@ -18,6 +18,7 @@ import { AnimalFromJSON, AnimalFromJSONTyped, AnimalToJSON, + AnimalToJSONTyped, } from './Animal'; /** @@ -69,10 +70,15 @@ export function MixedPropertiesAndAdditionalPropertiesClassFromJSONTyped(json: a }; } -export function MixedPropertiesAndAdditionalPropertiesClassToJSON(value?: MixedPropertiesAndAdditionalPropertiesClass | null): any { + export function MixedPropertiesAndAdditionalPropertiesClassToJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { + return MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(json, false); + } + + export function MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(value?: MixedPropertiesAndAdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'uuid': value['uuid'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts index 31254e14b766..af0066b276eb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts @@ -55,10 +55,15 @@ export function Model200ResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function Model200ResponseToJSON(value?: Model200Response | null): any { + export function Model200ResponseToJSON(json: any): Model200Response { + return Model200ResponseToJSONTyped(json, false); + } + + export function Model200ResponseToJSONTyped(value?: Model200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts index bf92ceff548f..a505854c2d71 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts index c54577e4fc06..ef6eee2c53c7 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts @@ -48,10 +48,15 @@ export function ModelFileFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function ModelFileToJSON(value?: ModelFile | null): any { + export function ModelFileToJSON(json: any): ModelFile { + return ModelFileToJSONTyped(json, false); + } + + export function ModelFileToJSONTyped(value?: ModelFile | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'sourceURI': value['sourceURI'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts index dbcf899e8541..1c957bff4d65 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts @@ -70,10 +70,15 @@ export function NameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Name }; } -export function NameToJSON(value?: Omit | null): any { + export function NameToJSON(json: any): Name { + return NameToJSONTyped(json, false); + } + + export function NameToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts index f20a3d1c509d..4f32da1c0ced 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts @@ -127,10 +127,15 @@ export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boole }; } -export function NullableClassToJSON(value?: NullableClass | null): any { + export function NullableClassToJSON(json: any): NullableClass { + return NullableClassToJSONTyped(json, false); + } + + export function NullableClassToJSONTyped(value?: NullableClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { ...value, diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts index c778f996c1a2..d9e19a6d9d86 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts @@ -48,10 +48,15 @@ export function NumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function NumberOnlyToJSON(value?: NumberOnly | null): any { + export function NumberOnlyToJSON(json: any): NumberOnly { + return NumberOnlyToJSONTyped(json, false); + } + + export function NumberOnlyToJSONTyped(value?: NumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'JustNumber': value['justNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts index 99c4b488c489..88b028733508 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts @@ -18,6 +18,7 @@ import { DeprecatedObjectFromJSON, DeprecatedObjectFromJSONTyped, DeprecatedObjectToJSON, + DeprecatedObjectToJSONTyped, } from './DeprecatedObject'; /** @@ -79,10 +80,15 @@ export function ObjectWithDeprecatedFieldsFromJSONTyped(json: any, ignoreDiscrim }; } -export function ObjectWithDeprecatedFieldsToJSON(value?: ObjectWithDeprecatedFields | null): any { + export function ObjectWithDeprecatedFieldsToJSON(json: any): ObjectWithDeprecatedFields { + return ObjectWithDeprecatedFieldsToJSONTyped(json, false); + } + + export function ObjectWithDeprecatedFieldsToJSONTyped(value?: ObjectWithDeprecatedFields | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'uuid': value['uuid'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts index 7b83e804baad..ef82efcce508 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts index c965a360d04b..ab4303f03c3a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts @@ -62,10 +62,15 @@ export function OuterCompositeFromJSONTyped(json: any, ignoreDiscriminator: bool }; } -export function OuterCompositeToJSON(value?: OuterComposite | null): any { + export function OuterCompositeToJSON(json: any): OuterComposite { + return OuterCompositeToJSONTyped(json, false); + } + + export function OuterCompositeToJSONTyped(value?: OuterComposite | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'my_number': value['myNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts index 2c304d574003..4be9edeac589 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts @@ -48,3 +48,7 @@ export function OuterEnumToJSON(value?: OuterEnum | null): any { return value as any; } +export function OuterEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnum { + return value as OuterEnum; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts index c5aabe1ad685..de44a7878120 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts @@ -48,3 +48,7 @@ export function OuterEnumDefaultValueToJSON(value?: OuterEnumDefaultValue | null return value as any; } +export function OuterEnumDefaultValueToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnumDefaultValue { + return value as OuterEnumDefaultValue; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts index cb5a0a251509..b899dc358ea0 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts @@ -48,3 +48,7 @@ export function OuterEnumIntegerToJSON(value?: OuterEnumInteger | null): any { return value as any; } +export function OuterEnumIntegerToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnumInteger { + return value as OuterEnumInteger; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts index 1e9b73ce4956..1a6941699214 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts @@ -48,3 +48,7 @@ export function OuterEnumIntegerDefaultValueToJSON(value?: OuterEnumIntegerDefau return value as any; } +export function OuterEnumIntegerDefaultValueToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnumIntegerDefaultValue { + return value as OuterEnumIntegerDefaultValue; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts index 47e184b3414a..a533ca482d8b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts @@ -18,6 +18,7 @@ import { OuterEnumIntegerFromJSON, OuterEnumIntegerFromJSONTyped, OuterEnumIntegerToJSON, + OuterEnumIntegerToJSONTyped, } from './OuterEnumInteger'; /** @@ -58,10 +59,15 @@ export function OuterObjectWithEnumPropertyFromJSONTyped(json: any, ignoreDiscri }; } -export function OuterObjectWithEnumPropertyToJSON(value?: OuterObjectWithEnumProperty | null): any { + export function OuterObjectWithEnumPropertyToJSON(json: any): OuterObjectWithEnumProperty { + return OuterObjectWithEnumPropertyToJSONTyped(json, false); + } + + export function OuterObjectWithEnumPropertyToJSONTyped(value?: OuterObjectWithEnumProperty | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'value': OuterEnumIntegerToJSON(value['value']), 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 934f2f9d6337..a7a8016b7adc 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,7 +13,7 @@ */ import { mapValues } from '../runtime'; -import { ChildWithNullableFromJSONTyped } from './ChildWithNullable'; +import { ChildWithNullable, ChildWithNullableFromJSONTyped, ChildWithNullableToJSON, ChildWithNullableToJSONTyped } from './ChildWithNullable'; /** * * @export @@ -61,7 +61,7 @@ export function ParentWithNullableFromJSONTyped(json: any, ignoreDiscriminator: } if (!ignoreDiscriminator) { if (json['type'] === 'ChildWithNullable') { - return ChildWithNullableFromJSONTyped(json, true); + return ChildWithNullableFromJSONTyped(json, ignoreDiscriminator); } } return { @@ -71,10 +71,24 @@ export function ParentWithNullableFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function ParentWithNullableToJSON(value?: ParentWithNullable | null): any { + export function ParentWithNullableToJSON(json: any): ParentWithNullable { + return ParentWithNullableToJSONTyped(json, false); + } + + export function ParentWithNullableToJSONTyped(value?: ParentWithNullable | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + + if (!ignoreDiscriminator) { + switch (value['type']) { + case 'ChildWithNullable': + return ChildWithNullableToJSONTyped(value as ChildWithNullable, ignoreDiscriminator); + default: + throw new Error(`No variant of ParentWithNullable exists with 'type=${value['type']}'`); + } + } + return { 'type': value['type'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts index f2ad3c1ee466..bb8a56bf43f8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts index 9bd46c432fca..561b3037f5c0 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts @@ -55,10 +55,15 @@ export function ReadOnlyFirstFromJSONTyped(json: any, ignoreDiscriminator: boole }; } -export function ReadOnlyFirstToJSON(value?: Omit | null): any { + export function ReadOnlyFirstToJSON(json: any): ReadOnlyFirst { + return ReadOnlyFirstToJSONTyped(json, false); + } + + export function ReadOnlyFirstToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'baz': value['baz'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts index 3de8fb2d62be..dc1fd7c1712c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts @@ -48,10 +48,15 @@ export function ReturnFromJSONTyped(json: any, ignoreDiscriminator: boolean): Re }; } -export function ReturnToJSON(value?: Return | null): any { + export function ReturnToJSON(json: any): Return { + return ReturnToJSONTyped(json, false); + } + + export function ReturnToJSONTyped(value?: Return | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'return': value['_return'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts index 260be835d982..8247fdf99d23 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts @@ -47,3 +47,7 @@ export function SingleRefTypeToJSON(value?: SingleRefType | null): any { return value as any; } +export function SingleRefTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): SingleRefType { + return value as SingleRefType; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts index 34edcaa2f004..3fec48ea4438 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts @@ -48,10 +48,15 @@ export function SpecialModelNameFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function SpecialModelNameToJSON(value?: SpecialModelName | null): any { + export function SpecialModelNameToJSON(json: any): SpecialModelName { + return SpecialModelNameToJSONTyped(json, false); + } + + export function SpecialModelNameToJSONTyped(value?: SpecialModelName | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { '$special[property.name]': value['$specialPropertyName'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts index f0ecd59d5ba2..11266e1fb90a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts index cfe6fac4f43f..5bfdc0cfa545 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts @@ -50,10 +50,15 @@ export function TestInlineFreeformAdditionalPropertiesRequestFromJSONTyped(json: }; } -export function TestInlineFreeformAdditionalPropertiesRequestToJSON(value?: TestInlineFreeformAdditionalPropertiesRequest | null): any { + export function TestInlineFreeformAdditionalPropertiesRequestToJSON(json: any): TestInlineFreeformAdditionalPropertiesRequest { + return TestInlineFreeformAdditionalPropertiesRequestToJSONTyped(json, false); + } + + export function TestInlineFreeformAdditionalPropertiesRequestToJSONTyped(value?: TestInlineFreeformAdditionalPropertiesRequest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { ...value, diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts index 2028044d626c..97523c16bb4d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts index 54f256e339f5..b1f80cca9cd2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts index bc250bd002cb..baea7c98fece 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts index f1a3a4bb0f0a..5f0ffc2452de 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts index 476b11aa0efc..90ba76c7c496 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts index fd877416ade1..9b7b41d11e87 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts index 149be73b9ffc..54d3a2b2d69b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts index 576b5fde62da..1c4279574261 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts @@ -18,12 +18,14 @@ import { NumberEnumFromJSON, NumberEnumFromJSONTyped, NumberEnumToJSON, + NumberEnumToJSONTyped, } from './NumberEnum'; import type { StringEnum } from './StringEnum'; import { StringEnumFromJSON, StringEnumFromJSONTyped, StringEnumToJSON, + StringEnumToJSONTyped, } from './StringEnum'; /** @@ -84,10 +86,15 @@ export function EnumPatternObjectFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function EnumPatternObjectToJSON(value?: EnumPatternObject | null): any { + export function EnumPatternObjectToJSON(json: any): EnumPatternObject { + return EnumPatternObjectToJSONTyped(json, false); + } + + export function EnumPatternObjectToJSONTyped(value?: EnumPatternObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'string-enum': StringEnumToJSON(value['stringEnum']), diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts index 644637105ce5..f45e1771ea3e 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -111,10 +111,15 @@ export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, igno }; } -export function FakeEnumRequestGetInline200ResponseToJSON(value?: FakeEnumRequestGetInline200Response | null): any { + export function FakeEnumRequestGetInline200ResponseToJSON(json: any): FakeEnumRequestGetInline200Response { + return FakeEnumRequestGetInline200ResponseToJSONTyped(json, false); + } + + export function FakeEnumRequestGetInline200ResponseToJSONTyped(value?: FakeEnumRequestGetInline200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'string-enum': value['stringEnum'], diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts index 1684281cc9ad..d893f1143456 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts @@ -48,3 +48,7 @@ export function NumberEnumToJSON(value?: NumberEnum | null): any { return value as any; } +export function NumberEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): NumberEnum { + return value as NumberEnum; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts index 1b1a1f1e5ae8..172e15ef52d4 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts @@ -48,3 +48,7 @@ export function StringEnumToJSON(value?: StringEnum | null): any { return value as any; } +export function StringEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): StringEnum { + return value as StringEnum; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts index 54f256e339f5..b1f80cca9cd2 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts index bc250bd002cb..baea7c98fece 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts index f1a3a4bb0f0a..5f0ffc2452de 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts index 476b11aa0efc..90ba76c7c496 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts index fd877416ade1..9b7b41d11e87 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts index 149be73b9ffc..54d3a2b2d69b 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts index 54f256e339f5..b1f80cca9cd2 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts index bc250bd002cb..baea7c98fece 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts index f1a3a4bb0f0a..5f0ffc2452de 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts index 476b11aa0efc..90ba76c7c496 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts index fd877416ade1..9b7b41d11e87 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts index 149be73b9ffc..54d3a2b2d69b 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts index 3b54d32cb575..8fffa09116a6 100644 --- a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts +++ b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts @@ -49,10 +49,15 @@ export function TestAFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tes }; } -export function TestAToJSON(value?: TestA | null): any { + export function TestAToJSON(json: any): TestA { + return TestAToJSONTyped(json, false); + } + + export function TestAToJSONTyped(value?: TestA | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'foo': value['foo'], diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts index d40209b76d45..d8477b8db52e 100644 --- a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts +++ b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts @@ -49,10 +49,15 @@ export function TestBFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tes }; } -export function TestBToJSON(value?: TestB | null): any { + export function TestBToJSON(json: any): TestB { + return TestBToJSONTyped(json, false); + } + + export function TestBToJSONTyped(value?: TestB | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'bar': value['bar'], diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml index 1ddb5113ecf5..36f08610432c 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml @@ -53,19 +53,6 @@ - - npm-test - integration-test - - exec - - - npm - - test - - - diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts index 54f256e339f5..b1f80cca9cd2 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts index bc250bd002cb..baea7c98fece 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts index f1a3a4bb0f0a..5f0ffc2452de 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts index 476b11aa0efc..90ba76c7c496 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts index fd877416ade1..9b7b41d11e87 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts index 149be73b9ffc..54d3a2b2d69b 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts index 6792815d839d..0cb828571b67 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts @@ -48,3 +48,7 @@ export function BehaviorTypeToJSON(value?: BehaviorType | null): any { return value as any; } +export function BehaviorTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): BehaviorType { + return value as BehaviorType; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts index 54f256e339f5..b1f80cca9cd2 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts index 9e3a2d63c543..35356dee4a9b 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts @@ -18,6 +18,7 @@ import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; /** @@ -56,10 +57,15 @@ export function DefaultMetaOnlyResponseFromJSONTyped(json: any, ignoreDiscrimina }; } -export function DefaultMetaOnlyResponseToJSON(value?: DefaultMetaOnlyResponse | null): any { + export function DefaultMetaOnlyResponseToJSON(json: any): DefaultMetaOnlyResponse { + return DefaultMetaOnlyResponseToJSONTyped(json, false); + } + + export function DefaultMetaOnlyResponseToJSONTyped(value?: DefaultMetaOnlyResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts index 5ae82e7f2ef4..33f8b83b6c9a 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts @@ -57,3 +57,7 @@ export function DeploymentRequestStatusToJSON(value?: DeploymentRequestStatus | return value as any; } +export function DeploymentRequestStatusToJSONTyped(value: any, ignoreDiscriminator: boolean): DeploymentRequestStatus { + return value as DeploymentRequestStatus; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts index 7b85047567d8..43db96d9b1aa 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts @@ -63,3 +63,7 @@ export function ErrorCodeToJSON(value?: ErrorCode | null): any { return value as any; } +export function ErrorCodeToJSONTyped(value: any, ignoreDiscriminator: boolean): ErrorCode { + return value as ErrorCode; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts index 7f4307dbd771..6fd8b71f6f9d 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts @@ -18,12 +18,14 @@ import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; import type { Pet } from './Pet'; import { PetFromJSON, PetFromJSONTyped, PetToJSON, + PetToJSONTyped, } from './Pet'; /** @@ -69,10 +71,15 @@ export function FindPetsByStatusResponseFromJSONTyped(json: any, ignoreDiscrimin }; } -export function FindPetsByStatusResponseToJSON(value?: FindPetsByStatusResponse | null): any { + export function FindPetsByStatusResponseToJSON(json: any): FindPetsByStatusResponse { + return FindPetsByStatusResponseToJSONTyped(json, false); + } + + export function FindPetsByStatusResponseToJSONTyped(value?: FindPetsByStatusResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts index 31e86f68d609..66256507d9b3 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts @@ -18,12 +18,14 @@ import { UserFromJSON, UserFromJSONTyped, UserToJSON, + UserToJSONTyped, } from './User'; import type { ResponseMeta } from './ResponseMeta'; import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; /** @@ -69,10 +71,15 @@ export function FindPetsByUserResponseFromJSONTyped(json: any, ignoreDiscriminat }; } -export function FindPetsByUserResponseToJSON(value?: FindPetsByUserResponse | null): any { + export function FindPetsByUserResponseToJSON(json: any): FindPetsByUserResponse { + return FindPetsByUserResponseToJSONTyped(json, false); + } + + export function FindPetsByUserResponseToJSONTyped(value?: FindPetsByUserResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts index c001a843b0e5..3f4000b9413c 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts @@ -18,6 +18,7 @@ import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; /** @@ -63,10 +64,15 @@ export function GetBehaviorPermissionsResponseFromJSONTyped(json: any, ignoreDis }; } -export function GetBehaviorPermissionsResponseToJSON(value?: GetBehaviorPermissionsResponse | null): any { + export function GetBehaviorPermissionsResponseToJSON(json: any): GetBehaviorPermissionsResponse { + return GetBehaviorPermissionsResponseToJSONTyped(json, false); + } + + export function GetBehaviorPermissionsResponseToJSONTyped(value?: GetBehaviorPermissionsResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts index f3d8f640f8bd..a282384d2207 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts @@ -18,12 +18,14 @@ import { BehaviorTypeFromJSON, BehaviorTypeFromJSONTyped, BehaviorTypeToJSON, + BehaviorTypeToJSONTyped, } from './BehaviorType'; import type { ResponseMeta } from './ResponseMeta'; import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; /** @@ -71,10 +73,15 @@ export function GetBehaviorTypeResponseFromJSONTyped(json: any, ignoreDiscrimina }; } -export function GetBehaviorTypeResponseToJSON(value?: GetBehaviorTypeResponse | null): any { + export function GetBehaviorTypeResponseToJSON(json: any): GetBehaviorTypeResponse { + return GetBehaviorTypeResponseToJSONTyped(json, false); + } + + export function GetBehaviorTypeResponseToJSONTyped(value?: GetBehaviorTypeResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts index af60c4b351a0..255ca5f80112 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts @@ -18,12 +18,14 @@ import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; import type { MatchingParts } from './MatchingParts'; import { MatchingPartsFromJSON, MatchingPartsFromJSONTyped, MatchingPartsToJSON, + MatchingPartsToJSONTyped, } from './MatchingParts'; /** @@ -69,10 +71,15 @@ export function GetMatchingPartsResponseFromJSONTyped(json: any, ignoreDiscrimin }; } -export function GetMatchingPartsResponseToJSON(value?: GetMatchingPartsResponse | null): any { + export function GetMatchingPartsResponseToJSON(json: any): GetMatchingPartsResponse { + return GetMatchingPartsResponseToJSONTyped(json, false); + } + + export function GetMatchingPartsResponseToJSONTyped(value?: GetMatchingPartsResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts index 5e2f514633cf..e9b0c8a6c937 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts @@ -18,12 +18,14 @@ import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; import type { PetPartType } from './PetPartType'; import { PetPartTypeFromJSON, PetPartTypeFromJSONTyped, PetPartTypeToJSON, + PetPartTypeToJSONTyped, } from './PetPartType'; /** @@ -71,10 +73,15 @@ export function GetPetPartTypeResponseFromJSONTyped(json: any, ignoreDiscriminat }; } -export function GetPetPartTypeResponseToJSON(value?: GetPetPartTypeResponse | null): any { + export function GetPetPartTypeResponseToJSON(json: any): GetPetPartTypeResponse { + return GetPetPartTypeResponseToJSONTyped(json, false); + } + + export function GetPetPartTypeResponseToJSONTyped(value?: GetPetPartTypeResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts index bad63a3c68c5..93b39cd0e786 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts @@ -57,10 +57,15 @@ export function ItemIdFromJSONTyped(json: any, ignoreDiscriminator: boolean): It }; } -export function ItemIdToJSON(value?: ItemId | null): any { + export function ItemIdToJSON(json: any): ItemId { + return ItemIdToJSONTyped(json, false); + } + + export function ItemIdToJSONTyped(value?: ItemId | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts index 7f501316a407..955aefde7190 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts @@ -18,6 +18,7 @@ import { PartFromJSON, PartFromJSONTyped, PartToJSON, + PartToJSONTyped, } from './Part'; /** @@ -64,10 +65,15 @@ export function MatchingPartsFromJSONTyped(json: any, ignoreDiscriminator: boole }; } -export function MatchingPartsToJSON(value?: MatchingParts | null): any { + export function MatchingPartsToJSON(json: any): MatchingParts { + return MatchingPartsToJSONTyped(json, false); + } + + export function MatchingPartsToJSONTyped(value?: MatchingParts | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'connected': ((value['connected'] as Array).map(PartToJSON)), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts index bc250bd002cb..baea7c98fece 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts index d5b17c2160c2..5033802329ef 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts @@ -18,6 +18,7 @@ import { ItemIdFromJSON, ItemIdFromJSONTyped, ItemIdToJSON, + ItemIdToJSONTyped, } from './ItemId'; /** @@ -77,10 +78,15 @@ export function ModelErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function ModelErrorToJSON(value?: ModelError | null): any { + export function ModelErrorToJSON(json: any): ModelError { + return ModelErrorToJSONTyped(json, false); + } + + export function ModelErrorToJSONTyped(value?: ModelError | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'type': value['type'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts index f1a3a4bb0f0a..5f0ffc2452de 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts index 07f345d28df0..a9723f00da65 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts @@ -57,10 +57,15 @@ export function PartFromJSONTyped(json: any, ignoreDiscriminator: boolean): Part }; } -export function PartToJSON(value?: Part | null): any { + export function PartToJSON(json: any): Part { + return PartToJSONTyped(json, false); + } + + export function PartToJSONTyped(value?: Part | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts index b867676a4c9c..c02125e029ac 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts @@ -18,24 +18,28 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { DeploymentRequestStatus } from './DeploymentRequestStatus'; import { DeploymentRequestStatusFromJSON, DeploymentRequestStatusFromJSONTyped, DeploymentRequestStatusToJSON, + DeploymentRequestStatusToJSONTyped, } from './DeploymentRequestStatus'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; import type { WarningCode } from './WarningCode'; import { WarningCodeFromJSON, WarningCodeFromJSONTyped, WarningCodeToJSON, + WarningCodeToJSONTyped, } from './WarningCode'; /** @@ -239,10 +243,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts index 0529649ea2df..40a214555e6a 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts @@ -48,3 +48,7 @@ export function PetPartTypeToJSON(value?: PetPartType | null): any { return value as any; } +export function PetPartTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): PetPartType { + return value as PetPartType; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts index be15dff74a14..d48d53c5b557 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts @@ -18,6 +18,7 @@ import { ResponseMetaFromJSON, ResponseMetaFromJSONTyped, ResponseMetaToJSON, + ResponseMetaToJSONTyped, } from './ResponseMeta'; /** @@ -63,10 +64,15 @@ export function PetRegionsResponseFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function PetRegionsResponseToJSON(value?: PetRegionsResponse | null): any { + export function PetRegionsResponseToJSON(json: any): PetRegionsResponse { + return PetRegionsResponseToJSONTyped(json, false); + } + + export function PetRegionsResponseToJSONTyped(value?: PetRegionsResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'meta': ResponseMetaToJSON(value['meta']), diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts index 4584d592e7cc..a00d3cf10be8 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts @@ -18,6 +18,7 @@ import { ErrorCodeFromJSON, ErrorCodeFromJSONTyped, ErrorCodeToJSON, + ErrorCodeToJSONTyped, } from './ErrorCode'; /** @@ -123,10 +124,15 @@ export function ResponseMetaFromJSONTyped(json: any, ignoreDiscriminator: boolea }; } -export function ResponseMetaToJSON(value?: ResponseMeta | null): any { + export function ResponseMetaToJSON(json: any): ResponseMeta { + return ResponseMetaToJSONTyped(json, false); + } + + export function ResponseMetaToJSONTyped(value?: ResponseMeta | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts index fd877416ade1..9b7b41d11e87 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts index 17092c2c5804..32c20200e0cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts @@ -113,10 +113,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts index 2ebc7a17f0a1..16b7bb37e969 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts @@ -48,3 +48,7 @@ export function WarningCodeToJSON(value?: WarningCode | null): any { return value as any; } +export function WarningCodeToJSONTyped(value: any, ignoreDiscriminator: boolean): WarningCode { + return value as WarningCode; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts index a83efbc1155a..c15b937e8a1c 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts @@ -55,10 +55,15 @@ export function AdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscrimi }; } -export function AdditionalPropertiesClassToJSON(value?: AdditionalPropertiesClass | null): any { + export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass { + return AdditionalPropertiesClassToJSONTyped(json, false); + } + + export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'map_property': value['mapProperty'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts index 4d81b3f96989..826ea603e2db 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts @@ -18,6 +18,7 @@ import { SingleRefTypeFromJSON, SingleRefTypeFromJSONTyped, SingleRefTypeToJSON, + SingleRefTypeToJSONTyped, } from './SingleRefType'; /** @@ -64,10 +65,15 @@ export function AllOfWithSingleRefFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function AllOfWithSingleRefToJSON(value?: AllOfWithSingleRef | null): any { + export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef { + return AllOfWithSingleRefToJSONTyped(json, false); + } + + export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'username': value['username'], 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 a49466dfac66..33ad57bbe791 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,8 +13,8 @@ */ import { mapValues } from '../runtime'; -import { CatFromJSONTyped } from './Cat'; -import { DogFromJSONTyped } from './Dog'; +import { Cat, CatFromJSONTyped, CatToJSON, CatToJSONTyped } from './Cat'; +import { Dog, DogFromJSONTyped, DogToJSON, DogToJSONTyped } from './Dog'; /** * * @export @@ -53,10 +53,10 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An } if (!ignoreDiscriminator) { if (json['class_name'] === 'CAT') { - return CatFromJSONTyped(json, true); + return CatFromJSONTyped(json, ignoreDiscriminator); } if (json['class_name'] === 'DOG') { - return DogFromJSONTyped(json, true); + return DogFromJSONTyped(json, ignoreDiscriminator); } } return { @@ -66,10 +66,26 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An }; } -export function AnimalToJSON(value?: Animal | null): any { + export function AnimalToJSON(json: any): Animal { + return AnimalToJSONTyped(json, false); + } + + export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + + if (!ignoreDiscriminator) { + switch (value['className']) { + case 'CAT': + return CatToJSONTyped(value as Cat, ignoreDiscriminator); + case 'DOG': + return DogToJSONTyped(value as Dog, ignoreDiscriminator); + default: + throw new Error(`No variant of Animal exists with 'className=${value['className']}'`); + } + } + return { 'class_name': value['className'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts index dbffd74a5723..18264d15d7cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts @@ -48,10 +48,15 @@ export function ArrayOfArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscrimin }; } -export function ArrayOfArrayOfNumberOnlyToJSON(value?: ArrayOfArrayOfNumberOnly | null): any { + export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly { + return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false); + } + + export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'ArrayArrayNumber': value['arrayArrayNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts index 8029e9dd15bc..fa5c6dc5edd1 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts @@ -48,10 +48,15 @@ export function ArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function ArrayOfNumberOnlyToJSON(value?: ArrayOfNumberOnly | null): any { + export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly { + return ArrayOfNumberOnlyToJSONTyped(json, false); + } + + export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'ArrayNumber': value['arrayNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts index fefc0e842b6f..b31c80207b2f 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts @@ -18,6 +18,7 @@ import { ReadOnlyFirstFromJSON, ReadOnlyFirstFromJSONTyped, ReadOnlyFirstToJSON, + ReadOnlyFirstToJSONTyped, } from './ReadOnlyFirst'; /** @@ -69,10 +70,15 @@ export function ArrayTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function ArrayTestToJSON(value?: ArrayTest | null): any { + export function ArrayTestToJSON(json: any): ArrayTest { + return ArrayTestToJSONTyped(json, false); + } + + export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'array_of_string': value['arrayOfString'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts index f9f38b2ed71f..ace2ede88477 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts @@ -84,10 +84,15 @@ export function CapitalizationFromJSONTyped(json: any, ignoreDiscriminator: bool }; } -export function CapitalizationToJSON(value?: Capitalization | null): any { + export function CapitalizationToJSON(json: any): Capitalization { + return CapitalizationToJSONTyped(json, false); + } + + export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'smallCamel': value['smallCamel'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts index 05ffd9e8fab5..a1b44d02d26d 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts @@ -18,6 +18,7 @@ import { AnimalFromJSON, AnimalFromJSONTyped, AnimalToJSON, + AnimalToJSONTyped, } from './Animal'; /** @@ -50,17 +51,22 @@ export function CatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cat { return json; } return { - ...AnimalFromJSONTyped(json, ignoreDiscriminator), + ...AnimalFromJSONTyped(json, true), 'declawed': json['declawed'] == null ? undefined : json['declawed'], }; } -export function CatToJSON(value?: Cat | null): any { + export function CatToJSON(json: any): Cat { + return CatToJSONTyped(json, false); + } + + export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { - ...AnimalToJSON(value), + ...AnimalToJSONTyped(value, true), 'declawed': value['declawed'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts index 640b1883c524..7c8caddd4969 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts @@ -56,10 +56,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts index 1789763aaecc..813177eb3d50 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts @@ -48,10 +48,15 @@ export function ClassModelFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function ClassModelToJSON(value?: ClassModel | null): any { + export function ClassModelToJSON(json: any): ClassModel { + return ClassModelToJSONTyped(json, false); + } + + export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { '_class': value['_class'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts index 21c3a1f3b798..c6aa7163b0b3 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts @@ -48,10 +48,15 @@ export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cl }; } -export function ClientToJSON(value?: Client | null): any { + export function ClientToJSON(json: any): Client { + return ClientToJSONTyped(json, false); + } + + export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'client': value['client'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts index 38ae523f5b96..d2acf418fded 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts @@ -48,10 +48,15 @@ export function DeprecatedObjectFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function DeprecatedObjectToJSON(value?: DeprecatedObject | null): any { + export function DeprecatedObjectToJSON(json: any): DeprecatedObject { + return DeprecatedObjectToJSONTyped(json, false); + } + + export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts index 5df4d5123a82..1d66d5c04bf8 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts @@ -18,6 +18,7 @@ import { AnimalFromJSON, AnimalFromJSONTyped, AnimalToJSON, + AnimalToJSONTyped, } from './Animal'; /** @@ -50,17 +51,22 @@ export function DogFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dog { return json; } return { - ...AnimalFromJSONTyped(json, ignoreDiscriminator), + ...AnimalFromJSONTyped(json, true), 'breed': json['breed'] == null ? undefined : json['breed'], }; } -export function DogToJSON(value?: Dog | null): any { + export function DogToJSON(json: any): Dog { + return DogToJSONTyped(json, false); + } + + export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { - ...AnimalToJSON(value), + ...AnimalToJSONTyped(value, true), 'breed': value['breed'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts index ddff5eeb796e..27f42e0a652b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts @@ -75,10 +75,15 @@ export function EnumArraysFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function EnumArraysToJSON(value?: EnumArrays | null): any { + export function EnumArraysToJSON(json: any): EnumArrays { + return EnumArraysToJSONTyped(json, false); + } + + export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'just_symbol': value['justSymbol'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts index c58c82e92569..6878b8591431 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts @@ -48,3 +48,7 @@ export function EnumClassToJSON(value?: EnumClass | null): any { return value as any; } +export function EnumClassToJSONTyped(value: any, ignoreDiscriminator: boolean): EnumClass { + return value as EnumClass; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts index 0ed65225ddc0..de99ab4dc662 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts @@ -18,24 +18,28 @@ import { OuterEnumFromJSON, OuterEnumFromJSONTyped, OuterEnumToJSON, + OuterEnumToJSONTyped, } from './OuterEnum'; import type { OuterEnumIntegerDefaultValue } from './OuterEnumIntegerDefaultValue'; import { OuterEnumIntegerDefaultValueFromJSON, OuterEnumIntegerDefaultValueFromJSONTyped, OuterEnumIntegerDefaultValueToJSON, + OuterEnumIntegerDefaultValueToJSONTyped, } from './OuterEnumIntegerDefaultValue'; import type { OuterEnumInteger } from './OuterEnumInteger'; import { OuterEnumIntegerFromJSON, OuterEnumIntegerFromJSONTyped, OuterEnumIntegerToJSON, + OuterEnumIntegerToJSONTyped, } from './OuterEnumInteger'; import type { OuterEnumDefaultValue } from './OuterEnumDefaultValue'; import { OuterEnumDefaultValueFromJSON, OuterEnumDefaultValueFromJSONTyped, OuterEnumDefaultValueToJSON, + OuterEnumDefaultValueToJSONTyped, } from './OuterEnumDefaultValue'; /** @@ -163,10 +167,15 @@ export function EnumTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function EnumTestToJSON(value?: EnumTest | null): any { + export function EnumTestToJSON(json: any): EnumTest { + return EnumTestToJSONTyped(json, false); + } + + export function EnumTestToJSONTyped(value?: EnumTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'enum_string': value['enumString'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts index dc65ebf50f77..5c97b9928efa 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts @@ -55,10 +55,15 @@ export function FakeBigDecimalMap200ResponseFromJSONTyped(json: any, ignoreDiscr }; } -export function FakeBigDecimalMap200ResponseToJSON(value?: FakeBigDecimalMap200Response | null): any { + export function FakeBigDecimalMap200ResponseToJSON(json: any): FakeBigDecimalMap200Response { + return FakeBigDecimalMap200ResponseToJSONTyped(json, false); + } + + export function FakeBigDecimalMap200ResponseToJSONTyped(value?: FakeBigDecimalMap200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'someId': value['someId'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts index 9da5b93a1a20..557abed7403e 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts @@ -55,10 +55,15 @@ export function FileSchemaTestClassFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function FileSchemaTestClassToJSON(value?: FileSchemaTestClass | null): any { + export function FileSchemaTestClassToJSON(json: any): FileSchemaTestClass { + return FileSchemaTestClassToJSONTyped(json, false); + } + + export function FileSchemaTestClassToJSONTyped(value?: FileSchemaTestClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'file': value['file'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts index 94845a52698d..118b6190f280 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts @@ -48,10 +48,15 @@ export function FooFromJSONTyped(json: any, ignoreDiscriminator: boolean): Foo { }; } -export function FooToJSON(value?: Foo | null): any { + export function FooToJSON(json: any): Foo { + return FooToJSONTyped(json, false); + } + + export function FooToJSONTyped(value?: Foo | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'bar': value['bar'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts index 86af8d7e7cc0..721b08a2242d 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts @@ -18,6 +18,7 @@ import { FooFromJSON, FooFromJSONTyped, FooToJSON, + FooToJSONTyped, } from './Foo'; /** @@ -55,10 +56,15 @@ export function FooGetDefaultResponseFromJSONTyped(json: any, ignoreDiscriminato }; } -export function FooGetDefaultResponseToJSON(value?: FooGetDefaultResponse | null): any { + export function FooGetDefaultResponseToJSON(json: any): FooGetDefaultResponse { + return FooGetDefaultResponseToJSONTyped(json, false); + } + + export function FooGetDefaultResponseToJSONTyped(value?: FooGetDefaultResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'string': FooToJSON(value['string']), diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts index 328ec809ee95..a47a1b03c571 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts @@ -18,6 +18,7 @@ import { DecimalFromJSON, DecimalFromJSONTyped, DecimalToJSON, + DecimalToJSONTyped, } from './Decimal'; /** @@ -164,10 +165,15 @@ export function FormatTestFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function FormatTestToJSON(value?: FormatTest | null): any { + export function FormatTestToJSON(json: any): FormatTest { + return FormatTestToJSONTyped(json, false); + } + + export function FormatTestToJSONTyped(value?: FormatTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'integer': value['integer'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts index db19db8f72cf..0eb9accdc1f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts @@ -55,10 +55,15 @@ export function HasOnlyReadOnlyFromJSONTyped(json: any, ignoreDiscriminator: boo }; } -export function HasOnlyReadOnlyToJSON(value?: Omit | null): any { + export function HasOnlyReadOnlyToJSON(json: any): HasOnlyReadOnly { + return HasOnlyReadOnlyToJSONTyped(json, false); + } + + export function HasOnlyReadOnlyToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { }; diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts index c921f52f4c93..c62de4d9fb83 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts @@ -48,10 +48,15 @@ export function HealthCheckResultFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function HealthCheckResultToJSON(value?: HealthCheckResult | null): any { + export function HealthCheckResultToJSON(json: any): HealthCheckResult { + return HealthCheckResultToJSONTyped(json, false); + } + + export function HealthCheckResultToJSONTyped(value?: HealthCheckResult | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'NullableMessage': value['nullableMessage'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts index 2b979862b769..fb9a30ea0e5b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts @@ -48,10 +48,15 @@ export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List }; } -export function ListToJSON(value?: List | null): any { + export function ListToJSON(json: any): List { + return ListToJSONTyped(json, false); + } + + export function ListToJSONTyped(value?: List | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { '123-list': value['_123list'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts index 7a2a4b27fef8..a88b84fd1027 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts @@ -80,10 +80,15 @@ export function MapTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): M }; } -export function MapTestToJSON(value?: MapTest | null): any { + export function MapTestToJSON(json: any): MapTest { + return MapTestToJSONTyped(json, false); + } + + export function MapTestToJSONTyped(value?: MapTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'map_map_of_string': value['mapMapOfString'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts index 599422a3417b..1f69153ef85c 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts @@ -18,6 +18,7 @@ import { AnimalFromJSON, AnimalFromJSONTyped, AnimalToJSON, + AnimalToJSONTyped, } from './Animal'; /** @@ -69,10 +70,15 @@ export function MixedPropertiesAndAdditionalPropertiesClassFromJSONTyped(json: a }; } -export function MixedPropertiesAndAdditionalPropertiesClassToJSON(value?: MixedPropertiesAndAdditionalPropertiesClass | null): any { + export function MixedPropertiesAndAdditionalPropertiesClassToJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { + return MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(json, false); + } + + export function MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(value?: MixedPropertiesAndAdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'uuid': value['uuid'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts index 31254e14b766..af0066b276eb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts @@ -55,10 +55,15 @@ export function Model200ResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function Model200ResponseToJSON(value?: Model200Response | null): any { + export function Model200ResponseToJSON(json: any): Model200Response { + return Model200ResponseToJSONTyped(json, false); + } + + export function Model200ResponseToJSONTyped(value?: Model200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts index bf92ceff548f..a505854c2d71 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts index c54577e4fc06..ef6eee2c53c7 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts @@ -48,10 +48,15 @@ export function ModelFileFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function ModelFileToJSON(value?: ModelFile | null): any { + export function ModelFileToJSON(json: any): ModelFile { + return ModelFileToJSONTyped(json, false); + } + + export function ModelFileToJSONTyped(value?: ModelFile | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'sourceURI': value['sourceURI'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts index dbcf899e8541..1c957bff4d65 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts @@ -70,10 +70,15 @@ export function NameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Name }; } -export function NameToJSON(value?: Omit | null): any { + export function NameToJSON(json: any): Name { + return NameToJSONTyped(json, false); + } + + export function NameToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'name': value['name'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts index f20a3d1c509d..4f32da1c0ced 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts @@ -127,10 +127,15 @@ export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boole }; } -export function NullableClassToJSON(value?: NullableClass | null): any { + export function NullableClassToJSON(json: any): NullableClass { + return NullableClassToJSONTyped(json, false); + } + + export function NullableClassToJSONTyped(value?: NullableClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { ...value, diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts index c778f996c1a2..d9e19a6d9d86 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts @@ -48,10 +48,15 @@ export function NumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function NumberOnlyToJSON(value?: NumberOnly | null): any { + export function NumberOnlyToJSON(json: any): NumberOnly { + return NumberOnlyToJSONTyped(json, false); + } + + export function NumberOnlyToJSONTyped(value?: NumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'JustNumber': value['justNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts index 99c4b488c489..88b028733508 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts @@ -18,6 +18,7 @@ import { DeprecatedObjectFromJSON, DeprecatedObjectFromJSONTyped, DeprecatedObjectToJSON, + DeprecatedObjectToJSONTyped, } from './DeprecatedObject'; /** @@ -79,10 +80,15 @@ export function ObjectWithDeprecatedFieldsFromJSONTyped(json: any, ignoreDiscrim }; } -export function ObjectWithDeprecatedFieldsToJSON(value?: ObjectWithDeprecatedFields | null): any { + export function ObjectWithDeprecatedFieldsToJSON(json: any): ObjectWithDeprecatedFields { + return ObjectWithDeprecatedFieldsToJSONTyped(json, false); + } + + export function ObjectWithDeprecatedFieldsToJSONTyped(value?: ObjectWithDeprecatedFields | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'uuid': value['uuid'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts index 7b83e804baad..ef82efcce508 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts index c965a360d04b..ab4303f03c3a 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts @@ -62,10 +62,15 @@ export function OuterCompositeFromJSONTyped(json: any, ignoreDiscriminator: bool }; } -export function OuterCompositeToJSON(value?: OuterComposite | null): any { + export function OuterCompositeToJSON(json: any): OuterComposite { + return OuterCompositeToJSONTyped(json, false); + } + + export function OuterCompositeToJSONTyped(value?: OuterComposite | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'my_number': value['myNumber'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts index 2c304d574003..4be9edeac589 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts @@ -48,3 +48,7 @@ export function OuterEnumToJSON(value?: OuterEnum | null): any { return value as any; } +export function OuterEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnum { + return value as OuterEnum; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts index c5aabe1ad685..de44a7878120 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts @@ -48,3 +48,7 @@ export function OuterEnumDefaultValueToJSON(value?: OuterEnumDefaultValue | null return value as any; } +export function OuterEnumDefaultValueToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnumDefaultValue { + return value as OuterEnumDefaultValue; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts index cb5a0a251509..b899dc358ea0 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts @@ -48,3 +48,7 @@ export function OuterEnumIntegerToJSON(value?: OuterEnumInteger | null): any { return value as any; } +export function OuterEnumIntegerToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnumInteger { + return value as OuterEnumInteger; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts index 1e9b73ce4956..1a6941699214 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts @@ -48,3 +48,7 @@ export function OuterEnumIntegerDefaultValueToJSON(value?: OuterEnumIntegerDefau return value as any; } +export function OuterEnumIntegerDefaultValueToJSONTyped(value: any, ignoreDiscriminator: boolean): OuterEnumIntegerDefaultValue { + return value as OuterEnumIntegerDefaultValue; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts index 47e184b3414a..a533ca482d8b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts @@ -18,6 +18,7 @@ import { OuterEnumIntegerFromJSON, OuterEnumIntegerFromJSONTyped, OuterEnumIntegerToJSON, + OuterEnumIntegerToJSONTyped, } from './OuterEnumInteger'; /** @@ -58,10 +59,15 @@ export function OuterObjectWithEnumPropertyFromJSONTyped(json: any, ignoreDiscri }; } -export function OuterObjectWithEnumPropertyToJSON(value?: OuterObjectWithEnumProperty | null): any { + export function OuterObjectWithEnumPropertyToJSON(json: any): OuterObjectWithEnumProperty { + return OuterObjectWithEnumPropertyToJSONTyped(json, false); + } + + export function OuterObjectWithEnumPropertyToJSONTyped(value?: OuterObjectWithEnumProperty | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'value': OuterEnumIntegerToJSON(value['value']), diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts index f2ad3c1ee466..bb8a56bf43f8 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts index 9bd46c432fca..561b3037f5c0 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts @@ -55,10 +55,15 @@ export function ReadOnlyFirstFromJSONTyped(json: any, ignoreDiscriminator: boole }; } -export function ReadOnlyFirstToJSON(value?: Omit | null): any { + export function ReadOnlyFirstToJSON(json: any): ReadOnlyFirst { + return ReadOnlyFirstToJSONTyped(json, false); + } + + export function ReadOnlyFirstToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'baz': value['baz'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts index 3de8fb2d62be..dc1fd7c1712c 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts @@ -48,10 +48,15 @@ export function ReturnFromJSONTyped(json: any, ignoreDiscriminator: boolean): Re }; } -export function ReturnToJSON(value?: Return | null): any { + export function ReturnToJSON(json: any): Return { + return ReturnToJSONTyped(json, false); + } + + export function ReturnToJSONTyped(value?: Return | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'return': value['_return'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts index 260be835d982..8247fdf99d23 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts @@ -47,3 +47,7 @@ export function SingleRefTypeToJSON(value?: SingleRefType | null): any { return value as any; } +export function SingleRefTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): SingleRefType { + return value as SingleRefType; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts index 34edcaa2f004..3fec48ea4438 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts @@ -48,10 +48,15 @@ export function SpecialModelNameFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function SpecialModelNameToJSON(value?: SpecialModelName | null): any { + export function SpecialModelNameToJSON(json: any): SpecialModelName { + return SpecialModelNameToJSONTyped(json, false); + } + + export function SpecialModelNameToJSONTyped(value?: SpecialModelName | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { '$special[property.name]': value['$specialPropertyName'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts index f0ecd59d5ba2..11266e1fb90a 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts index 2028044d626c..97523c16bb4d 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts index a370fe006a76..93ddb7d8f62c 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts index db4c19e27f8b..51e5f5a91a4d 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts index c0c8151caa2a..fb3d41daab6a 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts @@ -97,10 +97,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { ...value, diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts index a26542a5d5e1..e1269c6caa56 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -111,10 +113,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts index 738612112f13..eefbfb792ff8 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts index c441a740d126..f12cee29181e 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts index 54f256e339f5..b1f80cca9cd2 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts index bc250bd002cb..baea7c98fece 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts index f1a3a4bb0f0a..5f0ffc2452de 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts index 476b11aa0efc..90ba76c7c496 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts index fd877416ade1..9b7b41d11e87 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts index 149be73b9ffc..54d3a2b2d69b 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts index 54f256e339f5..b1f80cca9cd2 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts @@ -55,10 +55,15 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function CategoryToJSON(value?: Category | null): any { + export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); + } + + export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts index bc250bd002cb..baea7c98fece 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts @@ -62,10 +62,15 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } -export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { + export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); + } + + export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'code': value['code'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts index f1a3a4bb0f0a..5f0ffc2452de 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts @@ -95,10 +95,15 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } -export function OrderToJSON(value?: Order | null): any { + export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); + } + + export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts index 476b11aa0efc..90ba76c7c496 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts @@ -18,12 +18,14 @@ import { CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, + CategoryToJSONTyped, } from './Category'; import type { Tag } from './Tag'; import { TagFromJSON, TagFromJSONTyped, TagToJSON, + TagToJSONTyped, } from './Tag'; /** @@ -110,10 +112,15 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } -export function PetToJSON(value?: Pet | null): any { + export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); + } + + export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts index fd877416ade1..9b7b41d11e87 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts @@ -55,10 +55,15 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } -export function TagToJSON(value?: Tag | null): any { + export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); + } + + export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts index 149be73b9ffc..54d3a2b2d69b 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts @@ -97,10 +97,15 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } -export function UserToJSON(value?: User | null): any { + export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); + } + + export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'id': value['id'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts index 576b5fde62da..1c4279574261 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts @@ -18,12 +18,14 @@ import { NumberEnumFromJSON, NumberEnumFromJSONTyped, NumberEnumToJSON, + NumberEnumToJSONTyped, } from './NumberEnum'; import type { StringEnum } from './StringEnum'; import { StringEnumFromJSON, StringEnumFromJSONTyped, StringEnumToJSON, + StringEnumToJSONTyped, } from './StringEnum'; /** @@ -84,10 +86,15 @@ export function EnumPatternObjectFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function EnumPatternObjectToJSON(value?: EnumPatternObject | null): any { + export function EnumPatternObjectToJSON(json: any): EnumPatternObject { + return EnumPatternObjectToJSONTyped(json, false); + } + + export function EnumPatternObjectToJSONTyped(value?: EnumPatternObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'string-enum': StringEnumToJSON(value['stringEnum']), diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts index fe388268b172..5822a99aa444 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts @@ -107,10 +107,15 @@ export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, igno }; } -export function FakeEnumRequestGetInline200ResponseToJSON(value?: FakeEnumRequestGetInline200Response | null): any { + export function FakeEnumRequestGetInline200ResponseToJSON(json: any): FakeEnumRequestGetInline200Response { + return FakeEnumRequestGetInline200ResponseToJSONTyped(json, false); + } + + export function FakeEnumRequestGetInline200ResponseToJSONTyped(value?: FakeEnumRequestGetInline200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } + return { 'string-enum': value['stringEnum'], diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts index 2181967c9a69..4170bf9c7c89 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts @@ -47,3 +47,7 @@ export function NumberEnumToJSON(value?: NumberEnum | null): any { return value as any; } +export function NumberEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): NumberEnum { + return value as NumberEnum; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts index bcb11c3d400b..484ec6c2e011 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts @@ -47,3 +47,7 @@ export function StringEnumToJSON(value?: StringEnum | null): any { return value as any; } +export function StringEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): StringEnum { + return value as StringEnum; +} + diff --git a/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json b/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json index 3470aabd0c3c..c8481ff22dfd 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "forceConsistentCasingInFileNames": false, "module": "commonjs", "target": "es5", "noImplicitAny": true,