From 2f54a2fb114c9310bd5e8bcc42b9a3a6fe815ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Hagstr=C3=B6m?= Date: Thu, 5 Sep 2024 16:29:44 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20for=20#15736=20[TYPESCRIPT-FETCH]=20Subcl?= =?UTF-8?q?assing=20components=20using=20discri=E2=80=A6=20(#19524)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix for #15736 [TYPESCRIPT-FETCH] Subclassing components using discriminators fails to convert subclasses to JSON. Added similar discriminator handling to ToJSON as was already in place for FromJSON. The actual files changed are typescript-fetch/modelGeneric.mustache and typescript-fetch/apis.mustache. Also, adjusted FromJSON a bit in an attempt to support multiple hierarchical levels of discriminators. And fixed an issue with calling FromJSON from the map() function, which caused the index parameter getting inadvertently passed as the ignoreDiscriminator parameter. Additionally, fixed failing "mvn integration-test -f samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml" Moreover, added forceConsistentCasingInFileNames:false into tsconfig.json to make tests compile on OsX. * Rolled back the changes related to the map() function calls in favor of using ToJSONTyped instead, as that is in line with how FromJSON is already implemented. --- .../typescript-fetch/modelEnum.mustache | 4 +++ .../typescript-fetch/modelGeneric.mustache | 29 +++++++++++++++---- .../models/AbstractUserDto.ts | 27 +++++++++++++---- .../self-import-issue/models/BranchDto.ts | 7 ++++- .../models/InternalAuthenticatedUserDto.ts | 8 ++++- .../models/RemoteAuthenticatedUserDto.ts | 8 ++++- .../builds/allOf-nullable/models/Club.ts | 8 ++++- .../builds/allOf-nullable/models/Owner.ts | 7 ++++- .../builds/allOf-readonly/models/Club.ts | 8 ++++- .../builds/allOf-readonly/models/Owner.ts | 7 ++++- .../models/AdditionalPropertiesClass.ts | 7 ++++- .../default-v3.0/models/AllOfWithSingleRef.ts | 8 ++++- .../builds/default-v3.0/models/Animal.ts | 26 +++++++++++++---- .../models/ArrayOfArrayOfNumberOnly.ts | 7 ++++- .../default-v3.0/models/ArrayOfNumberOnly.ts | 7 ++++- .../builds/default-v3.0/models/ArrayTest.ts | 8 ++++- .../default-v3.0/models/Capitalization.ts | 7 ++++- .../builds/default-v3.0/models/Cat.ts | 12 ++++++-- .../builds/default-v3.0/models/Category.ts | 7 ++++- .../default-v3.0/models/ChildWithNullable.ts | 12 ++++++-- .../builds/default-v3.0/models/ClassModel.ts | 7 ++++- .../builds/default-v3.0/models/Client.ts | 7 ++++- .../default-v3.0/models/DeprecatedObject.ts | 7 ++++- .../builds/default-v3.0/models/Dog.ts | 12 ++++++-- .../builds/default-v3.0/models/EnumArrays.ts | 7 ++++- .../builds/default-v3.0/models/EnumClass.ts | 4 +++ .../builds/default-v3.0/models/EnumTest.ts | 11 ++++++- .../models/FakeBigDecimalMap200Response.ts | 7 ++++- .../models/FileSchemaTestClass.ts | 7 ++++- .../builds/default-v3.0/models/Foo.ts | 7 ++++- .../models/FooGetDefaultResponse.ts | 8 ++++- .../builds/default-v3.0/models/FormatTest.ts | 8 ++++- .../default-v3.0/models/HasOnlyReadOnly.ts | 7 ++++- .../default-v3.0/models/HealthCheckResult.ts | 7 ++++- .../builds/default-v3.0/models/List.ts | 7 ++++- .../builds/default-v3.0/models/MapTest.ts | 7 ++++- ...dPropertiesAndAdditionalPropertiesClass.ts | 8 ++++- .../default-v3.0/models/Model200Response.ts | 7 ++++- .../default-v3.0/models/ModelApiResponse.ts | 7 ++++- .../builds/default-v3.0/models/ModelFile.ts | 7 ++++- .../builds/default-v3.0/models/Name.ts | 7 ++++- .../default-v3.0/models/NullableClass.ts | 7 ++++- .../builds/default-v3.0/models/NumberOnly.ts | 7 ++++- .../models/ObjectWithDeprecatedFields.ts | 8 ++++- .../builds/default-v3.0/models/Order.ts | 7 ++++- .../default-v3.0/models/OuterComposite.ts | 7 ++++- .../builds/default-v3.0/models/OuterEnum.ts | 4 +++ .../models/OuterEnumDefaultValue.ts | 4 +++ .../default-v3.0/models/OuterEnumInteger.ts | 4 +++ .../models/OuterEnumIntegerDefaultValue.ts | 4 +++ .../models/OuterObjectWithEnumProperty.ts | 8 ++++- .../default-v3.0/models/ParentWithNullable.ts | 20 +++++++++++-- .../builds/default-v3.0/models/Pet.ts | 9 +++++- .../default-v3.0/models/ReadOnlyFirst.ts | 7 ++++- .../builds/default-v3.0/models/Return.ts | 7 ++++- .../default-v3.0/models/SingleRefType.ts | 4 +++ .../default-v3.0/models/SpecialModelName.ts | 7 ++++- .../builds/default-v3.0/models/Tag.ts | 7 ++++- ...lineFreeformAdditionalPropertiesRequest.ts | 7 ++++- .../builds/default-v3.0/models/User.ts | 7 ++++- .../builds/default/models/Category.ts | 7 ++++- .../builds/default/models/ModelApiResponse.ts | 7 ++++- .../builds/default/models/Order.ts | 7 ++++- .../builds/default/models/Pet.ts | 9 +++++- .../builds/default/models/Tag.ts | 7 ++++- .../builds/default/models/User.ts | 7 ++++- .../builds/enum/models/EnumPatternObject.ts | 9 +++++- .../FakeEnumRequestGetInline200Response.ts | 7 ++++- .../builds/enum/models/NumberEnum.ts | 4 +++ .../builds/enum/models/StringEnum.ts | 4 +++ .../builds/es6-target/src/models/Category.ts | 7 ++++- .../es6-target/src/models/ModelApiResponse.ts | 7 ++++- .../builds/es6-target/src/models/Order.ts | 7 ++++- .../builds/es6-target/src/models/Pet.ts | 9 +++++- .../builds/es6-target/src/models/Tag.ts | 7 ++++- .../builds/es6-target/src/models/User.ts | 7 ++++- .../multiple-parameters/models/Category.ts | 7 ++++- .../models/ModelApiResponse.ts | 7 ++++- .../multiple-parameters/models/Order.ts | 7 ++++- .../builds/multiple-parameters/models/Pet.ts | 9 +++++- .../builds/multiple-parameters/models/Tag.ts | 7 ++++- .../builds/multiple-parameters/models/User.ts | 7 ++++- .../builds/oneOf/models/TestA.ts | 7 ++++- .../builds/oneOf/models/TestB.ts | 7 ++++- .../prefix-parameter-interfaces/pom.xml | 13 --------- .../src/models/Category.ts | 7 ++++- .../src/models/ModelApiResponse.ts | 7 ++++- .../src/models/Order.ts | 7 ++++- .../src/models/Pet.ts | 9 +++++- .../src/models/Tag.ts | 7 ++++- .../src/models/User.ts | 7 ++++- .../src/models/BehaviorType.ts | 4 +++ .../sagas-and-records/src/models/Category.ts | 7 ++++- .../src/models/DefaultMetaOnlyResponse.ts | 8 ++++- .../src/models/DeploymentRequestStatus.ts | 4 +++ .../sagas-and-records/src/models/ErrorCode.ts | 4 +++ .../src/models/FindPetsByStatusResponse.ts | 9 +++++- .../src/models/FindPetsByUserResponse.ts | 9 +++++- .../models/GetBehaviorPermissionsResponse.ts | 8 ++++- .../src/models/GetBehaviorTypeResponse.ts | 9 +++++- .../src/models/GetMatchingPartsResponse.ts | 9 +++++- .../src/models/GetPetPartTypeResponse.ts | 9 +++++- .../sagas-and-records/src/models/ItemId.ts | 7 ++++- .../src/models/MatchingParts.ts | 8 ++++- .../src/models/ModelApiResponse.ts | 7 ++++- .../src/models/ModelError.ts | 8 ++++- .../sagas-and-records/src/models/Order.ts | 7 ++++- .../sagas-and-records/src/models/Part.ts | 7 ++++- .../sagas-and-records/src/models/Pet.ts | 11 ++++++- .../src/models/PetPartType.ts | 4 +++ .../src/models/PetRegionsResponse.ts | 8 ++++- .../src/models/ResponseMeta.ts | 8 ++++- .../sagas-and-records/src/models/Tag.ts | 7 ++++- .../sagas-and-records/src/models/User.ts | 7 ++++- .../src/models/WarningCode.ts | 4 +++ .../models/AdditionalPropertiesClass.ts | 7 ++++- .../models/AllOfWithSingleRef.ts | 8 ++++- .../snakecase-discriminator/models/Animal.ts | 26 +++++++++++++---- .../models/ArrayOfArrayOfNumberOnly.ts | 7 ++++- .../models/ArrayOfNumberOnly.ts | 7 ++++- .../models/ArrayTest.ts | 8 ++++- .../models/Capitalization.ts | 7 ++++- .../snakecase-discriminator/models/Cat.ts | 12 ++++++-- .../models/Category.ts | 7 ++++- .../models/ClassModel.ts | 7 ++++- .../snakecase-discriminator/models/Client.ts | 7 ++++- .../models/DeprecatedObject.ts | 7 ++++- .../snakecase-discriminator/models/Dog.ts | 12 ++++++-- .../models/EnumArrays.ts | 7 ++++- .../models/EnumClass.ts | 4 +++ .../models/EnumTest.ts | 11 ++++++- .../models/FakeBigDecimalMap200Response.ts | 7 ++++- .../models/FileSchemaTestClass.ts | 7 ++++- .../snakecase-discriminator/models/Foo.ts | 7 ++++- .../models/FooGetDefaultResponse.ts | 8 ++++- .../models/FormatTest.ts | 8 ++++- .../models/HasOnlyReadOnly.ts | 7 ++++- .../models/HealthCheckResult.ts | 7 ++++- .../snakecase-discriminator/models/List.ts | 7 ++++- .../snakecase-discriminator/models/MapTest.ts | 7 ++++- ...dPropertiesAndAdditionalPropertiesClass.ts | 8 ++++- .../models/Model200Response.ts | 7 ++++- .../models/ModelApiResponse.ts | 7 ++++- .../models/ModelFile.ts | 7 ++++- .../snakecase-discriminator/models/Name.ts | 7 ++++- .../models/NullableClass.ts | 7 ++++- .../models/NumberOnly.ts | 7 ++++- .../models/ObjectWithDeprecatedFields.ts | 8 ++++- .../snakecase-discriminator/models/Order.ts | 7 ++++- .../models/OuterComposite.ts | 7 ++++- .../models/OuterEnum.ts | 4 +++ .../models/OuterEnumDefaultValue.ts | 4 +++ .../models/OuterEnumInteger.ts | 4 +++ .../models/OuterEnumIntegerDefaultValue.ts | 4 +++ .../models/OuterObjectWithEnumProperty.ts | 8 ++++- .../snakecase-discriminator/models/Pet.ts | 9 +++++- .../models/ReadOnlyFirst.ts | 7 ++++- .../snakecase-discriminator/models/Return.ts | 7 ++++- .../models/SingleRefType.ts | 4 +++ .../models/SpecialModelName.ts | 7 ++++- .../snakecase-discriminator/models/Tag.ts | 7 ++++- .../snakecase-discriminator/models/User.ts | 7 ++++- .../validation-attributes/models/Category.ts | 7 ++++- .../models/ModelApiResponse.ts | 7 ++++- .../validation-attributes/models/Order.ts | 7 ++++- .../validation-attributes/models/Pet.ts | 9 +++++- .../validation-attributes/models/Tag.ts | 7 ++++- .../validation-attributes/models/User.ts | 7 ++++- .../builds/with-interfaces/models/Category.ts | 7 ++++- .../models/ModelApiResponse.ts | 7 ++++- .../builds/with-interfaces/models/Order.ts | 7 ++++- .../builds/with-interfaces/models/Pet.ts | 9 +++++- .../builds/with-interfaces/models/Tag.ts | 7 ++++- .../builds/with-interfaces/models/User.ts | 7 ++++- .../with-npm-version/src/models/Category.ts | 7 ++++- .../src/models/ModelApiResponse.ts | 7 ++++- .../with-npm-version/src/models/Order.ts | 7 ++++- .../builds/with-npm-version/src/models/Pet.ts | 9 +++++- .../builds/with-npm-version/src/models/Tag.ts | 7 ++++- .../with-npm-version/src/models/User.ts | 7 ++++- .../models/EnumPatternObject.ts | 9 +++++- .../FakeEnumRequestGetInline200Response.ts | 7 ++++- .../with-string-enums/models/NumberEnum.ts | 4 +++ .../with-string-enums/models/StringEnum.ts | 4 +++ .../tests/default/tsconfig.json | 1 + 185 files changed, 1213 insertions(+), 202 deletions(-) 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 5bab7a5a98c..35e0303d986 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 803b27608ea..c6d384855b5 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 0b133d0c066..53bf52f50bb 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 916a5431fdb..5de31fa073f 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 9d4c6761335..14a4f768ac4 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 041a5657702..6791e2e1216 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 fade52e7172..cce6b72e169 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 58df8cbac49..0ed8fde3a93 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 c35b4f285e3..b815ab07d2c 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 58df8cbac49..0ed8fde3a93 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 a83efbc1155..c15b937e8a1 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 4d81b3f9698..826ea603e2d 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 236ba544d0d..0f87e6dd367 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 dbffd74a572..18264d15d7c 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 8029e9dd15b..fa5c6dc5edd 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 fefc0e842b6..b31c80207b2 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 f9f38b2ed71..ace2ede8847 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 05ffd9e8fab..a1b44d02d26 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 640b1883c52..7c8caddd496 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 24167b77a66..0a5dd717f20 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 1789763aaec..813177eb3d5 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 21c3a1f3b79..c6aa7163b0b 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 38ae523f5b9..d2acf418fde 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 5df4d5123a8..1d66d5c04bf 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 ddff5eeb796..27f42e0a652 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 c58c82e9256..6878b859143 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 0ed65225ddc..de99ab4dc66 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 dc65ebf50f7..5c97b9928ef 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 9da5b93a1a2..557abed7403 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 94845a52698..118b6190f28 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 86af8d7e7cc..721b08a2242 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 328ec809ee9..a47a1b03c57 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 db19db8f72c..0eb9accdc1f 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 c921f52f4c9..c62de4d9fb8 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 2b979862b76..fb9a30ea0e5 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 7a2a4b27fef..a88b84fd102 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 599422a3417..1f69153ef85 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 31254e14b76..af0066b276e 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 bf92ceff548..a505854c2d7 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 c54577e4fc0..ef6eee2c53c 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 dbcf899e854..1c957bff4d6 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 f20a3d1c509..4f32da1c0ce 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 c778f996c1a..d9e19a6d9d8 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 99c4b488c48..88b02873350 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 7b83e804baa..ef82efcce50 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 c965a360d04..ab4303f03c3 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 2c304d57400..4be9edeac58 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 c5aabe1ad68..de44a787812 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 cb5a0a25150..b899dc358ea 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 1e9b73ce495..1a694169921 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 47e184b3414..a533ca482d8 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 934f2f9d633..a7a8016b7ad 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 f2ad3c1ee46..bb8a56bf43f 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 9bd46c432fc..561b3037f5c 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 3de8fb2d62b..dc1fd7c1712 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 260be835d98..8247fdf99d2 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 34edcaa2f00..3fec48ea443 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 f0ecd59d5ba..11266e1fb90 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 cfe6fac4f43..5bfdc0cfa54 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 2028044d626..97523c16bb4 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 54f256e339f..b1f80cca9cd 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 bc250bd002c..baea7c98fec 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 f1a3a4bb0f0..5f0ffc2452d 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 476b11aa0ef..90ba76c7c49 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 fd877416ade..9b7b41d11e8 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 149be73b9ff..54d3a2b2d69 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 576b5fde62d..1c427957426 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 644637105ce..f45e1771ea3 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 1684281cc9a..d893f114345 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 1b1a1f1e5ae..172e15ef52d 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 54f256e339f..b1f80cca9cd 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 bc250bd002c..baea7c98fec 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 f1a3a4bb0f0..5f0ffc2452d 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 476b11aa0ef..90ba76c7c49 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 fd877416ade..9b7b41d11e8 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 149be73b9ff..54d3a2b2d69 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 54f256e339f..b1f80cca9cd 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 bc250bd002c..baea7c98fec 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 f1a3a4bb0f0..5f0ffc2452d 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 476b11aa0ef..90ba76c7c49 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 fd877416ade..9b7b41d11e8 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 149be73b9ff..54d3a2b2d69 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 3b54d32cb57..8fffa09116a 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 d40209b76d4..d8477b8db52 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 1ddb5113ecf..36f08610432 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 54f256e339f..b1f80cca9cd 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 bc250bd002c..baea7c98fec 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 f1a3a4bb0f0..5f0ffc2452d 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 476b11aa0ef..90ba76c7c49 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 fd877416ade..9b7b41d11e8 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 149be73b9ff..54d3a2b2d69 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 6792815d839..0cb828571b6 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 54f256e339f..b1f80cca9cd 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 9e3a2d63c54..35356dee4a9 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 5ae82e7f2ef..33f8b83b6c9 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 7b85047567d..43db96d9b1a 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 7f4307dbd77..6fd8b71f6f9 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 31e86f68d60..66256507d9b 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 c001a843b0e..3f4000b9413 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 f3d8f640f8b..a282384d220 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 af60c4b351a..255ca5f8011 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 5e2f514633c..e9b0c8a6c93 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 bad63a3c68c..93b39cd0e78 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 7f501316a40..955aefde719 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 bc250bd002c..baea7c98fec 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 d5b17c2160c..5033802329e 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 f1a3a4bb0f0..5f0ffc2452d 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 07f345d28df..a9723f00da6 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 b867676a4c9..c02125e029a 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 0529649ea2d..40a214555e6 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 be15dff74a1..d48d53c5b55 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 4584d592e7c..a00d3cf10be 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 fd877416ade..9b7b41d11e8 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 17092c2c580..32c20200e0c 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 2ebc7a17f0a..16b7bb37e96 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 a83efbc1155..c15b937e8a1 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 4d81b3f9698..826ea603e2d 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 a49466dfac6..33ad57bbe79 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 dbffd74a572..18264d15d7c 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 8029e9dd15b..fa5c6dc5edd 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 fefc0e842b6..b31c80207b2 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 f9f38b2ed71..ace2ede8847 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 05ffd9e8fab..a1b44d02d26 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 640b1883c52..7c8caddd496 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 1789763aaec..813177eb3d5 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 21c3a1f3b79..c6aa7163b0b 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 38ae523f5b9..d2acf418fde 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 5df4d5123a8..1d66d5c04bf 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 ddff5eeb796..27f42e0a652 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 c58c82e9256..6878b859143 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 0ed65225ddc..de99ab4dc66 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 dc65ebf50f7..5c97b9928ef 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 9da5b93a1a2..557abed7403 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 94845a52698..118b6190f28 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 86af8d7e7cc..721b08a2242 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 328ec809ee9..a47a1b03c57 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 db19db8f72c..0eb9accdc1f 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 c921f52f4c9..c62de4d9fb8 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 2b979862b76..fb9a30ea0e5 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 7a2a4b27fef..a88b84fd102 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 599422a3417..1f69153ef85 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 31254e14b76..af0066b276e 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 bf92ceff548..a505854c2d7 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 c54577e4fc0..ef6eee2c53c 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 dbcf899e854..1c957bff4d6 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 f20a3d1c509..4f32da1c0ce 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 c778f996c1a..d9e19a6d9d8 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 99c4b488c48..88b02873350 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 7b83e804baa..ef82efcce50 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 c965a360d04..ab4303f03c3 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 2c304d57400..4be9edeac58 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 c5aabe1ad68..de44a787812 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 cb5a0a25150..b899dc358ea 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 1e9b73ce495..1a694169921 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 47e184b3414..a533ca482d8 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 f2ad3c1ee46..bb8a56bf43f 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 9bd46c432fc..561b3037f5c 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 3de8fb2d62b..dc1fd7c1712 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 260be835d98..8247fdf99d2 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 34edcaa2f00..3fec48ea443 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 f0ecd59d5ba..11266e1fb90 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 2028044d626..97523c16bb4 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 a370fe006a7..93ddb7d8f62 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 db4c19e27f8..51e5f5a91a4 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 c0c8151caa2..fb3d41daab6 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 a26542a5d5e..e1269c6caa5 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 738612112f1..eefbfb792ff 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 c441a740d12..f12cee29181 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 54f256e339f..b1f80cca9cd 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 bc250bd002c..baea7c98fec 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 f1a3a4bb0f0..5f0ffc2452d 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 476b11aa0ef..90ba76c7c49 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 fd877416ade..9b7b41d11e8 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 149be73b9ff..54d3a2b2d69 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 54f256e339f..b1f80cca9cd 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 bc250bd002c..baea7c98fec 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 f1a3a4bb0f0..5f0ffc2452d 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 476b11aa0ef..90ba76c7c49 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 fd877416ade..9b7b41d11e8 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 149be73b9ff..54d3a2b2d69 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 576b5fde62d..1c427957426 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 fe388268b17..5822a99aa44 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 2181967c9a6..4170bf9c7c8 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 bcb11c3d400..484ec6c2e01 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 3470aabd0c3..c8481ff22df 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,