From 4ac8c2ea5f8041fa730bcb5bc0a61087e878e465 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 09:43:48 +0100 Subject: [PATCH 1/8] Use `exists()` to check for existing properties. --- .../resources/typescript-fetch/apis.mustache | 2 +- .../typescript-fetch/modelGeneric.mustache | 24 +++++++++---------- .../typescript-fetch/modelOneOf.mustache | 2 +- .../typescript-fetch/runtime.mustache | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 8daa73e2783a..e40fa8706066 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -107,7 +107,7 @@ export class {{classname}} extends runtime.BaseAPI { async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { {{#allParams}} {{#required}} - if (requestParameters.{{paramName}} === null || requestParameters.{{paramName}} === undefined) { + if (!runtime.exists(requestParameters, '{{paramName}}')) { throw new runtime.RequiredError('{{paramName}}','Required parameter requestParameters.{{paramName}} was null or undefined when calling {{nickname}}.'); } 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 6aca92401c78..ae43776ccbef 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -40,7 +40,7 @@ export function {{classname}}FromJSON(json: any): {{classname}} { export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boolean): {{classname}} { {{#hasVars}} - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } {{#discriminator}} @@ -60,10 +60,10 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole {{#vars}} {{#isPrimitiveType}} {{#isDateType}} - '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#isNullable}}json['{{baseName}}'] === null ? null : {{/isNullable}}new Date(json['{{baseName}}'])), + '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(json, '{{baseName}}') ? null : {{/isNullable}}{{/required}}new Date(json['{{baseName}}'])), {{/isDateType}} {{#isDateTimeType}} - '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#isNullable}}json['{{baseName}}'] === null ? null : {{/isNullable}}new Date(json['{{baseName}}'])), + '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(json, '{{baseName}}') ? null : {{/isNullable}}{{/required}}new Date(json['{{baseName}}'])), {{/isDateTimeType}} {{^isDateType}} {{^isDateTimeType}} @@ -74,14 +74,14 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole {{^isPrimitiveType}} {{#isArray}} {{#uniqueItems}} - '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#isNullable}}json['{{baseName}}'] === null ? null : {{/isNullable}}new Set((json['{{baseName}}'] as Array).map({{#items}}{{datatype}}{{/items}}FromJSON))), + '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}{{#required}}({{#isNullable}}!exists(json, '{{baseName}}') ? null : {{/isNullable}}{{/required}}new Set((json['{{baseName}}'] as Array).map({{#items}}{{datatype}}{{/items}}FromJSON))), {{/uniqueItems}} {{^uniqueItems}} - '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#isNullable}}json['{{baseName}}'] === null ? null : {{/isNullable}}(json['{{baseName}}'] as Array).map({{#items}}{{datatype}}{{/items}}FromJSON)), + '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(json, '{{baseName}}') ? null : {{/isNullable}}{{/required}}(json['{{baseName}}'] as Array).map({{#items}}{{datatype}}{{/items}}FromJSON)), {{/uniqueItems}} {{/isArray}} {{#isMap}} - '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#isNullable}}json['{{baseName}}'] === null ? null : {{/isNullable}}mapValues(json['{{baseName}}'], {{#items}}{{datatype}}{{/items}}FromJSON)), + '{{name}}': {{^required}}!exists(json, '{{baseName}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(json, '{{baseName}}') ? null : {{/isNullable}}{{/required}}mapValues(json['{{baseName}}'], {{#items}}{{datatype}}{{/items}}FromJSON)), {{/isMap}} {{^isArray}} {{^isMap}} @@ -119,13 +119,13 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any { {{^isReadOnly}} {{#isPrimitiveType}} {{#isDateType}} - '{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}value.{{name}}.toISOString().substring(0,10)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value.{{name}}{{#isNullable}} as any{{/isNullable}}).toISOString().substring(0,10)), {{/isDateType}} {{#isDateTimeType}} - '{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}value.{{name}}.toISOString()), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value.{{name}}{{#isNullable}} as any{{/isNullable}}).toISOString()), {{/isDateTimeType}} {{#isArray}} - '{{baseName}}': {{#uniqueItems}}{{^required}}value.{{name}} === undefined ? undefined : {{/required}}{{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}Array.from(value.{{name}} as Set){{/uniqueItems}}{{^uniqueItems}}value.{{name}}{{/uniqueItems}}, + '{{baseName}}': {{#uniqueItems}}{{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}{{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}Array.from(value.{{name}} as Set){{/uniqueItems}}{{^uniqueItems}}value.{{name}}{{/uniqueItems}}, {{/isArray}} {{^isDateType}} {{^isDateTimeType}} @@ -138,14 +138,14 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any { {{^isPrimitiveType}} {{#isArray}} {{#uniqueItems}} - '{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}Array.from(value.{{name}} as Set).map({{#items}}{{datatype}}{{/items}}ToJSON)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}Array.from(value.{{name}} as Set).map({{#items}}{{datatype}}{{/items}}ToJSON)), {{/uniqueItems}} {{^uniqueItems}} - '{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}(value.{{name}} as Array).map({{#items}}{{datatype}}{{/items}}ToJSON)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value.{{name}} as Array).map({{#items}}{{datatype}}{{/items}}ToJSON)), {{/uniqueItems}} {{/isArray}} {{#isMap}} - '{{baseName}}': {{^required}}value.{{name}} === undefined ? undefined : {{/required}}({{#isNullable}}value.{{name}} === null ? null : {{/isNullable}}mapValues(value.{{name}}, {{#items}}{{datatype}}{{/items}}ToJSON)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}mapValues(value.{{name}}, {{#items}}{{datatype}}{{/items}}ToJSON)), {{/isMap}} {{^isArray}} {{^isMap}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache index e369f5b9d12c..9e6b5d497956 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache @@ -17,7 +17,7 @@ export function {{classname}}FromJSON(json: any): {{classname}} { } export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boolean): {{classname}} { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } {{#discriminator}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache index 519050237520..224f91c193ab 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -300,7 +300,7 @@ export interface RequestOpts { } {{^withoutRuntimeChecks}} -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } From d1cf6f7fdb6a0a38f80c0a39996753259d2b1b4e Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 09:50:52 +0100 Subject: [PATCH 2/8] Generate Petstore code. --- .../builds/allOf-nullable/apis/DefaultApi.ts | 2 +- .../builds/allOf-nullable/models/Club.ts | 2 +- .../builds/allOf-nullable/models/Owner.ts | 2 +- .../builds/allOf-nullable/runtime.ts | 2 +- .../builds/allOf-readonly/apis/DefaultApi.ts | 2 +- .../builds/allOf-readonly/models/Club.ts | 2 +- .../builds/allOf-readonly/models/Owner.ts | 2 +- .../builds/allOf-readonly/runtime.ts | 2 +- .../default-v3.0/apis/AnotherFakeApi.ts | 2 +- .../builds/default-v3.0/apis/FakeApi.ts | 54 +++++++++---------- .../apis/FakeClassnameTags123Api.ts | 2 +- .../builds/default-v3.0/apis/PetApi.ts | 20 +++---- .../builds/default-v3.0/apis/StoreApi.ts | 6 +-- .../builds/default-v3.0/apis/UserApi.ts | 18 +++---- .../models/AdditionalPropertiesClass.ts | 2 +- .../default-v3.0/models/AllOfWithSingleRef.ts | 2 +- .../builds/default-v3.0/models/Animal.ts | 2 +- .../models/ArrayOfArrayOfNumberOnly.ts | 2 +- .../default-v3.0/models/ArrayOfNumberOnly.ts | 2 +- .../builds/default-v3.0/models/ArrayTest.ts | 2 +- .../default-v3.0/models/Capitalization.ts | 2 +- .../builds/default-v3.0/models/Cat.ts | 2 +- .../builds/default-v3.0/models/Category.ts | 2 +- .../default-v3.0/models/ChildWithNullable.ts | 2 +- .../builds/default-v3.0/models/ClassModel.ts | 2 +- .../builds/default-v3.0/models/Client.ts | 2 +- .../default-v3.0/models/DeprecatedObject.ts | 2 +- .../builds/default-v3.0/models/Dog.ts | 2 +- .../builds/default-v3.0/models/EnumArrays.ts | 2 +- .../builds/default-v3.0/models/EnumTest.ts | 2 +- .../models/FakeBigDecimalMap200Response.ts | 2 +- .../models/FileSchemaTestClass.ts | 2 +- .../builds/default-v3.0/models/Foo.ts | 2 +- .../models/FooGetDefaultResponse.ts | 2 +- .../builds/default-v3.0/models/FormatTest.ts | 6 +-- .../default-v3.0/models/HasOnlyReadOnly.ts | 2 +- .../default-v3.0/models/HealthCheckResult.ts | 2 +- .../builds/default-v3.0/models/List.ts | 2 +- .../builds/default-v3.0/models/MapTest.ts | 2 +- ...dPropertiesAndAdditionalPropertiesClass.ts | 6 +-- .../default-v3.0/models/Model200Response.ts | 2 +- .../default-v3.0/models/ModelApiResponse.ts | 2 +- .../builds/default-v3.0/models/ModelFile.ts | 2 +- .../builds/default-v3.0/models/Name.ts | 2 +- .../default-v3.0/models/NullableClass.ts | 10 ++-- .../builds/default-v3.0/models/NumberOnly.ts | 2 +- .../models/ObjectWithDeprecatedFields.ts | 2 +- .../builds/default-v3.0/models/Order.ts | 4 +- .../default-v3.0/models/OuterComposite.ts | 2 +- .../models/OuterObjectWithEnumProperty.ts | 2 +- .../default-v3.0/models/ParentWithNullable.ts | 2 +- .../builds/default-v3.0/models/Pet.ts | 4 +- .../default-v3.0/models/ReadOnlyFirst.ts | 2 +- .../builds/default-v3.0/models/Return.ts | 2 +- .../default-v3.0/models/SpecialModelName.ts | 2 +- .../builds/default-v3.0/models/Tag.ts | 2 +- ...lineFreeformAdditionalPropertiesRequest.ts | 2 +- .../builds/default-v3.0/models/User.ts | 2 +- .../builds/default-v3.0/runtime.ts | 2 +- .../builds/default/apis/PetApi.ts | 16 +++--- .../builds/default/apis/StoreApi.ts | 6 +-- .../builds/default/apis/UserApi.ts | 18 +++---- .../builds/default/models/Category.ts | 2 +- .../builds/default/models/ModelApiResponse.ts | 2 +- .../builds/default/models/Order.ts | 4 +- .../builds/default/models/Pet.ts | 4 +- .../builds/default/models/Tag.ts | 2 +- .../builds/default/models/User.ts | 2 +- .../builds/default/runtime.ts | 2 +- .../builds/enum/models/EnumPatternObject.ts | 2 +- .../FakeEnumRequestGetInline200Response.ts | 2 +- .../typescript-fetch/builds/enum/runtime.ts | 2 +- .../builds/es6-target/src/apis/PetApi.ts | 16 +++--- .../builds/es6-target/src/apis/StoreApi.ts | 6 +-- .../builds/es6-target/src/apis/UserApi.ts | 18 +++---- .../builds/es6-target/src/models/Category.ts | 2 +- .../es6-target/src/models/ModelApiResponse.ts | 2 +- .../builds/es6-target/src/models/Order.ts | 4 +- .../builds/es6-target/src/models/Pet.ts | 4 +- .../builds/es6-target/src/models/Tag.ts | 2 +- .../builds/es6-target/src/models/User.ts | 2 +- .../builds/es6-target/src/runtime.ts | 2 +- .../builds/multiple-parameters/apis/PetApi.ts | 16 +++--- .../multiple-parameters/apis/StoreApi.ts | 6 +-- .../multiple-parameters/apis/UserApi.ts | 18 +++---- .../multiple-parameters/models/Category.ts | 2 +- .../models/ModelApiResponse.ts | 2 +- .../multiple-parameters/models/Order.ts | 4 +- .../builds/multiple-parameters/models/Pet.ts | 4 +- .../builds/multiple-parameters/models/Tag.ts | 2 +- .../builds/multiple-parameters/models/User.ts | 2 +- .../builds/multiple-parameters/runtime.ts | 2 +- .../src/apis/PetApi.ts | 16 +++--- .../src/apis/StoreApi.ts | 6 +-- .../src/apis/UserApi.ts | 18 +++---- .../src/models/Category.ts | 2 +- .../src/models/ModelApiResponse.ts | 2 +- .../src/models/Order.ts | 4 +- .../src/models/Pet.ts | 4 +- .../src/models/Tag.ts | 2 +- .../src/models/User.ts | 2 +- .../src/runtime.ts | 2 +- .../sagas-and-records/src/apis/BehaviorApi.ts | 4 +- .../sagas-and-records/src/apis/PetApi.ts | 26 ++++----- .../sagas-and-records/src/apis/PetPartApi.ts | 10 ++-- .../sagas-and-records/src/apis/StoreApi.ts | 6 +-- .../sagas-and-records/src/apis/UserApi.ts | 18 +++---- .../sagas-and-records/src/models/Category.ts | 2 +- .../src/models/DefaultMetaOnlyResponse.ts | 2 +- .../src/models/FindPetsByStatusResponse.ts | 4 +- .../src/models/FindPetsByUserResponse.ts | 4 +- .../models/GetBehaviorPermissionsResponse.ts | 2 +- .../src/models/GetBehaviorTypeResponse.ts | 2 +- .../src/models/GetMatchingPartsResponse.ts | 2 +- .../src/models/GetPetPartTypeResponse.ts | 2 +- .../sagas-and-records/src/models/ItemId.ts | 2 +- .../src/models/MatchingParts.ts | 2 +- .../src/models/ModelApiResponse.ts | 2 +- .../src/models/ModelError.ts | 2 +- .../sagas-and-records/src/models/Order.ts | 4 +- .../sagas-and-records/src/models/Part.ts | 2 +- .../sagas-and-records/src/models/Pet.ts | 6 +-- .../src/models/PetRegionsResponse.ts | 2 +- .../src/models/ResponseMeta.ts | 2 +- .../sagas-and-records/src/models/Tag.ts | 2 +- .../sagas-and-records/src/models/User.ts | 2 +- .../builds/sagas-and-records/src/runtime.ts | 2 +- .../apis/AnotherFakeApi.ts | 2 +- .../snakecase-discriminator/apis/FakeApi.ts | 46 ++++++++-------- .../apis/FakeClassnameTags123Api.ts | 2 +- .../snakecase-discriminator/apis/PetApi.ts | 20 +++---- .../snakecase-discriminator/apis/StoreApi.ts | 6 +-- .../snakecase-discriminator/apis/UserApi.ts | 18 +++---- .../models/AdditionalPropertiesClass.ts | 2 +- .../models/AllOfWithSingleRef.ts | 2 +- .../snakecase-discriminator/models/Animal.ts | 2 +- .../models/ArrayOfArrayOfNumberOnly.ts | 2 +- .../models/ArrayOfNumberOnly.ts | 2 +- .../models/ArrayTest.ts | 2 +- .../models/Capitalization.ts | 2 +- .../snakecase-discriminator/models/Cat.ts | 2 +- .../models/Category.ts | 2 +- .../models/ClassModel.ts | 2 +- .../snakecase-discriminator/models/Client.ts | 2 +- .../models/DeprecatedObject.ts | 2 +- .../snakecase-discriminator/models/Dog.ts | 2 +- .../models/EnumArrays.ts | 2 +- .../models/EnumTest.ts | 2 +- .../models/FakeBigDecimalMap200Response.ts | 2 +- .../models/FileSchemaTestClass.ts | 2 +- .../snakecase-discriminator/models/Foo.ts | 2 +- .../models/FooGetDefaultResponse.ts | 2 +- .../models/FormatTest.ts | 6 +-- .../models/HasOnlyReadOnly.ts | 2 +- .../models/HealthCheckResult.ts | 2 +- .../snakecase-discriminator/models/List.ts | 2 +- .../snakecase-discriminator/models/MapTest.ts | 2 +- ...dPropertiesAndAdditionalPropertiesClass.ts | 6 +-- .../models/Model200Response.ts | 2 +- .../models/ModelApiResponse.ts | 2 +- .../models/ModelFile.ts | 2 +- .../snakecase-discriminator/models/Name.ts | 2 +- .../models/NullableClass.ts | 10 ++-- .../models/NumberOnly.ts | 2 +- .../models/ObjectWithDeprecatedFields.ts | 2 +- .../snakecase-discriminator/models/Order.ts | 4 +- .../models/OuterComposite.ts | 2 +- .../models/OuterObjectWithEnumProperty.ts | 2 +- .../snakecase-discriminator/models/Pet.ts | 4 +- .../models/ReadOnlyFirst.ts | 2 +- .../snakecase-discriminator/models/Return.ts | 2 +- .../models/SpecialModelName.ts | 2 +- .../snakecase-discriminator/models/Tag.ts | 2 +- .../snakecase-discriminator/models/User.ts | 2 +- .../builds/snakecase-discriminator/runtime.ts | 2 +- .../builds/with-interfaces/apis/PetApi.ts | 16 +++--- .../builds/with-interfaces/apis/StoreApi.ts | 6 +-- .../builds/with-interfaces/apis/UserApi.ts | 18 +++---- .../builds/with-interfaces/models/Category.ts | 2 +- .../models/ModelApiResponse.ts | 2 +- .../builds/with-interfaces/models/Order.ts | 4 +- .../builds/with-interfaces/models/Pet.ts | 4 +- .../builds/with-interfaces/models/Tag.ts | 2 +- .../builds/with-interfaces/models/User.ts | 2 +- .../builds/with-interfaces/runtime.ts | 2 +- .../with-npm-version/src/apis/PetApi.ts | 16 +++--- .../with-npm-version/src/apis/StoreApi.ts | 6 +-- .../with-npm-version/src/apis/UserApi.ts | 18 +++---- .../with-npm-version/src/models/Category.ts | 2 +- .../src/models/ModelApiResponse.ts | 2 +- .../with-npm-version/src/models/Order.ts | 4 +- .../builds/with-npm-version/src/models/Pet.ts | 4 +- .../builds/with-npm-version/src/models/Tag.ts | 2 +- .../with-npm-version/src/models/User.ts | 2 +- .../builds/with-npm-version/src/runtime.ts | 2 +- .../models/EnumPatternObject.ts | 2 +- .../FakeEnumRequestGetInline200Response.ts | 2 +- .../builds/with-string-enums/runtime.ts | 2 +- .../without-runtime-checks/src/apis/PetApi.ts | 16 +++--- .../src/apis/StoreApi.ts | 6 +-- .../src/apis/UserApi.ts | 18 +++---- 201 files changed, 470 insertions(+), 470 deletions(-) diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts index c682b272ac58..9b56d7764afc 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts @@ -34,7 +34,7 @@ export class DefaultApi extends runtime.BaseAPI { /** */ async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.personId === null || requestParameters.personId === undefined) { + if (!runtime.exists(requestParameters, 'personId')) { throw new runtime.RequiredError('personId','Required parameter requestParameters.personId was null or undefined when calling list.'); } 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 99826741f46f..c4592a9a3834 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 @@ -48,7 +48,7 @@ export function ClubFromJSON(json: any): Club { } export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 70542125af99..1e309ea8dab6 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 @@ -41,7 +41,7 @@ export function OwnerFromJSON(json: any): Owner { } export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Owner { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts index 0261d445a96c..a2c3d39c60ef 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts index c682b272ac58..9b56d7764afc 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts @@ -34,7 +34,7 @@ export class DefaultApi extends runtime.BaseAPI { /** */ async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.personId === null || requestParameters.personId === undefined) { + if (!runtime.exists(requestParameters, 'personId')) { throw new runtime.RequiredError('personId','Required parameter requestParameters.personId was null or undefined when calling list.'); } 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 d2e709009000..45e45b1a2eac 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 @@ -48,7 +48,7 @@ export function ClubFromJSON(json: any): Club { } export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } 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 70542125af99..1e309ea8dab6 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 @@ -41,7 +41,7 @@ export function OwnerFromJSON(json: any): Owner { } export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Owner { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts index 0261d445a96c..a2c3d39c60ef 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts index 4248cc6d062e..73394ee15281 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts @@ -36,7 +36,7 @@ export class AnotherFakeApi extends runtime.BaseAPI { * To test special tags */ async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.client === null || requestParameters.client === undefined) { + if (!runtime.exists(requestParameters, 'client')) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling _123testSpecialTags.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts index 7d5dc1d02760..d3ae945edd1d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts @@ -229,7 +229,7 @@ export class FakeApi extends runtime.BaseAPI { * test http signature authentication */ async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pet === null || requestParameters.pet === undefined) { + if (!runtime.exists(requestParameters, 'pet')) { throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling fakeHttpSignatureTest.'); } @@ -397,7 +397,7 @@ export class FakeApi extends runtime.BaseAPI { * Test serialization of enum (int) properties with examples */ async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.outerObjectWithEnumProperty === null || requestParameters.outerObjectWithEnumProperty === undefined) { + if (!runtime.exists(requestParameters, 'outerObjectWithEnumProperty')) { throw new runtime.RequiredError('outerObjectWithEnumProperty','Required parameter requestParameters.outerObjectWithEnumProperty was null or undefined when calling fakePropertyEnumIntegerSerialize.'); } @@ -431,7 +431,7 @@ export class FakeApi extends runtime.BaseAPI { * test referenced additionalProperties */ async testAdditionalPropertiesReferenceRaw(requestParameters: TestAdditionalPropertiesReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) { + if (!runtime.exists(requestParameters, 'requestBody')) { throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testAdditionalPropertiesReference.'); } @@ -464,7 +464,7 @@ export class FakeApi extends runtime.BaseAPI { * For this test, the body has to be a binary file. */ async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling testBodyWithBinary.'); } @@ -496,7 +496,7 @@ export class FakeApi extends runtime.BaseAPI { * For this test, the body for this request must reference a schema named `File`. */ async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.fileSchemaTestClass === null || requestParameters.fileSchemaTestClass === undefined) { + if (!runtime.exists(requestParameters, 'fileSchemaTestClass')) { throw new runtime.RequiredError('fileSchemaTestClass','Required parameter requestParameters.fileSchemaTestClass was null or undefined when calling testBodyWithFileSchema.'); } @@ -527,11 +527,11 @@ export class FakeApi extends runtime.BaseAPI { /** */ async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.query === null || requestParameters.query === undefined) { + if (!runtime.exists(requestParameters, 'query')) { throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling testBodyWithQueryParams.'); } - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling testBodyWithQueryParams.'); } @@ -567,7 +567,7 @@ export class FakeApi extends runtime.BaseAPI { * To test \"client\" model */ async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.client === null || requestParameters.client === undefined) { + if (!runtime.exists(requestParameters, 'client')) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClientModel.'); } @@ -602,19 +602,19 @@ export class FakeApi extends runtime.BaseAPI { * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 */ async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.number === null || requestParameters.number === undefined) { + if (!runtime.exists(requestParameters, 'number')) { throw new runtime.RequiredError('number','Required parameter requestParameters.number was null or undefined when calling testEndpointParameters.'); } - if (requestParameters._double === null || requestParameters._double === undefined) { + if (!runtime.exists(requestParameters, '_double')) { throw new runtime.RequiredError('_double','Required parameter requestParameters._double was null or undefined when calling testEndpointParameters.'); } - if (requestParameters.patternWithoutDelimiter === null || requestParameters.patternWithoutDelimiter === undefined) { + if (!runtime.exists(requestParameters, 'patternWithoutDelimiter')) { throw new runtime.RequiredError('patternWithoutDelimiter','Required parameter requestParameters.patternWithoutDelimiter was null or undefined when calling testEndpointParameters.'); } - if (requestParameters._byte === null || requestParameters._byte === undefined) { + if (!runtime.exists(requestParameters, '_byte')) { throw new runtime.RequiredError('_byte','Required parameter requestParameters._byte was null or undefined when calling testEndpointParameters.'); } @@ -799,15 +799,15 @@ export class FakeApi extends runtime.BaseAPI { * Fake endpoint to test group parameters (optional) */ async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.requiredStringGroup === null || requestParameters.requiredStringGroup === undefined) { + if (!runtime.exists(requestParameters, 'requiredStringGroup')) { throw new runtime.RequiredError('requiredStringGroup','Required parameter requestParameters.requiredStringGroup was null or undefined when calling testGroupParameters.'); } - if (requestParameters.requiredBooleanGroup === null || requestParameters.requiredBooleanGroup === undefined) { + if (!runtime.exists(requestParameters, 'requiredBooleanGroup')) { throw new runtime.RequiredError('requiredBooleanGroup','Required parameter requestParameters.requiredBooleanGroup was null or undefined when calling testGroupParameters.'); } - if (requestParameters.requiredInt64Group === null || requestParameters.requiredInt64Group === undefined) { + if (!runtime.exists(requestParameters, 'requiredInt64Group')) { throw new runtime.RequiredError('requiredInt64Group','Required parameter requestParameters.requiredInt64Group was null or undefined when calling testGroupParameters.'); } @@ -870,7 +870,7 @@ export class FakeApi extends runtime.BaseAPI { * test inline additionalProperties */ async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) { + if (!runtime.exists(requestParameters, 'requestBody')) { throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testInlineAdditionalProperties.'); } @@ -904,7 +904,7 @@ export class FakeApi extends runtime.BaseAPI { * test inline free-form additionalProperties */ async testInlineFreeformAdditionalPropertiesRaw(requestParameters: TestInlineFreeformAdditionalPropertiesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.testInlineFreeformAdditionalPropertiesRequest === null || requestParameters.testInlineFreeformAdditionalPropertiesRequest === undefined) { + if (!runtime.exists(requestParameters, 'testInlineFreeformAdditionalPropertiesRequest')) { throw new runtime.RequiredError('testInlineFreeformAdditionalPropertiesRequest','Required parameter requestParameters.testInlineFreeformAdditionalPropertiesRequest was null or undefined when calling testInlineFreeformAdditionalProperties.'); } @@ -938,11 +938,11 @@ export class FakeApi extends runtime.BaseAPI { * test json serialization of form data */ async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.param === null || requestParameters.param === undefined) { + if (!runtime.exists(requestParameters, 'param')) { throw new runtime.RequiredError('param','Required parameter requestParameters.param was null or undefined when calling testJsonFormData.'); } - if (requestParameters.param2 === null || requestParameters.param2 === undefined) { + if (!runtime.exists(requestParameters, 'param2')) { throw new runtime.RequiredError('param2','Required parameter requestParameters.param2 was null or undefined when calling testJsonFormData.'); } @@ -996,7 +996,7 @@ export class FakeApi extends runtime.BaseAPI { * test nullable parent property */ async testNullableRaw(requestParameters: TestNullableRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.childWithNullable === null || requestParameters.childWithNullable === undefined) { + if (!runtime.exists(requestParameters, 'childWithNullable')) { throw new runtime.RequiredError('childWithNullable','Required parameter requestParameters.childWithNullable was null or undefined when calling testNullable.'); } @@ -1029,27 +1029,27 @@ export class FakeApi extends runtime.BaseAPI { * To test the collection format in query parameters */ async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pipe === null || requestParameters.pipe === undefined) { + if (!runtime.exists(requestParameters, 'pipe')) { throw new runtime.RequiredError('pipe','Required parameter requestParameters.pipe was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.ioutil === null || requestParameters.ioutil === undefined) { + if (!runtime.exists(requestParameters, 'ioutil')) { throw new runtime.RequiredError('ioutil','Required parameter requestParameters.ioutil was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.http === null || requestParameters.http === undefined) { + if (!runtime.exists(requestParameters, 'http')) { throw new runtime.RequiredError('http','Required parameter requestParameters.http was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.url === null || requestParameters.url === undefined) { + if (!runtime.exists(requestParameters, 'url')) { throw new runtime.RequiredError('url','Required parameter requestParameters.url was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.context === null || requestParameters.context === undefined) { + if (!runtime.exists(requestParameters, 'context')) { throw new runtime.RequiredError('context','Required parameter requestParameters.context was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.allowEmpty === null || requestParameters.allowEmpty === undefined) { + if (!runtime.exists(requestParameters, 'allowEmpty')) { throw new runtime.RequiredError('allowEmpty','Required parameter requestParameters.allowEmpty was null or undefined when calling testQueryParameterCollectionFormat.'); } @@ -1107,7 +1107,7 @@ export class FakeApi extends runtime.BaseAPI { * test referenced string map */ async testStringMapReferenceRaw(requestParameters: TestStringMapReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) { + if (!runtime.exists(requestParameters, 'requestBody')) { throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testStringMapReference.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts index e6f3fd1f0b96..6f599cb8c493 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts @@ -36,7 +36,7 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { * To test class name in snake case */ async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.client === null || requestParameters.client === undefined) { + if (!runtime.exists(requestParameters, 'client')) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClassname.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts index 354aac42bbf8..a2ed0b2a20b4 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts @@ -78,7 +78,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pet === null || requestParameters.pet === undefined) { + if (!runtime.exists(requestParameters, 'pet')) { throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling addPet.'); } @@ -117,7 +117,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -157,7 +157,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -199,7 +199,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -241,7 +241,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -277,7 +277,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pet === null || requestParameters.pet === undefined) { + if (!runtime.exists(requestParameters, 'pet')) { throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling updatePet.'); } @@ -316,7 +316,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -375,7 +375,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } @@ -437,11 +437,11 @@ export class PetApi extends runtime.BaseAPI { * uploads an image (required) */ async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFileWithRequiredFile.'); } - if (requestParameters.requiredFile === null || requestParameters.requiredFile === undefined) { + if (!runtime.exists(requestParameters, 'requiredFile')) { throw new runtime.RequiredError('requiredFile','Required parameter requestParameters.requiredFile was null or undefined when calling uploadFileWithRequiredFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts index 3b17a1d7bb0d..433a2289bd4d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -139,7 +139,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.order === null || requestParameters.order === undefined) { + if (!runtime.exists(requestParameters, 'order')) { throw new runtime.RequiredError('order','Required parameter requestParameters.order was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts index df5c8f4efcd4..490810fdb119 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts @@ -62,7 +62,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUser.'); } @@ -96,7 +96,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithArrayInput.'); } @@ -130,7 +130,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithListInput.'); } @@ -164,7 +164,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -195,7 +195,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -227,11 +227,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -302,11 +302,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling updateUser.'); } 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 ae1161178dbc..77f5d8b800e6 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 @@ -47,7 +47,7 @@ export function AdditionalPropertiesClassFromJSON(json: any): AdditionalProperti } export function AdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdditionalPropertiesClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 13958e2ab77f..8e796d9f1920 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 @@ -54,7 +54,7 @@ export function AllOfWithSingleRefFromJSON(json: any): AllOfWithSingleRef { } export function AllOfWithSingleRefFromJSONTyped(json: any, ignoreDiscriminator: boolean): AllOfWithSingleRef { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 23ac499698ea..96865ae33f74 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 @@ -53,7 +53,7 @@ export function AnimalFromJSON(json: any): Animal { } export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): Animal { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } if (!ignoreDiscriminator) { 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 7ab12458982f..93dbe901e11e 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 @@ -41,7 +41,7 @@ export function ArrayOfArrayOfNumberOnlyFromJSON(json: any): ArrayOfArrayOfNumbe } export function ArrayOfArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ArrayOfArrayOfNumberOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 e0bdb81203b7..df1fdeeb9dd0 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 @@ -41,7 +41,7 @@ export function ArrayOfNumberOnlyFromJSON(json: any): ArrayOfNumberOnly { } export function ArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ArrayOfNumberOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 30473cdc6562..0558f27a2f6e 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 @@ -60,7 +60,7 @@ export function ArrayTestFromJSON(json: any): ArrayTest { } export function ArrayTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ArrayTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 53fec91847d2..6f06900a3437 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 @@ -72,7 +72,7 @@ export function CapitalizationFromJSON(json: any): Capitalization { } export function CapitalizationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Capitalization { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 dabeedf26255..325b72549b57 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 @@ -48,7 +48,7 @@ export function CatFromJSON(json: any): Cat { } export function CatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cat { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 d1e2e3f8ac8e..f05f090bf335 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 @@ -48,7 +48,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 4f53b0070e4b..2640a539c3b4 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 @@ -50,7 +50,7 @@ export function ChildWithNullableFromJSON(json: any): ChildWithNullable { } export function ChildWithNullableFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChildWithNullable { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0f01d81b15a6..f01f13e44796 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 @@ -41,7 +41,7 @@ export function ClassModelFromJSON(json: any): ClassModel { } export function ClassModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): ClassModel { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 a9fd27b4f464..961b449ca3ef 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 @@ -41,7 +41,7 @@ export function ClientFromJSON(json: any): Client { } export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Client { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0cec2d09297d..65e56c1313b5 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 @@ -41,7 +41,7 @@ export function DeprecatedObjectFromJSON(json: any): DeprecatedObject { } export function DeprecatedObjectFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeprecatedObject { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 65cd613eae03..72fcebd1e5d6 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 @@ -48,7 +48,7 @@ export function DogFromJSON(json: any): Dog { } export function DogFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dog { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 9603be51cd51..56fdfaf91e55 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 @@ -67,7 +67,7 @@ export function EnumArraysFromJSON(json: any): EnumArrays { } export function EnumArraysFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnumArrays { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 69e7d4c0217c..e6067424d707 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 @@ -149,7 +149,7 @@ export function EnumTestFromJSON(json: any): EnumTest { } export function EnumTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnumTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 32154096ade4..b246a7fb0038 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 @@ -47,7 +47,7 @@ export function FakeBigDecimalMap200ResponseFromJSON(json: any): FakeBigDecimalM } export function FakeBigDecimalMap200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FakeBigDecimalMap200Response { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 71f887cf3271..c891873688e6 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 @@ -47,7 +47,7 @@ export function FileSchemaTestClassFromJSON(json: any): FileSchemaTestClass { } export function FileSchemaTestClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): FileSchemaTestClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 aa5b331c3b68..c642344ac96f 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 @@ -41,7 +41,7 @@ export function FooFromJSON(json: any): Foo { } export function FooFromJSONTyped(json: any, ignoreDiscriminator: boolean): Foo { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 3d49ed834fc6..bb198b05b7bc 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 @@ -48,7 +48,7 @@ export function FooGetDefaultResponseFromJSON(json: any): FooGetDefaultResponse } export function FooGetDefaultResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FooGetDefaultResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f095016dd22f..43e8ef88e3ad 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 @@ -142,7 +142,7 @@ export function FormatTestFromJSON(json: any): FormatTest { } export function FormatTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): FormatTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -185,8 +185,8 @@ export function FormatTestToJSON(value?: FormatTest | null): any { 'string': value.string, 'byte': value._byte, 'binary': value.binary, - 'date': (value.date.toISOString().substring(0,10)), - 'dateTime': value.dateTime === undefined ? undefined : (value.dateTime.toISOString()), + 'date': ((value.date).toISOString().substring(0,10)), + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), 'uuid': value.uuid, 'password': value.password, 'pattern_with_digits': value.patternWithDigits, 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 d3dc4be6767e..cbda481a9c64 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 @@ -47,7 +47,7 @@ export function HasOnlyReadOnlyFromJSON(json: any): HasOnlyReadOnly { } export function HasOnlyReadOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): HasOnlyReadOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } 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 d62e1f09b823..2470c4717626 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 @@ -41,7 +41,7 @@ export function HealthCheckResultFromJSON(json: any): HealthCheckResult { } export function HealthCheckResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): HealthCheckResult { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 1334322e823a..eaf10ce2ace8 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 @@ -41,7 +41,7 @@ export function ListFromJSON(json: any): List { } export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 2ae39dd903f1..edce7e732176 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 @@ -70,7 +70,7 @@ export function MapTestFromJSON(json: any): MapTest { } export function MapTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): MapTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 56e0a29e437d..3e5119bad70e 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 @@ -60,7 +60,7 @@ export function MixedPropertiesAndAdditionalPropertiesClassFromJSON(json: any): } export function MixedPropertiesAndAdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): MixedPropertiesAndAdditionalPropertiesClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -81,8 +81,8 @@ export function MixedPropertiesAndAdditionalPropertiesClassToJSON(value?: MixedP return { 'uuid': value.uuid, - 'dateTime': value.dateTime === undefined ? undefined : (value.dateTime.toISOString()), - 'map': value.map === undefined ? undefined : (mapValues(value.map, AnimalToJSON)), + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), + 'map': !exists(value, 'map') ? undefined : (mapValues(value.map, AnimalToJSON)), }; } 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 8b32d414747a..079eb5089f44 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 @@ -47,7 +47,7 @@ export function Model200ResponseFromJSON(json: any): Model200Response { } export function Model200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): Model200Response { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 8001d49c55bf..26a56914ea84 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 9d269ea77a1c..093f1fc04ed7 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 @@ -41,7 +41,7 @@ export function ModelFileFromJSON(json: any): ModelFile { } export function ModelFileFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelFile { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f58a563b8b5f..994a87066062 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 @@ -60,7 +60,7 @@ export function NameFromJSON(json: any): Name { } export function NameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Name { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 52e1a2171642..f7fadc861af9 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 @@ -108,7 +108,7 @@ export function NullableClassFromJSON(json: any): NullableClass { } export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): NullableClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -118,8 +118,8 @@ export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boole 'numberProp': !exists(json, 'number_prop') ? undefined : json['number_prop'], 'booleanProp': !exists(json, 'boolean_prop') ? undefined : json['boolean_prop'], 'stringProp': !exists(json, 'string_prop') ? undefined : json['string_prop'], - 'dateProp': !exists(json, 'date_prop') ? undefined : (json['date_prop'] === null ? null : new Date(json['date_prop'])), - 'datetimeProp': !exists(json, 'datetime_prop') ? undefined : (json['datetime_prop'] === null ? null : new Date(json['datetime_prop'])), + 'dateProp': !exists(json, 'date_prop') ? undefined : (new Date(json['date_prop'])), + 'datetimeProp': !exists(json, 'datetime_prop') ? undefined : (new Date(json['datetime_prop'])), 'arrayNullableProp': !exists(json, 'array_nullable_prop') ? undefined : json['array_nullable_prop'], 'arrayAndItemsNullableProp': !exists(json, 'array_and_items_nullable_prop') ? undefined : json['array_and_items_nullable_prop'], 'arrayItemsNullable': !exists(json, 'array_items_nullable') ? undefined : json['array_items_nullable'], @@ -143,8 +143,8 @@ export function NullableClassToJSON(value?: NullableClass | null): any { 'number_prop': value.numberProp, 'boolean_prop': value.booleanProp, 'string_prop': value.stringProp, - 'date_prop': value.dateProp === undefined ? undefined : (value.dateProp === null ? null : value.dateProp.toISOString().substring(0,10)), - 'datetime_prop': value.datetimeProp === undefined ? undefined : (value.datetimeProp === null ? null : value.datetimeProp.toISOString()), + 'date_prop': !exists(value, 'dateProp') ? undefined : ((value.dateProp as any).toISOString().substring(0,10)), + 'datetime_prop': !exists(value, 'datetimeProp') ? undefined : ((value.datetimeProp as any).toISOString()), 'array_nullable_prop': value.arrayNullableProp, 'array_and_items_nullable_prop': value.arrayAndItemsNullableProp, 'array_items_nullable': value.arrayItemsNullable, 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 f8d62e3fce5e..83ca620556e5 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 @@ -41,7 +41,7 @@ export function NumberOnlyFromJSON(json: any): NumberOnly { } export function NumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): NumberOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 335d6d726df7..39e71c83ad99 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 @@ -69,7 +69,7 @@ export function ObjectWithDeprecatedFieldsFromJSON(json: any): ObjectWithDepreca } export function ObjectWithDeprecatedFieldsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ObjectWithDeprecatedFields { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 cd72c59ea5c3..05f01c27ff38 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 41434f59f308..081204e9e36a 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 @@ -53,7 +53,7 @@ export function OuterCompositeFromJSON(json: any): OuterComposite { } export function OuterCompositeFromJSONTyped(json: any, ignoreDiscriminator: boolean): OuterComposite { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 d9626d5a0d2c..cfe2e74e1d6d 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 @@ -49,7 +49,7 @@ export function OuterObjectWithEnumPropertyFromJSON(json: any): OuterObjectWithE } export function OuterObjectWithEnumPropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean): OuterObjectWithEnumProperty { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 67c7574c229d..2a42b92605fd 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 @@ -61,7 +61,7 @@ export function ParentWithNullableFromJSON(json: any): ParentWithNullable { } export function ParentWithNullableFromJSONTyped(json: any, ignoreDiscriminator: boolean): ParentWithNullable { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } if (!ignoreDiscriminator) { 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 33e2b6db7973..8a16ba594e23 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 @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': Array.from(value.photoUrls as Set), - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 66d83cff7846..0cd5d709cb38 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 @@ -47,7 +47,7 @@ export function ReadOnlyFirstFromJSON(json: any): ReadOnlyFirst { } export function ReadOnlyFirstFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReadOnlyFirst { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 64d125505b16..94243865ac96 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 @@ -41,7 +41,7 @@ export function ReturnFromJSON(json: any): Return { } export function ReturnFromJSONTyped(json: any, ignoreDiscriminator: boolean): Return { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 aa9065c48671..f13fbbea9d57 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 @@ -41,7 +41,7 @@ export function SpecialModelNameFromJSON(json: any): SpecialModelName { } export function SpecialModelNameFromJSONTyped(json: any, ignoreDiscriminator: boolean): SpecialModelName { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 b52383c07ea4..593df16d395e 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 d8af84017df0..2eb6165b35e5 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 @@ -42,7 +42,7 @@ export function TestInlineFreeformAdditionalPropertiesRequestFromJSON(json: any) } export function TestInlineFreeformAdditionalPropertiesRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): TestInlineFreeformAdditionalPropertiesRequest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 daa30cd6783f..c8d0e3e5e0a3 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 @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts index 62bff92142aa..3066ba8b27f8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts index 5f507bceb566..7bc92d7b409d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts @@ -71,7 +71,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -108,7 +108,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -147,7 +147,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -189,7 +189,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -231,7 +231,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -266,7 +266,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -303,7 +303,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -360,7 +360,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts index eda5a23e9a8f..e36f9270bf55 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -138,7 +138,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts index 58f6a7e5d3af..e10b9a986a4f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts @@ -62,7 +62,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -95,7 +95,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -127,7 +127,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -160,7 +160,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -190,7 +190,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -220,11 +220,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -292,11 +292,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } 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 882567387201..7465414725e9 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts @@ -47,7 +47,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 bf50981fc2e2..04685e0915f1 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0d69755d4887..e7533030c3e5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 73c70f03a3e5..9d0530abd1ba 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': value.photoUrls, - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 e4902aa53cfd..1f10126ef079 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f22da928907c..6e0aefd2ff81 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index 71ecdb875d14..62e044bf623d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } 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 ebee6ba47f7d..7013d67ff4eb 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts @@ -72,7 +72,7 @@ export function EnumPatternObjectFromJSON(json: any): EnumPatternObject { } export function EnumPatternObjectFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnumPatternObject { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 35bc8a8a8aa7..a3676a4d4146 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -101,7 +101,7 @@ export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnum } export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FakeEnumRequestGetInline200Response { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts index cef607c3fcb5..99eb2c4e2042 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts index 5f507bceb566..7bc92d7b409d 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts @@ -71,7 +71,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -108,7 +108,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -147,7 +147,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -189,7 +189,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -231,7 +231,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -266,7 +266,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -303,7 +303,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -360,7 +360,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts index eda5a23e9a8f..e36f9270bf55 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -138,7 +138,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts index 58f6a7e5d3af..e10b9a986a4f 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts @@ -62,7 +62,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -95,7 +95,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -127,7 +127,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -160,7 +160,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -190,7 +190,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -220,11 +220,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -292,11 +292,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } 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 882567387201..7465414725e9 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 @@ -47,7 +47,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 bf50981fc2e2..04685e0915f1 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0d69755d4887..e7533030c3e5 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 73c70f03a3e5..9d0530abd1ba 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 @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': value.photoUrls, - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 e4902aa53cfd..1f10126ef079 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f22da928907c..6e0aefd2ff81 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 @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts index 71ecdb875d14..62e044bf623d 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts index 45628b2738d2..b577f23ebc5e 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts @@ -71,7 +71,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -108,7 +108,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -147,7 +147,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -189,7 +189,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -231,7 +231,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -266,7 +266,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -303,7 +303,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -360,7 +360,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts index 97d90e388f30..182e80bc718e 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -138,7 +138,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts index 4397fef0a0eb..7ed0f598281d 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts @@ -62,7 +62,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -95,7 +95,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -127,7 +127,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -160,7 +160,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -190,7 +190,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -220,11 +220,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -292,11 +292,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } 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 882567387201..7465414725e9 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 @@ -47,7 +47,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 bf50981fc2e2..04685e0915f1 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0d69755d4887..e7533030c3e5 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 73c70f03a3e5..9d0530abd1ba 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 @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': value.photoUrls, - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 e4902aa53cfd..1f10126ef079 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f22da928907c..6e0aefd2ff81 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 @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts index 71ecdb875d14..62e044bf623d 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts index 47c11d68ca95..6f29f6b70883 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts @@ -71,7 +71,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: PetApiAddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -108,7 +108,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: PetApiDeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -147,7 +147,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: PetApiFindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -189,7 +189,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: PetApiFindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -231,7 +231,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: PetApiGetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -266,7 +266,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: PetApiUpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -303,7 +303,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: PetApiUpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -360,7 +360,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: PetApiUploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts index 3af1283917aa..b31517091a8d 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: StoreApiDeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: StoreApiGetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -138,7 +138,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: StoreApiPlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts index 9738d83f9c64..012a2f5b8bf9 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts @@ -62,7 +62,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: UserApiCreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -95,7 +95,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: UserApiCreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -127,7 +127,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: UserApiCreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -160,7 +160,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: UserApiDeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -190,7 +190,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: UserApiGetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -220,11 +220,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: UserApiLoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -292,11 +292,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UserApiUpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } 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 882567387201..7465414725e9 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 @@ -47,7 +47,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 bf50981fc2e2..04685e0915f1 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0d69755d4887..e7533030c3e5 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 73c70f03a3e5..9d0530abd1ba 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 @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': value.photoUrls, - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 e4902aa53cfd..1f10126ef079 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f22da928907c..6e0aefd2ff81 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 @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts index 71ecdb875d14..62e044bf623d 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts index f1fbb107ba1a..c751adf35fff 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts @@ -42,7 +42,7 @@ export class BehaviorApi extends runtime.BaseAPI { * Get permissions for the behavior */ async getBehaviorPermissionsRaw(requestParameters: GetBehaviorPermissionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.behaviorId === null || requestParameters.behaviorId === undefined) { + if (!runtime.exists(requestParameters, 'behaviorId')) { throw new runtime.RequiredError('behaviorId','Required parameter requestParameters.behaviorId was null or undefined when calling getBehaviorPermissions.'); } @@ -72,7 +72,7 @@ export class BehaviorApi extends runtime.BaseAPI { * Get the type of behavior */ async getBehaviorTypeRaw(requestParameters: GetBehaviorTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.behaviorId === null || requestParameters.behaviorId === undefined) { + if (!runtime.exists(requestParameters, 'behaviorId')) { throw new runtime.RequiredError('behaviorId','Required parameter requestParameters.behaviorId was null or undefined when calling getBehaviorType.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts index 2f54dafe66e9..7ccf7c1c691a 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts @@ -100,7 +100,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.dummyCat === null || requestParameters.dummyCat === undefined) { + if (!runtime.exists(requestParameters, 'dummyCat')) { throw new runtime.RequiredError('dummyCat','Required parameter requestParameters.dummyCat was null or undefined when calling addPet.'); } @@ -137,7 +137,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -177,7 +177,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByIdsRaw(requestParameters: FindPetsByIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.ids === null || requestParameters.ids === undefined) { + if (!runtime.exists(requestParameters, 'ids')) { throw new runtime.RequiredError('ids','Required parameter requestParameters.ids was null or undefined when calling findPetsByIds.'); } @@ -219,7 +219,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -261,7 +261,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -304,7 +304,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByUserIdsRaw(requestParameters: FindPetsByUserIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.ids === null || requestParameters.ids === undefined) { + if (!runtime.exists(requestParameters, 'ids')) { throw new runtime.RequiredError('ids','Required parameter requestParameters.ids was null or undefined when calling findPetsByUserIds.'); } @@ -346,7 +346,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -381,7 +381,7 @@ export class PetApi extends runtime.BaseAPI { * Gets regions for a single pet. */ async getPetRegionsRaw(requestParameters: GetPetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetRegions.'); } @@ -411,7 +411,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -448,11 +448,11 @@ export class PetApi extends runtime.BaseAPI { * Updates the pet regions. */ async updatePetRegionsRaw(requestParameters: UpdatePetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetRegions.'); } - if (requestParameters.newRegions === null || requestParameters.newRegions === undefined) { + if (!runtime.exists(requestParameters, 'newRegions')) { throw new runtime.RequiredError('newRegions','Required parameter requestParameters.newRegions was null or undefined when calling updatePetRegions.'); } @@ -485,7 +485,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -542,7 +542,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts index 93fdede05ee7..bc475ba9b2b1 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts @@ -47,7 +47,7 @@ export class PetPartApi extends runtime.BaseAPI { * Returns single pet part type for the petPart id. */ async getFakePetPartTypeRaw(requestParameters: GetFakePetPartTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.fakePetPartId === null || requestParameters.fakePetPartId === undefined) { + if (!runtime.exists(requestParameters, 'fakePetPartId')) { throw new runtime.RequiredError('fakePetPartId','Required parameter requestParameters.fakePetPartId was null or undefined when calling getFakePetPartType.'); } @@ -77,19 +77,19 @@ export class PetPartApi extends runtime.BaseAPI { * Get the matching parts for the given pet part. */ async getMatchingPartsRaw(requestParameters: GetMatchingPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.fakePetPartId === null || requestParameters.fakePetPartId === undefined) { + if (!runtime.exists(requestParameters, 'fakePetPartId')) { throw new runtime.RequiredError('fakePetPartId','Required parameter requestParameters.fakePetPartId was null or undefined when calling getMatchingParts.'); } - if (requestParameters._long === null || requestParameters._long === undefined) { + if (!runtime.exists(requestParameters, '_long')) { throw new runtime.RequiredError('_long','Required parameter requestParameters._long was null or undefined when calling getMatchingParts.'); } - if (requestParameters.smooth === null || requestParameters.smooth === undefined) { + if (!runtime.exists(requestParameters, 'smooth')) { throw new runtime.RequiredError('smooth','Required parameter requestParameters.smooth was null or undefined when calling getMatchingParts.'); } - if (requestParameters._short === null || requestParameters._short === undefined) { + if (!runtime.exists(requestParameters, '_short')) { throw new runtime.RequiredError('_short','Required parameter requestParameters._short was null or undefined when calling getMatchingParts.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts index 97d90e388f30..182e80bc718e 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -138,7 +138,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts index 2392a0df4c13..9eff00a219d1 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts @@ -65,7 +65,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -98,7 +98,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -130,7 +130,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -163,7 +163,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -193,7 +193,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -223,11 +223,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -295,11 +295,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } 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 882567387201..7465414725e9 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 @@ -47,7 +47,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 6e974ed08da3..cda708df6a28 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 @@ -49,7 +49,7 @@ export function DefaultMetaOnlyResponseFromJSON(json: any): DefaultMetaOnlyRespo } export function DefaultMetaOnlyResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DefaultMetaOnlyResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 2107c98467d0..4a4c161767ae 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 @@ -61,7 +61,7 @@ export function FindPetsByStatusResponseFromJSON(json: any): FindPetsByStatusRes } export function FindPetsByStatusResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FindPetsByStatusResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -81,7 +81,7 @@ export function FindPetsByStatusResponseToJSON(value?: FindPetsByStatusResponse return { 'meta': ResponseMetaToJSON(value.meta), - 'data': value.data === undefined ? undefined : ((value.data as Array).map(PetToJSON)), + 'data': !exists(value, 'data') ? undefined : ((value.data as Array).map(PetToJSON)), }; } 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 4099b1572004..9aa48dee6d31 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 @@ -61,7 +61,7 @@ export function FindPetsByUserResponseFromJSON(json: any): FindPetsByUserRespons } export function FindPetsByUserResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FindPetsByUserResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -81,7 +81,7 @@ export function FindPetsByUserResponseToJSON(value?: FindPetsByUserResponse | nu return { 'meta': ResponseMetaToJSON(value.meta), - 'data': value.data === undefined ? undefined : ((value.data as Array).map(UserToJSON)), + 'data': !exists(value, 'data') ? undefined : ((value.data as Array).map(UserToJSON)), }; } 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 ef11201e782a..9ec02e4acfdc 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 @@ -55,7 +55,7 @@ export function GetBehaviorPermissionsResponseFromJSON(json: any): GetBehaviorPe } export function GetBehaviorPermissionsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetBehaviorPermissionsResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 214cef0177ad..959744e3bd9e 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 @@ -61,7 +61,7 @@ export function GetBehaviorTypeResponseFromJSON(json: any): GetBehaviorTypeRespo } export function GetBehaviorTypeResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetBehaviorTypeResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 d40586e60fc6..272ab8e1e51e 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 @@ -61,7 +61,7 @@ export function GetMatchingPartsResponseFromJSON(json: any): GetMatchingPartsRes } export function GetMatchingPartsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetMatchingPartsResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 01927a668ec4..f5bb8efeb87a 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 @@ -61,7 +61,7 @@ export function GetPetPartTypeResponseFromJSON(json: any): GetPetPartTypeRespons } export function GetPetPartTypeResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetPetPartTypeResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 d1ab620bef61..4e0e909fec2f 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 @@ -49,7 +49,7 @@ export function ItemIdFromJSON(json: any): ItemId { } export function ItemIdFromJSONTyped(json: any, ignoreDiscriminator: boolean): ItemId { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0845256d726a..2e4f66cb3c10 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 @@ -56,7 +56,7 @@ export function MatchingPartsFromJSON(json: any): MatchingParts { } export function MatchingPartsFromJSONTyped(json: any, ignoreDiscriminator: boolean): MatchingParts { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 bf50981fc2e2..04685e0915f1 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 84b2bf87bde6..9f3a22649b18 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 @@ -67,7 +67,7 @@ export function ModelErrorFromJSON(json: any): ModelError { } export function ModelErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelError { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0d69755d4887..e7533030c3e5 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 bf4efc34277a..0cfad223cb16 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 @@ -49,7 +49,7 @@ export function PartFromJSON(json: any): Part { } export function PartFromJSONTyped(json: any, ignoreDiscriminator: boolean): Part { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 dcf617888bfd..823e8bca3c39 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 @@ -212,7 +212,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -260,7 +260,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'optionalCategory': CategoryToJSON(value.optionalCategory), 'name': value.name, - 'entries': value._entries === undefined ? undefined : ((value._entries as Array).map(CategoryToJSON)), + 'entries': !exists(value, '_entries') ? undefined : ((value._entries as Array).map(CategoryToJSON)), 'surname': value.surname, 'photoUrls': value.photoUrls, 'warningStatus': WarningCodeToJSON(value.warningStatus), @@ -268,7 +268,7 @@ export function PetToJSON(value?: Pet | null): any { 'alternateStatus': DeploymentRequestStatusToJSON(value.alternateStatus), 'otherDepStatuses': ((value.otherDepStatuses as Array).map(DeploymentRequestStatusToJSON)), 'tags': ((value.tags as Array).map(TagToJSON)), - 'optionalTags': value.optionalTags === undefined ? undefined : ((value.optionalTags as Array).map(TagToJSON)), + 'optionalTags': !exists(value, 'optionalTags') ? undefined : ((value.optionalTags as Array).map(TagToJSON)), 'status': value.status, 'regions': value.regions, }; 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 bca0ee3d8851..dc670c88d8a4 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 @@ -55,7 +55,7 @@ export function PetRegionsResponseFromJSON(json: any): PetRegionsResponse { } export function PetRegionsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PetRegionsResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 5ac4b74ecf52..ab30aa27af6b 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 @@ -111,7 +111,7 @@ export function ResponseMetaFromJSON(json: any): ResponseMeta { } export function ResponseMetaFromJSONTyped(json: any, ignoreDiscriminator: boolean): ResponseMeta { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 e4902aa53cfd..1f10126ef079 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 ceeea2540716..037f803a4c0b 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 @@ -97,7 +97,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts index 71ecdb875d14..62e044bf623d 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts index 4248cc6d062e..73394ee15281 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts @@ -36,7 +36,7 @@ export class AnotherFakeApi extends runtime.BaseAPI { * To test special tags */ async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.client === null || requestParameters.client === undefined) { + if (!runtime.exists(requestParameters, 'client')) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling _123testSpecialTags.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts index 0d9ea6361d7c..1d3d82f2c654 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts @@ -207,7 +207,7 @@ export class FakeApi extends runtime.BaseAPI { * test http signature authentication */ async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pet === null || requestParameters.pet === undefined) { + if (!runtime.exists(requestParameters, 'pet')) { throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling fakeHttpSignatureTest.'); } @@ -375,7 +375,7 @@ export class FakeApi extends runtime.BaseAPI { * Test serialization of enum (int) properties with examples */ async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.outerObjectWithEnumProperty === null || requestParameters.outerObjectWithEnumProperty === undefined) { + if (!runtime.exists(requestParameters, 'outerObjectWithEnumProperty')) { throw new runtime.RequiredError('outerObjectWithEnumProperty','Required parameter requestParameters.outerObjectWithEnumProperty was null or undefined when calling fakePropertyEnumIntegerSerialize.'); } @@ -408,7 +408,7 @@ export class FakeApi extends runtime.BaseAPI { * For this test, the body has to be a binary file. */ async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling testBodyWithBinary.'); } @@ -440,7 +440,7 @@ export class FakeApi extends runtime.BaseAPI { * For this test, the body for this request must reference a schema named `File`. */ async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.fileSchemaTestClass === null || requestParameters.fileSchemaTestClass === undefined) { + if (!runtime.exists(requestParameters, 'fileSchemaTestClass')) { throw new runtime.RequiredError('fileSchemaTestClass','Required parameter requestParameters.fileSchemaTestClass was null or undefined when calling testBodyWithFileSchema.'); } @@ -471,11 +471,11 @@ export class FakeApi extends runtime.BaseAPI { /** */ async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.query === null || requestParameters.query === undefined) { + if (!runtime.exists(requestParameters, 'query')) { throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling testBodyWithQueryParams.'); } - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling testBodyWithQueryParams.'); } @@ -511,7 +511,7 @@ export class FakeApi extends runtime.BaseAPI { * To test \"client\" model */ async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.client === null || requestParameters.client === undefined) { + if (!runtime.exists(requestParameters, 'client')) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClientModel.'); } @@ -546,19 +546,19 @@ export class FakeApi extends runtime.BaseAPI { * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 */ async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.number === null || requestParameters.number === undefined) { + if (!runtime.exists(requestParameters, 'number')) { throw new runtime.RequiredError('number','Required parameter requestParameters.number was null or undefined when calling testEndpointParameters.'); } - if (requestParameters._double === null || requestParameters._double === undefined) { + if (!runtime.exists(requestParameters, '_double')) { throw new runtime.RequiredError('_double','Required parameter requestParameters._double was null or undefined when calling testEndpointParameters.'); } - if (requestParameters.patternWithoutDelimiter === null || requestParameters.patternWithoutDelimiter === undefined) { + if (!runtime.exists(requestParameters, 'patternWithoutDelimiter')) { throw new runtime.RequiredError('patternWithoutDelimiter','Required parameter requestParameters.patternWithoutDelimiter was null or undefined when calling testEndpointParameters.'); } - if (requestParameters._byte === null || requestParameters._byte === undefined) { + if (!runtime.exists(requestParameters, '_byte')) { throw new runtime.RequiredError('_byte','Required parameter requestParameters._byte was null or undefined when calling testEndpointParameters.'); } @@ -743,15 +743,15 @@ export class FakeApi extends runtime.BaseAPI { * Fake endpoint to test group parameters (optional) */ async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.requiredStringGroup === null || requestParameters.requiredStringGroup === undefined) { + if (!runtime.exists(requestParameters, 'requiredStringGroup')) { throw new runtime.RequiredError('requiredStringGroup','Required parameter requestParameters.requiredStringGroup was null or undefined when calling testGroupParameters.'); } - if (requestParameters.requiredBooleanGroup === null || requestParameters.requiredBooleanGroup === undefined) { + if (!runtime.exists(requestParameters, 'requiredBooleanGroup')) { throw new runtime.RequiredError('requiredBooleanGroup','Required parameter requestParameters.requiredBooleanGroup was null or undefined when calling testGroupParameters.'); } - if (requestParameters.requiredInt64Group === null || requestParameters.requiredInt64Group === undefined) { + if (!runtime.exists(requestParameters, 'requiredInt64Group')) { throw new runtime.RequiredError('requiredInt64Group','Required parameter requestParameters.requiredInt64Group was null or undefined when calling testGroupParameters.'); } @@ -814,7 +814,7 @@ export class FakeApi extends runtime.BaseAPI { * test inline additionalProperties */ async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) { + if (!runtime.exists(requestParameters, 'requestBody')) { throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testInlineAdditionalProperties.'); } @@ -848,11 +848,11 @@ export class FakeApi extends runtime.BaseAPI { * test json serialization of form data */ async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.param === null || requestParameters.param === undefined) { + if (!runtime.exists(requestParameters, 'param')) { throw new runtime.RequiredError('param','Required parameter requestParameters.param was null or undefined when calling testJsonFormData.'); } - if (requestParameters.param2 === null || requestParameters.param2 === undefined) { + if (!runtime.exists(requestParameters, 'param2')) { throw new runtime.RequiredError('param2','Required parameter requestParameters.param2 was null or undefined when calling testJsonFormData.'); } @@ -905,27 +905,27 @@ export class FakeApi extends runtime.BaseAPI { * To test the collection format in query parameters */ async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pipe === null || requestParameters.pipe === undefined) { + if (!runtime.exists(requestParameters, 'pipe')) { throw new runtime.RequiredError('pipe','Required parameter requestParameters.pipe was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.ioutil === null || requestParameters.ioutil === undefined) { + if (!runtime.exists(requestParameters, 'ioutil')) { throw new runtime.RequiredError('ioutil','Required parameter requestParameters.ioutil was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.http === null || requestParameters.http === undefined) { + if (!runtime.exists(requestParameters, 'http')) { throw new runtime.RequiredError('http','Required parameter requestParameters.http was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.url === null || requestParameters.url === undefined) { + if (!runtime.exists(requestParameters, 'url')) { throw new runtime.RequiredError('url','Required parameter requestParameters.url was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.context === null || requestParameters.context === undefined) { + if (!runtime.exists(requestParameters, 'context')) { throw new runtime.RequiredError('context','Required parameter requestParameters.context was null or undefined when calling testQueryParameterCollectionFormat.'); } - if (requestParameters.allowEmpty === null || requestParameters.allowEmpty === undefined) { + if (!runtime.exists(requestParameters, 'allowEmpty')) { throw new runtime.RequiredError('allowEmpty','Required parameter requestParameters.allowEmpty was null or undefined when calling testQueryParameterCollectionFormat.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts index e6f3fd1f0b96..6f599cb8c493 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts @@ -36,7 +36,7 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { * To test class name in snake case */ async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.client === null || requestParameters.client === undefined) { + if (!runtime.exists(requestParameters, 'client')) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClassname.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts index 354aac42bbf8..a2ed0b2a20b4 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts @@ -78,7 +78,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pet === null || requestParameters.pet === undefined) { + if (!runtime.exists(requestParameters, 'pet')) { throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling addPet.'); } @@ -117,7 +117,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -157,7 +157,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -199,7 +199,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -241,7 +241,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -277,7 +277,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pet === null || requestParameters.pet === undefined) { + if (!runtime.exists(requestParameters, 'pet')) { throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling updatePet.'); } @@ -316,7 +316,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -375,7 +375,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } @@ -437,11 +437,11 @@ export class PetApi extends runtime.BaseAPI { * uploads an image (required) */ async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFileWithRequiredFile.'); } - if (requestParameters.requiredFile === null || requestParameters.requiredFile === undefined) { + if (!runtime.exists(requestParameters, 'requiredFile')) { throw new runtime.RequiredError('requiredFile','Required parameter requestParameters.requiredFile was null or undefined when calling uploadFileWithRequiredFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts index 3b17a1d7bb0d..433a2289bd4d 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -139,7 +139,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.order === null || requestParameters.order === undefined) { + if (!runtime.exists(requestParameters, 'order')) { throw new runtime.RequiredError('order','Required parameter requestParameters.order was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts index df5c8f4efcd4..490810fdb119 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts @@ -62,7 +62,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUser.'); } @@ -96,7 +96,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithArrayInput.'); } @@ -130,7 +130,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithListInput.'); } @@ -164,7 +164,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -195,7 +195,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -227,11 +227,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -302,11 +302,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.user === null || requestParameters.user === undefined) { + if (!runtime.exists(requestParameters, 'user')) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling updateUser.'); } 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 ae1161178dbc..77f5d8b800e6 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 @@ -47,7 +47,7 @@ export function AdditionalPropertiesClassFromJSON(json: any): AdditionalProperti } export function AdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): AdditionalPropertiesClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 13958e2ab77f..8e796d9f1920 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 @@ -54,7 +54,7 @@ export function AllOfWithSingleRefFromJSON(json: any): AllOfWithSingleRef { } export function AllOfWithSingleRefFromJSONTyped(json: any, ignoreDiscriminator: boolean): AllOfWithSingleRef { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 cb830e10d30f..7975ca6d801e 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 @@ -53,7 +53,7 @@ export function AnimalFromJSON(json: any): Animal { } export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): Animal { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } if (!ignoreDiscriminator) { 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 7ab12458982f..93dbe901e11e 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 @@ -41,7 +41,7 @@ export function ArrayOfArrayOfNumberOnlyFromJSON(json: any): ArrayOfArrayOfNumbe } export function ArrayOfArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ArrayOfArrayOfNumberOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 e0bdb81203b7..df1fdeeb9dd0 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 @@ -41,7 +41,7 @@ export function ArrayOfNumberOnlyFromJSON(json: any): ArrayOfNumberOnly { } export function ArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ArrayOfNumberOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 30473cdc6562..0558f27a2f6e 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 @@ -60,7 +60,7 @@ export function ArrayTestFromJSON(json: any): ArrayTest { } export function ArrayTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ArrayTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 53fec91847d2..6f06900a3437 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 @@ -72,7 +72,7 @@ export function CapitalizationFromJSON(json: any): Capitalization { } export function CapitalizationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Capitalization { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 dabeedf26255..325b72549b57 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 @@ -48,7 +48,7 @@ export function CatFromJSON(json: any): Cat { } export function CatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cat { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 d1e2e3f8ac8e..f05f090bf335 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 @@ -48,7 +48,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0f01d81b15a6..f01f13e44796 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 @@ -41,7 +41,7 @@ export function ClassModelFromJSON(json: any): ClassModel { } export function ClassModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): ClassModel { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 a9fd27b4f464..961b449ca3ef 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 @@ -41,7 +41,7 @@ export function ClientFromJSON(json: any): Client { } export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Client { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0cec2d09297d..65e56c1313b5 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 @@ -41,7 +41,7 @@ export function DeprecatedObjectFromJSON(json: any): DeprecatedObject { } export function DeprecatedObjectFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeprecatedObject { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 65cd613eae03..72fcebd1e5d6 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 @@ -48,7 +48,7 @@ export function DogFromJSON(json: any): Dog { } export function DogFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dog { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 9603be51cd51..56fdfaf91e55 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 @@ -67,7 +67,7 @@ export function EnumArraysFromJSON(json: any): EnumArrays { } export function EnumArraysFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnumArrays { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 69e7d4c0217c..e6067424d707 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 @@ -149,7 +149,7 @@ export function EnumTestFromJSON(json: any): EnumTest { } export function EnumTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnumTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 32154096ade4..b246a7fb0038 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 @@ -47,7 +47,7 @@ export function FakeBigDecimalMap200ResponseFromJSON(json: any): FakeBigDecimalM } export function FakeBigDecimalMap200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FakeBigDecimalMap200Response { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 71f887cf3271..c891873688e6 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 @@ -47,7 +47,7 @@ export function FileSchemaTestClassFromJSON(json: any): FileSchemaTestClass { } export function FileSchemaTestClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): FileSchemaTestClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 aa5b331c3b68..c642344ac96f 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 @@ -41,7 +41,7 @@ export function FooFromJSON(json: any): Foo { } export function FooFromJSONTyped(json: any, ignoreDiscriminator: boolean): Foo { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 3d49ed834fc6..bb198b05b7bc 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 @@ -48,7 +48,7 @@ export function FooGetDefaultResponseFromJSON(json: any): FooGetDefaultResponse } export function FooGetDefaultResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FooGetDefaultResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f095016dd22f..43e8ef88e3ad 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 @@ -142,7 +142,7 @@ export function FormatTestFromJSON(json: any): FormatTest { } export function FormatTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): FormatTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -185,8 +185,8 @@ export function FormatTestToJSON(value?: FormatTest | null): any { 'string': value.string, 'byte': value._byte, 'binary': value.binary, - 'date': (value.date.toISOString().substring(0,10)), - 'dateTime': value.dateTime === undefined ? undefined : (value.dateTime.toISOString()), + 'date': ((value.date).toISOString().substring(0,10)), + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), 'uuid': value.uuid, 'password': value.password, 'pattern_with_digits': value.patternWithDigits, 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 d3dc4be6767e..cbda481a9c64 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 @@ -47,7 +47,7 @@ export function HasOnlyReadOnlyFromJSON(json: any): HasOnlyReadOnly { } export function HasOnlyReadOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): HasOnlyReadOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } 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 d62e1f09b823..2470c4717626 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 @@ -41,7 +41,7 @@ export function HealthCheckResultFromJSON(json: any): HealthCheckResult { } export function HealthCheckResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): HealthCheckResult { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 1334322e823a..eaf10ce2ace8 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 @@ -41,7 +41,7 @@ export function ListFromJSON(json: any): List { } export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 2ae39dd903f1..edce7e732176 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 @@ -70,7 +70,7 @@ export function MapTestFromJSON(json: any): MapTest { } export function MapTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): MapTest { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 56e0a29e437d..3e5119bad70e 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 @@ -60,7 +60,7 @@ export function MixedPropertiesAndAdditionalPropertiesClassFromJSON(json: any): } export function MixedPropertiesAndAdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): MixedPropertiesAndAdditionalPropertiesClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -81,8 +81,8 @@ export function MixedPropertiesAndAdditionalPropertiesClassToJSON(value?: MixedP return { 'uuid': value.uuid, - 'dateTime': value.dateTime === undefined ? undefined : (value.dateTime.toISOString()), - 'map': value.map === undefined ? undefined : (mapValues(value.map, AnimalToJSON)), + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), + 'map': !exists(value, 'map') ? undefined : (mapValues(value.map, AnimalToJSON)), }; } 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 8b32d414747a..079eb5089f44 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 @@ -47,7 +47,7 @@ export function Model200ResponseFromJSON(json: any): Model200Response { } export function Model200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): Model200Response { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 8001d49c55bf..26a56914ea84 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 9d269ea77a1c..093f1fc04ed7 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 @@ -41,7 +41,7 @@ export function ModelFileFromJSON(json: any): ModelFile { } export function ModelFileFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelFile { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f58a563b8b5f..994a87066062 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 @@ -60,7 +60,7 @@ export function NameFromJSON(json: any): Name { } export function NameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Name { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 52e1a2171642..f7fadc861af9 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 @@ -108,7 +108,7 @@ export function NullableClassFromJSON(json: any): NullableClass { } export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boolean): NullableClass { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -118,8 +118,8 @@ export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boole 'numberProp': !exists(json, 'number_prop') ? undefined : json['number_prop'], 'booleanProp': !exists(json, 'boolean_prop') ? undefined : json['boolean_prop'], 'stringProp': !exists(json, 'string_prop') ? undefined : json['string_prop'], - 'dateProp': !exists(json, 'date_prop') ? undefined : (json['date_prop'] === null ? null : new Date(json['date_prop'])), - 'datetimeProp': !exists(json, 'datetime_prop') ? undefined : (json['datetime_prop'] === null ? null : new Date(json['datetime_prop'])), + 'dateProp': !exists(json, 'date_prop') ? undefined : (new Date(json['date_prop'])), + 'datetimeProp': !exists(json, 'datetime_prop') ? undefined : (new Date(json['datetime_prop'])), 'arrayNullableProp': !exists(json, 'array_nullable_prop') ? undefined : json['array_nullable_prop'], 'arrayAndItemsNullableProp': !exists(json, 'array_and_items_nullable_prop') ? undefined : json['array_and_items_nullable_prop'], 'arrayItemsNullable': !exists(json, 'array_items_nullable') ? undefined : json['array_items_nullable'], @@ -143,8 +143,8 @@ export function NullableClassToJSON(value?: NullableClass | null): any { 'number_prop': value.numberProp, 'boolean_prop': value.booleanProp, 'string_prop': value.stringProp, - 'date_prop': value.dateProp === undefined ? undefined : (value.dateProp === null ? null : value.dateProp.toISOString().substring(0,10)), - 'datetime_prop': value.datetimeProp === undefined ? undefined : (value.datetimeProp === null ? null : value.datetimeProp.toISOString()), + 'date_prop': !exists(value, 'dateProp') ? undefined : ((value.dateProp as any).toISOString().substring(0,10)), + 'datetime_prop': !exists(value, 'datetimeProp') ? undefined : ((value.datetimeProp as any).toISOString()), 'array_nullable_prop': value.arrayNullableProp, 'array_and_items_nullable_prop': value.arrayAndItemsNullableProp, 'array_items_nullable': value.arrayItemsNullable, 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 f8d62e3fce5e..83ca620556e5 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 @@ -41,7 +41,7 @@ export function NumberOnlyFromJSON(json: any): NumberOnly { } export function NumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean): NumberOnly { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 335d6d726df7..39e71c83ad99 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 @@ -69,7 +69,7 @@ export function ObjectWithDeprecatedFieldsFromJSON(json: any): ObjectWithDepreca } export function ObjectWithDeprecatedFieldsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ObjectWithDeprecatedFields { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 cd72c59ea5c3..05f01c27ff38 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 41434f59f308..081204e9e36a 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 @@ -53,7 +53,7 @@ export function OuterCompositeFromJSON(json: any): OuterComposite { } export function OuterCompositeFromJSONTyped(json: any, ignoreDiscriminator: boolean): OuterComposite { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 d9626d5a0d2c..cfe2e74e1d6d 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 @@ -49,7 +49,7 @@ export function OuterObjectWithEnumPropertyFromJSON(json: any): OuterObjectWithE } export function OuterObjectWithEnumPropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean): OuterObjectWithEnumProperty { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 33e2b6db7973..8a16ba594e23 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 @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': Array.from(value.photoUrls as Set), - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 66d83cff7846..0cd5d709cb38 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 @@ -47,7 +47,7 @@ export function ReadOnlyFirstFromJSON(json: any): ReadOnlyFirst { } export function ReadOnlyFirstFromJSONTyped(json: any, ignoreDiscriminator: boolean): ReadOnlyFirst { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 64d125505b16..94243865ac96 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 @@ -41,7 +41,7 @@ export function ReturnFromJSON(json: any): Return { } export function ReturnFromJSONTyped(json: any, ignoreDiscriminator: boolean): Return { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 aa9065c48671..f13fbbea9d57 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 @@ -41,7 +41,7 @@ export function SpecialModelNameFromJSON(json: any): SpecialModelName { } export function SpecialModelNameFromJSONTyped(json: any, ignoreDiscriminator: boolean): SpecialModelName { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 b52383c07ea4..593df16d395e 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 daa30cd6783f..c8d0e3e5e0a3 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 @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts index 62bff92142aa..3066ba8b27f8 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts index 945aa959ca08..344cffc08ca1 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts @@ -210,7 +210,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -247,7 +247,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -286,7 +286,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -328,7 +328,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -370,7 +370,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -405,7 +405,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -442,7 +442,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -499,7 +499,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts index cf68a43acd3c..4e23f251554c 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts @@ -115,7 +115,7 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -178,7 +178,7 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -209,7 +209,7 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts index a55ab1d48f5c..dbe7cad198b5 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts @@ -195,7 +195,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -228,7 +228,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -260,7 +260,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -293,7 +293,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -323,7 +323,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -353,11 +353,11 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -425,11 +425,11 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } 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 882567387201..7465414725e9 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 @@ -47,7 +47,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 bf50981fc2e2..04685e0915f1 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0d69755d4887..e7533030c3e5 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 73c70f03a3e5..9d0530abd1ba 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 @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': value.photoUrls, - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 e4902aa53cfd..1f10126ef079 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f22da928907c..6e0aefd2ff81 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 @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts index 71ecdb875d14..62e044bf623d 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts index 5f507bceb566..7bc92d7b409d 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts @@ -71,7 +71,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -108,7 +108,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -147,7 +147,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -189,7 +189,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -231,7 +231,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -266,7 +266,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -303,7 +303,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -360,7 +360,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts index eda5a23e9a8f..e36f9270bf55 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts @@ -44,7 +44,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -107,7 +107,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -138,7 +138,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts index 58f6a7e5d3af..e10b9a986a4f 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts @@ -62,7 +62,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -95,7 +95,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -127,7 +127,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -160,7 +160,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -190,7 +190,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -220,11 +220,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -292,11 +292,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } 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 882567387201..7465414725e9 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 @@ -47,7 +47,7 @@ export function CategoryFromJSON(json: any): Category { } export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Category { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 bf50981fc2e2..04685e0915f1 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 @@ -53,7 +53,7 @@ export function ModelApiResponseFromJSON(json: any): ModelApiResponse { } export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelApiResponse { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 0d69755d4887..e7533030c3e5 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 @@ -83,7 +83,7 @@ export function OrderFromJSON(json: any): Order { } export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Order { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -109,7 +109,7 @@ export function OrderToJSON(value?: Order | null): any { 'id': value.id, 'petId': value.petId, 'quantity': value.quantity, - 'shipDate': value.shipDate === undefined ? undefined : (value.shipDate.toISOString()), + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), 'status': value.status, 'complete': value.complete, }; 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 73c70f03a3e5..9d0530abd1ba 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 @@ -98,7 +98,7 @@ export function PetFromJSON(json: any): Pet { } export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { @@ -125,7 +125,7 @@ export function PetToJSON(value?: Pet | null): any { 'category': CategoryToJSON(value.category), 'name': value.name, 'photoUrls': value.photoUrls, - 'tags': value.tags === undefined ? undefined : ((value.tags as Array).map(TagToJSON)), + 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), 'status': value.status, }; } 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 e4902aa53cfd..1f10126ef079 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 @@ -47,7 +47,7 @@ export function TagFromJSON(json: any): Tag { } export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 f22da928907c..6e0aefd2ff81 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 @@ -83,7 +83,7 @@ export function UserFromJSON(json: any): User { } export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts index 71ecdb875d14..62e044bf623d 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } 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 ebee6ba47f7d..7013d67ff4eb 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 @@ -72,7 +72,7 @@ export function EnumPatternObjectFromJSON(json: any): EnumPatternObject { } export function EnumPatternObjectFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnumPatternObject { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { 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 103f45f57d94..2b643394ba7d 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 @@ -97,7 +97,7 @@ export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnum } export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FakeEnumRequestGetInline200Response { - if ((json === undefined) || (json === null)) { + if (json === undefined || json === null) { return json; } return { diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts index cef607c3fcb5..99eb2c4e2042 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts @@ -310,7 +310,7 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { +export function exists(json: any, key: string): boolean { const value = json[key]; return value !== null && value !== undefined; } diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts index 0aaabe7652a3..f6d851b5253b 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts @@ -65,7 +65,7 @@ export class PetApi extends runtime.BaseAPI { * Add a new pet to the store */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); } @@ -102,7 +102,7 @@ export class PetApi extends runtime.BaseAPI { * Deletes a pet */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); } @@ -141,7 +141,7 @@ export class PetApi extends runtime.BaseAPI { * Finds Pets by status */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.status === null || requestParameters.status === undefined) { + if (!runtime.exists(requestParameters, 'status')) { throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); } @@ -183,7 +183,7 @@ export class PetApi extends runtime.BaseAPI { * @deprecated */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { + if (!runtime.exists(requestParameters, 'tags')) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -225,7 +225,7 @@ export class PetApi extends runtime.BaseAPI { * Find pet by ID */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); } @@ -260,7 +260,7 @@ export class PetApi extends runtime.BaseAPI { * Update an existing pet */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); } @@ -297,7 +297,7 @@ export class PetApi extends runtime.BaseAPI { * Updates a pet in the store with form data */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); } @@ -354,7 +354,7 @@ export class PetApi extends runtime.BaseAPI { * uploads an image */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.petId === null || requestParameters.petId === undefined) { + if (!runtime.exists(requestParameters, 'petId')) { throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts index 1b6199a07148..56ed7b363f8e 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts @@ -40,7 +40,7 @@ export class StoreApi extends runtime.BaseAPI { * Delete purchase order by ID */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); } @@ -103,7 +103,7 @@ export class StoreApi extends runtime.BaseAPI { * Find purchase order by ID */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { + if (!runtime.exists(requestParameters, 'orderId')) { throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); } @@ -134,7 +134,7 @@ export class StoreApi extends runtime.BaseAPI { * Place an order for a pet */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts index 08676b352e5d..efc6483d0dc7 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts @@ -58,7 +58,7 @@ export class UserApi extends runtime.BaseAPI { * Create user */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); } @@ -91,7 +91,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); } @@ -123,7 +123,7 @@ export class UserApi extends runtime.BaseAPI { * Creates list of users with given input array */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); } @@ -156,7 +156,7 @@ export class UserApi extends runtime.BaseAPI { * Delete user */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); } @@ -186,7 +186,7 @@ export class UserApi extends runtime.BaseAPI { * Get user by user name */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); } @@ -216,11 +216,11 @@ export class UserApi extends runtime.BaseAPI { * Logs user into the system */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); } - if (requestParameters.password === null || requestParameters.password === undefined) { + if (!runtime.exists(requestParameters, 'password')) { throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); } @@ -288,11 +288,11 @@ export class UserApi extends runtime.BaseAPI { * Updated user */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { + if (!runtime.exists(requestParameters, 'username')) { throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); } - if (requestParameters.body === null || requestParameters.body === undefined) { + if (!runtime.exists(requestParameters, 'body')) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); } From c6a0c6b5c5a5ef80e93f1bbe7c8a4546e09e5091 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 10:15:30 +0100 Subject: [PATCH 3/8] Fix use of `null` instead of `undefined`. --- .../src/main/resources/typescript-fetch/apis.mustache | 6 +++--- .../typescript-fetch/modelGenericInterfaces.mustache | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index e40fa8706066..2f9b0e4ad233 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -24,7 +24,7 @@ import { {{#allParams.0}} export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request { {{#allParams}} - {{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; + {{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}}{{#required}} | null{{/required}}{{/isNullable}}{{/isEnum}}; {{/allParams}} } @@ -70,7 +70,7 @@ export interface {{classname}}Interface { {{/isDeprecated}} */ {{^useSingleRequestParameter}} - {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>; + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}}{{#required}} | null{{/required}}{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>; {{/useSingleRequestParameter}} {{#useSingleRequestParameter}} {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>; @@ -351,7 +351,7 @@ export class {{classname}} extends runtime.BaseAPI { {{/isDeprecated}} */ {{^useSingleRequestParameter}} - async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> { + async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}}{{#required}} | null{{/required}}{{/isNullable}}{{/isEnum}}, {{/allParams}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{{{returnType}}}{{#returnType}}{{#isResponseOptional}} | null | undefined {{/isResponseOptional}}{{/returnType}}{{^returnType}}void{{/returnType}}> { {{#returnType}} const response = await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides); {{#isResponseOptional}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache index 68e5747598a9..4b8bfa06a1bc 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGenericInterfaces.mustache @@ -16,7 +16,7 @@ export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ * @deprecated {{/deprecated}} */ - {{#isReadOnly}}readonly {{/isReadOnly}}{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; + {{#isReadOnly}}readonly {{/isReadOnly}}{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{#isNullable}}{{#required}} | null{{/required}}{{/isNullable}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{#isNullable}}{{#required}} | null{{/required}}{{/isNullable}}{{/isEnum}}; {{/vars}} }{{#hasEnums}} From 1bc1681e9664cd44b79adf4c786d84ae28f21fcd Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 10:15:45 +0100 Subject: [PATCH 4/8] Enhance function code. --- .../main/resources/typescript-fetch/modelGeneric.mustache | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache index ae43776ccbef..653657d5152c 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -24,14 +24,12 @@ import { * Check if a given object implements the {{classname}} interface. */ export function instanceOf{{classname}}(value: object): boolean { - let isInstance = true; {{#vars}} {{#required}} - isInstance = isInstance && "{{name}}" in value; + if (!('{{name}}' in value)) return false; {{/required}} {{/vars}} - - return isInstance; + return true; } export function {{classname}}FromJSON(json: any): {{classname}} { From ca152d3aca1cff5fdcbefe85478ecd0d86e668d5 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 10:16:39 +0100 Subject: [PATCH 5/8] Regenerate Petstore code. --- .../builds/allOf-nullable/models/Club.ts | 6 ++-- .../builds/allOf-nullable/models/Owner.ts | 4 +-- .../builds/allOf-readonly/models/Club.ts | 4 +-- .../builds/allOf-readonly/models/Owner.ts | 4 +-- .../models/AdditionalPropertiesClass.ts | 4 +-- .../default-v3.0/models/AllOfWithSingleRef.ts | 4 +-- .../builds/default-v3.0/models/Animal.ts | 6 ++-- .../models/ArrayOfArrayOfNumberOnly.ts | 4 +-- .../default-v3.0/models/ArrayOfNumberOnly.ts | 4 +-- .../builds/default-v3.0/models/ArrayTest.ts | 4 +-- .../default-v3.0/models/Capitalization.ts | 4 +-- .../builds/default-v3.0/models/Cat.ts | 4 +-- .../builds/default-v3.0/models/Category.ts | 6 ++-- .../default-v3.0/models/ChildWithNullable.ts | 4 +-- .../builds/default-v3.0/models/ClassModel.ts | 4 +-- .../builds/default-v3.0/models/Client.ts | 4 +-- .../default-v3.0/models/DeprecatedObject.ts | 4 +-- .../builds/default-v3.0/models/Dog.ts | 4 +-- .../builds/default-v3.0/models/EnumArrays.ts | 4 +-- .../builds/default-v3.0/models/EnumTest.ts | 8 ++--- .../models/FakeBigDecimalMap200Response.ts | 4 +-- .../models/FileSchemaTestClass.ts | 4 +-- .../builds/default-v3.0/models/Foo.ts | 4 +-- .../models/FooGetDefaultResponse.ts | 4 +-- .../builds/default-v3.0/models/FormatTest.ts | 12 +++---- .../default-v3.0/models/HasOnlyReadOnly.ts | 4 +-- .../default-v3.0/models/HealthCheckResult.ts | 6 ++-- .../builds/default-v3.0/models/List.ts | 4 +-- .../builds/default-v3.0/models/MapTest.ts | 4 +-- ...dPropertiesAndAdditionalPropertiesClass.ts | 4 +-- .../default-v3.0/models/Model200Response.ts | 4 +-- .../default-v3.0/models/ModelApiResponse.ts | 4 +-- .../builds/default-v3.0/models/ModelFile.ts | 4 +-- .../builds/default-v3.0/models/Name.ts | 6 ++-- .../default-v3.0/models/NullableClass.ts | 24 +++++++------- .../builds/default-v3.0/models/NumberOnly.ts | 4 +-- .../models/ObjectWithDeprecatedFields.ts | 4 +-- .../builds/default-v3.0/models/Order.ts | 4 +-- .../default-v3.0/models/OuterComposite.ts | 4 +-- .../models/OuterObjectWithEnumProperty.ts | 6 ++-- .../default-v3.0/models/ParentWithNullable.ts | 6 ++-- .../builds/default-v3.0/models/Pet.ts | 8 ++--- .../default-v3.0/models/ReadOnlyFirst.ts | 4 +-- .../builds/default-v3.0/models/Return.ts | 4 +-- .../default-v3.0/models/SpecialModelName.ts | 4 +-- .../builds/default-v3.0/models/Tag.ts | 4 +-- ...lineFreeformAdditionalPropertiesRequest.ts | 4 +-- .../builds/default-v3.0/models/User.ts | 4 +-- .../builds/default/models/Category.ts | 4 +-- .../builds/default/models/ModelApiResponse.ts | 4 +-- .../builds/default/models/Order.ts | 4 +-- .../builds/default/models/Pet.ts | 8 ++--- .../builds/default/models/Tag.ts | 4 +-- .../builds/default/models/User.ts | 4 +-- .../builds/enum/apis/DefaultApi.ts | 4 +-- .../builds/enum/models/EnumPatternObject.ts | 8 ++--- .../FakeEnumRequestGetInline200Response.ts | 4 +-- .../builds/es6-target/src/models/Category.ts | 4 +-- .../es6-target/src/models/ModelApiResponse.ts | 4 +-- .../builds/es6-target/src/models/Order.ts | 4 +-- .../builds/es6-target/src/models/Pet.ts | 8 ++--- .../builds/es6-target/src/models/Tag.ts | 4 +-- .../builds/es6-target/src/models/User.ts | 4 +-- .../multiple-parameters/models/Category.ts | 4 +-- .../models/ModelApiResponse.ts | 4 +-- .../multiple-parameters/models/Order.ts | 4 +-- .../builds/multiple-parameters/models/Pet.ts | 8 ++--- .../builds/multiple-parameters/models/Tag.ts | 4 +-- .../builds/multiple-parameters/models/User.ts | 4 +-- .../src/models/Category.ts | 4 +-- .../src/models/ModelApiResponse.ts | 4 +-- .../src/models/Order.ts | 4 +-- .../src/models/Pet.ts | 8 ++--- .../src/models/Tag.ts | 4 +-- .../src/models/User.ts | 4 +-- .../sagas-and-records/src/models/Category.ts | 4 +-- .../src/models/DefaultMetaOnlyResponse.ts | 6 ++-- .../src/models/FindPetsByStatusResponse.ts | 6 ++-- .../src/models/FindPetsByUserResponse.ts | 6 ++-- .../models/GetBehaviorPermissionsResponse.ts | 6 ++-- .../src/models/GetBehaviorTypeResponse.ts | 6 ++-- .../src/models/GetMatchingPartsResponse.ts | 6 ++-- .../src/models/GetPetPartTypeResponse.ts | 6 ++-- .../sagas-and-records/src/models/ItemId.ts | 8 ++--- .../src/models/MatchingParts.ts | 8 ++--- .../src/models/ModelApiResponse.ts | 4 +-- .../src/models/ModelError.ts | 6 ++-- .../sagas-and-records/src/models/Order.ts | 4 +-- .../sagas-and-records/src/models/Part.ts | 8 ++--- .../sagas-and-records/src/models/Pet.ts | 32 +++++++++---------- .../src/models/PetRegionsResponse.ts | 6 ++-- .../src/models/ResponseMeta.ts | 6 ++-- .../sagas-and-records/src/models/Tag.ts | 4 +-- .../sagas-and-records/src/models/User.ts | 8 ++--- .../models/AdditionalPropertiesClass.ts | 4 +-- .../models/AllOfWithSingleRef.ts | 4 +-- .../snakecase-discriminator/models/Animal.ts | 6 ++-- .../models/ArrayOfArrayOfNumberOnly.ts | 4 +-- .../models/ArrayOfNumberOnly.ts | 4 +-- .../models/ArrayTest.ts | 4 +-- .../models/Capitalization.ts | 4 +-- .../snakecase-discriminator/models/Cat.ts | 4 +-- .../models/Category.ts | 6 ++-- .../models/ClassModel.ts | 4 +-- .../snakecase-discriminator/models/Client.ts | 4 +-- .../models/DeprecatedObject.ts | 4 +-- .../snakecase-discriminator/models/Dog.ts | 4 +-- .../models/EnumArrays.ts | 4 +-- .../models/EnumTest.ts | 8 ++--- .../models/FakeBigDecimalMap200Response.ts | 4 +-- .../models/FileSchemaTestClass.ts | 4 +-- .../snakecase-discriminator/models/Foo.ts | 4 +-- .../models/FooGetDefaultResponse.ts | 4 +-- .../models/FormatTest.ts | 12 +++---- .../models/HasOnlyReadOnly.ts | 4 +-- .../models/HealthCheckResult.ts | 6 ++-- .../snakecase-discriminator/models/List.ts | 4 +-- .../snakecase-discriminator/models/MapTest.ts | 4 +-- ...dPropertiesAndAdditionalPropertiesClass.ts | 4 +-- .../models/Model200Response.ts | 4 +-- .../models/ModelApiResponse.ts | 4 +-- .../models/ModelFile.ts | 4 +-- .../snakecase-discriminator/models/Name.ts | 6 ++-- .../models/NullableClass.ts | 24 +++++++------- .../models/NumberOnly.ts | 4 +-- .../models/ObjectWithDeprecatedFields.ts | 4 +-- .../snakecase-discriminator/models/Order.ts | 4 +-- .../models/OuterComposite.ts | 4 +-- .../models/OuterObjectWithEnumProperty.ts | 6 ++-- .../snakecase-discriminator/models/Pet.ts | 8 ++--- .../models/ReadOnlyFirst.ts | 4 +-- .../snakecase-discriminator/models/Return.ts | 4 +-- .../models/SpecialModelName.ts | 4 +-- .../snakecase-discriminator/models/Tag.ts | 4 +-- .../snakecase-discriminator/models/User.ts | 4 +-- .../builds/with-interfaces/models/Category.ts | 4 +-- .../models/ModelApiResponse.ts | 4 +-- .../builds/with-interfaces/models/Order.ts | 4 +-- .../builds/with-interfaces/models/Pet.ts | 8 ++--- .../builds/with-interfaces/models/Tag.ts | 4 +-- .../builds/with-interfaces/models/User.ts | 4 +-- .../with-npm-version/src/models/Category.ts | 4 +-- .../src/models/ModelApiResponse.ts | 4 +-- .../with-npm-version/src/models/Order.ts | 4 +-- .../builds/with-npm-version/src/models/Pet.ts | 8 ++--- .../builds/with-npm-version/src/models/Tag.ts | 4 +-- .../with-npm-version/src/models/User.ts | 4 +-- .../with-string-enums/apis/DefaultApi.ts | 4 +-- .../models/EnumPatternObject.ts | 8 ++--- .../FakeEnumRequestGetInline200Response.ts | 4 +-- 150 files changed, 248 insertions(+), 544 deletions(-) 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 c4592a9a3834..e88146a7eb88 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 @@ -31,16 +31,14 @@ export interface Club { * @type {Owner} * @memberof Club */ - owner?: Owner | null; + owner?: Owner; } /** * Check if a given object implements the Club interface. */ export function instanceOfClub(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ClubFromJSON(json: any): Club { 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 1e309ea8dab6..6be9b11728ba 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 @@ -31,9 +31,7 @@ export interface Owner { * Check if a given object implements the Owner interface. */ export function instanceOfOwner(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OwnerFromJSON(json: any): Owner { 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 45e45b1a2eac..8ae80041ec65 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 @@ -38,9 +38,7 @@ export interface Club { * Check if a given object implements the Club interface. */ export function instanceOfClub(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ClubFromJSON(json: any): Club { 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 1e309ea8dab6..6be9b11728ba 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 @@ -31,9 +31,7 @@ export interface Owner { * Check if a given object implements the Owner interface. */ export function instanceOfOwner(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OwnerFromJSON(json: any): Owner { 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 77f5d8b800e6..bbd3320b0da2 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 @@ -37,9 +37,7 @@ export interface AdditionalPropertiesClass { * Check if a given object implements the AdditionalPropertiesClass interface. */ export function instanceOfAdditionalPropertiesClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function AdditionalPropertiesClassFromJSON(json: any): AdditionalPropertiesClass { 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 8e796d9f1920..5141e93860bd 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 @@ -44,9 +44,7 @@ export interface AllOfWithSingleRef { * Check if a given object implements the AllOfWithSingleRef interface. */ export function instanceOfAllOfWithSingleRef(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function AllOfWithSingleRefFromJSON(json: any): AllOfWithSingleRef { 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 96865ae33f74..b73c9a196004 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 @@ -42,10 +42,8 @@ export interface Animal { * Check if a given object implements the Animal interface. */ export function instanceOfAnimal(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "className" in value; - - return isInstance; + if (!('className' in value)) return false; + return true; } export function AnimalFromJSON(json: any): Animal { 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 93dbe901e11e..6a78fd045016 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 @@ -31,9 +31,7 @@ export interface ArrayOfArrayOfNumberOnly { * Check if a given object implements the ArrayOfArrayOfNumberOnly interface. */ export function instanceOfArrayOfArrayOfNumberOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ArrayOfArrayOfNumberOnlyFromJSON(json: any): ArrayOfArrayOfNumberOnly { 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 df1fdeeb9dd0..a0387227bb7e 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 @@ -31,9 +31,7 @@ export interface ArrayOfNumberOnly { * Check if a given object implements the ArrayOfNumberOnly interface. */ export function instanceOfArrayOfNumberOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ArrayOfNumberOnlyFromJSON(json: any): ArrayOfNumberOnly { 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 0558f27a2f6e..1ce94b762fcb 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 @@ -50,9 +50,7 @@ export interface ArrayTest { * Check if a given object implements the ArrayTest interface. */ export function instanceOfArrayTest(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ArrayTestFromJSON(json: any): ArrayTest { 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 6f06900a3437..0b29fa564ea5 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 @@ -62,9 +62,7 @@ export interface Capitalization { * Check if a given object implements the Capitalization interface. */ export function instanceOfCapitalization(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CapitalizationFromJSON(json: any): Capitalization { 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 325b72549b57..73d368191f2b 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 @@ -38,9 +38,7 @@ export interface Cat extends Animal { * Check if a given object implements the Cat interface. */ export function instanceOfCat(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CatFromJSON(json: any): Cat { 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 f05f090bf335..87cea65fe6f5 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 @@ -37,10 +37,8 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - - return isInstance; + if (!('name' in value)) return false; + return true; } export function CategoryFromJSON(json: any): Category { 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 2640a539c3b4..1c3d993effd8 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 @@ -40,9 +40,7 @@ export interface ChildWithNullable extends ParentWithNullable { * Check if a given object implements the ChildWithNullable interface. */ export function instanceOfChildWithNullable(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ChildWithNullableFromJSON(json: any): ChildWithNullable { 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 f01f13e44796..7292e552629a 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 @@ -31,9 +31,7 @@ export interface ClassModel { * Check if a given object implements the ClassModel interface. */ export function instanceOfClassModel(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ClassModelFromJSON(json: any): ClassModel { 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 961b449ca3ef..80790e10b9db 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 @@ -31,9 +31,7 @@ export interface Client { * Check if a given object implements the Client interface. */ export function instanceOfClient(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ClientFromJSON(json: any): 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 65e56c1313b5..d5557822fbe1 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 @@ -31,9 +31,7 @@ export interface DeprecatedObject { * Check if a given object implements the DeprecatedObject interface. */ export function instanceOfDeprecatedObject(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function DeprecatedObjectFromJSON(json: any): DeprecatedObject { 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 72fcebd1e5d6..71c7d929582f 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 @@ -38,9 +38,7 @@ export interface Dog extends Animal { * Check if a given object implements the Dog interface. */ export function instanceOfDog(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function DogFromJSON(json: any): Dog { 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 56fdfaf91e55..1b10872b3afb 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 @@ -57,9 +57,7 @@ export type EnumArraysArrayEnumEnum = typeof EnumArraysArrayEnumEnum[keyof typeo * Check if a given object implements the EnumArrays interface. */ export function instanceOfEnumArrays(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function EnumArraysFromJSON(json: any): EnumArrays { 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 e6067424d707..633bb0999d1f 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 @@ -73,7 +73,7 @@ export interface EnumTest { * @type {OuterEnum} * @memberof EnumTest */ - outerEnum?: OuterEnum | null; + outerEnum?: OuterEnum; /** * * @type {OuterEnumInteger} @@ -138,10 +138,8 @@ export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof * Check if a given object implements the EnumTest interface. */ export function instanceOfEnumTest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "enumStringRequired" in value; - - return isInstance; + if (!('enumStringRequired' in value)) return false; + return true; } export function EnumTestFromJSON(json: any): EnumTest { 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 b246a7fb0038..e9dd2f055ab6 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 @@ -37,9 +37,7 @@ export interface FakeBigDecimalMap200Response { * Check if a given object implements the FakeBigDecimalMap200Response interface. */ export function instanceOfFakeBigDecimalMap200Response(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FakeBigDecimalMap200ResponseFromJSON(json: any): FakeBigDecimalMap200Response { 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 c891873688e6..cb459d89a200 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 @@ -37,9 +37,7 @@ export interface FileSchemaTestClass { * Check if a given object implements the FileSchemaTestClass interface. */ export function instanceOfFileSchemaTestClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FileSchemaTestClassFromJSON(json: any): FileSchemaTestClass { 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 c642344ac96f..eb4a11882665 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 @@ -31,9 +31,7 @@ export interface Foo { * Check if a given object implements the Foo interface. */ export function instanceOfFoo(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FooFromJSON(json: any): Foo { 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 bb198b05b7bc..4ade37d0c4c5 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 @@ -38,9 +38,7 @@ export interface FooGetDefaultResponse { * Check if a given object implements the FooGetDefaultResponse interface. */ export function instanceOfFooGetDefaultResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FooGetDefaultResponseFromJSON(json: any): FooGetDefaultResponse { 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 43e8ef88e3ad..97b1af1c9d67 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 @@ -128,13 +128,11 @@ export interface FormatTest { * Check if a given object implements the FormatTest interface. */ export function instanceOfFormatTest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "number" in value; - isInstance = isInstance && "_byte" in value; - isInstance = isInstance && "date" in value; - isInstance = isInstance && "password" in value; - - return isInstance; + if (!('number' in value)) return false; + if (!('_byte' in value)) return false; + if (!('date' in value)) return false; + if (!('password' in value)) return false; + return true; } export function FormatTestFromJSON(json: any): FormatTest { 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 cbda481a9c64..e59842cd3e2f 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 @@ -37,9 +37,7 @@ export interface HasOnlyReadOnly { * Check if a given object implements the HasOnlyReadOnly interface. */ export function instanceOfHasOnlyReadOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function HasOnlyReadOnlyFromJSON(json: any): HasOnlyReadOnly { 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 2470c4717626..ce90c996a4a8 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 @@ -24,16 +24,14 @@ export interface HealthCheckResult { * @type {string} * @memberof HealthCheckResult */ - nullableMessage?: string | null; + nullableMessage?: string; } /** * Check if a given object implements the HealthCheckResult interface. */ export function instanceOfHealthCheckResult(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function HealthCheckResultFromJSON(json: any): HealthCheckResult { 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 eaf10ce2ace8..61735bf041dd 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 @@ -31,9 +31,7 @@ export interface List { * Check if a given object implements the List interface. */ export function instanceOfList(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ListFromJSON(json: any): List { 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 edce7e732176..fd75eee91460 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 @@ -60,9 +60,7 @@ export type MapTestMapOfEnumStringEnum = typeof MapTestMapOfEnumStringEnum[keyof * Check if a given object implements the MapTest interface. */ export function instanceOfMapTest(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function MapTestFromJSON(json: any): MapTest { 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 3e5119bad70e..4097913c88f5 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 @@ -50,9 +50,7 @@ export interface MixedPropertiesAndAdditionalPropertiesClass { * Check if a given object implements the MixedPropertiesAndAdditionalPropertiesClass interface. */ export function instanceOfMixedPropertiesAndAdditionalPropertiesClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function MixedPropertiesAndAdditionalPropertiesClassFromJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { 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 079eb5089f44..5a702847aacc 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 @@ -37,9 +37,7 @@ export interface Model200Response { * Check if a given object implements the Model200Response interface. */ export function instanceOfModel200Response(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function Model200ResponseFromJSON(json: any): Model200Response { 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 26a56914ea84..1e94140a1edb 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 093f1fc04ed7..09b9e2a02cf2 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 @@ -31,9 +31,7 @@ export interface ModelFile { * Check if a given object implements the ModelFile interface. */ export function instanceOfModelFile(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelFileFromJSON(json: any): ModelFile { 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 994a87066062..be9875602c28 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 @@ -49,10 +49,8 @@ export interface Name { * Check if a given object implements the Name interface. */ export function instanceOfName(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - - return isInstance; + if (!('name' in value)) return false; + return true; } export function NameFromJSON(json: any): 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 f7fadc861af9..4c6ba1adf742 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 @@ -25,49 +25,49 @@ export interface NullableClass { * @type {number} * @memberof NullableClass */ - integerProp?: number | null; + integerProp?: number; /** * * @type {number} * @memberof NullableClass */ - numberProp?: number | null; + numberProp?: number; /** * * @type {boolean} * @memberof NullableClass */ - booleanProp?: boolean | null; + booleanProp?: boolean; /** * * @type {string} * @memberof NullableClass */ - stringProp?: string | null; + stringProp?: string; /** * * @type {Date} * @memberof NullableClass */ - dateProp?: Date | null; + dateProp?: Date; /** * * @type {Date} * @memberof NullableClass */ - datetimeProp?: Date | null; + datetimeProp?: Date; /** * * @type {Array} * @memberof NullableClass */ - arrayNullableProp?: Array | null; + arrayNullableProp?: Array; /** * * @type {Array} * @memberof NullableClass */ - arrayAndItemsNullableProp?: Array | null; + arrayAndItemsNullableProp?: Array; /** * * @type {Array} @@ -79,13 +79,13 @@ export interface NullableClass { * @type {{ [key: string]: object; }} * @memberof NullableClass */ - objectNullableProp?: { [key: string]: object; } | null; + objectNullableProp?: { [key: string]: object; }; /** * * @type {{ [key: string]: object | null; }} * @memberof NullableClass */ - objectAndItemsNullableProp?: { [key: string]: object | null; } | null; + objectAndItemsNullableProp?: { [key: string]: object | null; }; /** * * @type {{ [key: string]: object | null; }} @@ -98,9 +98,7 @@ export interface NullableClass { * Check if a given object implements the NullableClass interface. */ export function instanceOfNullableClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function NullableClassFromJSON(json: any): NullableClass { 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 83ca620556e5..144e5363127c 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 @@ -31,9 +31,7 @@ export interface NumberOnly { * Check if a given object implements the NumberOnly interface. */ export function instanceOfNumberOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function NumberOnlyFromJSON(json: any): NumberOnly { 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 39e71c83ad99..518d87ecfe9e 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 @@ -59,9 +59,7 @@ export interface ObjectWithDeprecatedFields { * Check if a given object implements the ObjectWithDeprecatedFields interface. */ export function instanceOfObjectWithDeprecatedFields(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ObjectWithDeprecatedFieldsFromJSON(json: any): ObjectWithDeprecatedFields { 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 05f01c27ff38..815c7531b1f2 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 081204e9e36a..07771ec7202e 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 @@ -43,9 +43,7 @@ export interface OuterComposite { * Check if a given object implements the OuterComposite interface. */ export function instanceOfOuterComposite(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OuterCompositeFromJSON(json: any): OuterComposite { 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 cfe2e74e1d6d..4e746368a7d9 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 @@ -38,10 +38,8 @@ export interface OuterObjectWithEnumProperty { * Check if a given object implements the OuterObjectWithEnumProperty interface. */ export function instanceOfOuterObjectWithEnumProperty(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "value" in value; - - return isInstance; + if (!('value' in value)) return false; + return true; } export function OuterObjectWithEnumPropertyFromJSON(json: any): OuterObjectWithEnumProperty { 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 2a42b92605fd..be4fc5448c75 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 @@ -34,7 +34,7 @@ export interface ParentWithNullable { * @type {string} * @memberof ParentWithNullable */ - nullableProperty?: string | null; + nullableProperty?: string; } @@ -51,9 +51,7 @@ export type ParentWithNullableTypeEnum = typeof ParentWithNullableTypeEnum[keyof * Check if a given object implements the ParentWithNullable interface. */ export function instanceOfParentWithNullable(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ParentWithNullableFromJSON(json: any): ParentWithNullable { 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 8a16ba594e23..4c79710cd38b 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 @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 0cd5d709cb38..9269c0f7b44e 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 @@ -37,9 +37,7 @@ export interface ReadOnlyFirst { * Check if a given object implements the ReadOnlyFirst interface. */ export function instanceOfReadOnlyFirst(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ReadOnlyFirstFromJSON(json: any): ReadOnlyFirst { 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 94243865ac96..cd481d2e842d 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 @@ -31,9 +31,7 @@ export interface Return { * Check if a given object implements the Return interface. */ export function instanceOfReturn(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ReturnFromJSON(json: any): Return { 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 f13fbbea9d57..7b9780125d22 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 @@ -31,9 +31,7 @@ export interface SpecialModelName { * Check if a given object implements the SpecialModelName interface. */ export function instanceOfSpecialModelName(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function SpecialModelNameFromJSON(json: any): SpecialModelName { 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 593df16d395e..4b8840070b42 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 2eb6165b35e5..67834a258010 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 @@ -32,9 +32,7 @@ export interface TestInlineFreeformAdditionalPropertiesRequest { * Check if a given object implements the TestInlineFreeformAdditionalPropertiesRequest interface. */ export function instanceOfTestInlineFreeformAdditionalPropertiesRequest(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TestInlineFreeformAdditionalPropertiesRequestFromJSON(json: any): TestInlineFreeformAdditionalPropertiesRequest { 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 c8d0e3e5e0a3..7bdc391dd43c 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 @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { 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 7465414725e9..4ea5eba7fe7d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts @@ -37,9 +37,7 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CategoryFromJSON(json: any): Category { 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 04685e0915f1..69fee6449c2c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 e7533030c3e5..3246795cb314 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 9d0530abd1ba..f9dda35da96a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 1f10126ef079..3f159accd658 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 6e0aefd2ff81..fcd03bd8bf7f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { diff --git a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts index 198072bfc065..ccf7d1c2ffcf 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts @@ -40,9 +40,9 @@ export interface FakeEnumRequestGetInlineRequest { export interface FakeEnumRequestGetRefRequest { stringEnum?: StringEnum; - nullableStringEnum?: StringEnum | null; + nullableStringEnum?: StringEnum; numberEnum?: NumberEnum; - nullableNumberEnum?: NumberEnum | null; + nullableNumberEnum?: NumberEnum; } export interface FakeEnumRequestPostInlineRequest { 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 7013d67ff4eb..f217c10419df 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts @@ -43,7 +43,7 @@ export interface EnumPatternObject { * @type {StringEnum} * @memberof EnumPatternObject */ - nullableStringEnum?: StringEnum | null; + nullableStringEnum?: StringEnum; /** * * @type {NumberEnum} @@ -55,16 +55,14 @@ export interface EnumPatternObject { * @type {NumberEnum} * @memberof EnumPatternObject */ - nullableNumberEnum?: NumberEnum | null; + nullableNumberEnum?: NumberEnum; } /** * Check if a given object implements the EnumPatternObject interface. */ export function instanceOfEnumPatternObject(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function EnumPatternObjectFromJSON(json: any): EnumPatternObject { 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 a3676a4d4146..e995231c6ab1 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -91,9 +91,7 @@ export type FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum = typeof F * Check if a given object implements the FakeEnumRequestGetInline200Response interface. */ export function instanceOfFakeEnumRequestGetInline200Response(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnumRequestGetInline200Response { 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 7465414725e9..4ea5eba7fe7d 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 @@ -37,9 +37,7 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CategoryFromJSON(json: any): Category { 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 04685e0915f1..69fee6449c2c 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 e7533030c3e5..3246795cb314 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 9d0530abd1ba..f9dda35da96a 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 @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 1f10126ef079..3f159accd658 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 6e0aefd2ff81..fcd03bd8bf7f 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 @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { 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 7465414725e9..4ea5eba7fe7d 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 @@ -37,9 +37,7 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CategoryFromJSON(json: any): Category { 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 04685e0915f1..69fee6449c2c 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 e7533030c3e5..3246795cb314 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 9d0530abd1ba..f9dda35da96a 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 @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 1f10126ef079..3f159accd658 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 6e0aefd2ff81..fcd03bd8bf7f 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 @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { 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 7465414725e9..4ea5eba7fe7d 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 @@ -37,9 +37,7 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CategoryFromJSON(json: any): Category { 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 04685e0915f1..69fee6449c2c 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 e7533030c3e5..3246795cb314 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 9d0530abd1ba..f9dda35da96a 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 @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 1f10126ef079..3f159accd658 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 6e0aefd2ff81..fcd03bd8bf7f 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 @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { 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 7465414725e9..4ea5eba7fe7d 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 @@ -37,9 +37,7 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CategoryFromJSON(json: any): Category { 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 cda708df6a28..0fda53e16f64 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 @@ -38,10 +38,8 @@ export interface DefaultMetaOnlyResponse { * Check if a given object implements the DefaultMetaOnlyResponse interface. */ export function instanceOfDefaultMetaOnlyResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function DefaultMetaOnlyResponseFromJSON(json: any): DefaultMetaOnlyResponse { 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 4a4c161767ae..7d02ae9622e9 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 @@ -50,10 +50,8 @@ export interface FindPetsByStatusResponse { * Check if a given object implements the FindPetsByStatusResponse interface. */ export function instanceOfFindPetsByStatusResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function FindPetsByStatusResponseFromJSON(json: any): FindPetsByStatusResponse { 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 9aa48dee6d31..29886e8f221c 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 @@ -50,10 +50,8 @@ export interface FindPetsByUserResponse { * Check if a given object implements the FindPetsByUserResponse interface. */ export function instanceOfFindPetsByUserResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function FindPetsByUserResponseFromJSON(json: any): FindPetsByUserResponse { 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 9ec02e4acfdc..e9e059de4907 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 @@ -44,10 +44,8 @@ export interface GetBehaviorPermissionsResponse { * Check if a given object implements the GetBehaviorPermissionsResponse interface. */ export function instanceOfGetBehaviorPermissionsResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function GetBehaviorPermissionsResponseFromJSON(json: any): GetBehaviorPermissionsResponse { 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 959744e3bd9e..1651f1470a97 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 @@ -50,10 +50,8 @@ export interface GetBehaviorTypeResponse { * Check if a given object implements the GetBehaviorTypeResponse interface. */ export function instanceOfGetBehaviorTypeResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function GetBehaviorTypeResponseFromJSON(json: any): GetBehaviorTypeResponse { 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 272ab8e1e51e..b9b657b8920a 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 @@ -50,10 +50,8 @@ export interface GetMatchingPartsResponse { * Check if a given object implements the GetMatchingPartsResponse interface. */ export function instanceOfGetMatchingPartsResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function GetMatchingPartsResponseFromJSON(json: any): GetMatchingPartsResponse { 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 f5bb8efeb87a..0ad8b63bc5a0 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 @@ -50,10 +50,8 @@ export interface GetPetPartTypeResponse { * Check if a given object implements the GetPetPartTypeResponse interface. */ export function instanceOfGetPetPartTypeResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function GetPetPartTypeResponseFromJSON(json: any): GetPetPartTypeResponse { 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 4e0e909fec2f..b65e06f51385 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 @@ -37,11 +37,9 @@ export interface ItemId { * Check if a given object implements the ItemId interface. */ export function instanceOfItemId(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - isInstance = isInstance && "type" in value; - - return isInstance; + if (!('id' in value)) return false; + if (!('type' in value)) return false; + return true; } export function ItemIdFromJSON(json: any): ItemId { 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 2e4f66cb3c10..31abfffb9f05 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 @@ -44,11 +44,9 @@ export interface MatchingParts { * Check if a given object implements the MatchingParts interface. */ export function instanceOfMatchingParts(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "connected" in value; - isInstance = isInstance && "related" in value; - - return isInstance; + if (!('connected' in value)) return false; + if (!('related' in value)) return false; + return true; } export function MatchingPartsFromJSON(json: any): MatchingParts { 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 04685e0915f1..69fee6449c2c 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 9f3a22649b18..bf43c05a4481 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 @@ -56,10 +56,8 @@ export interface ModelError { * Check if a given object implements the ModelError interface. */ export function instanceOfModelError(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "type" in value; - - return isInstance; + if (!('type' in value)) return false; + return true; } export function ModelErrorFromJSON(json: any): ModelError { 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 e7533030c3e5..3246795cb314 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 0cfad223cb16..13136484da99 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 @@ -37,11 +37,9 @@ export interface Part { * Check if a given object implements the Part interface. */ export function instanceOfPart(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - isInstance = isInstance && "name" in value; - - return isInstance; + if (!('id' in value)) return false; + if (!('name' in value)) return false; + return true; } export function PartFromJSON(json: any): Part { 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 823e8bca3c39..c2e61543b485 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 @@ -188,23 +188,21 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - isInstance = isInstance && "otherFriendIds" in value; - isInstance = isInstance && "friendAge" in value; - isInstance = isInstance && "age" in value; - isInstance = isInstance && "isHappy" in value; - isInstance = isInstance && "isTall" in value; - isInstance = isInstance && "category" in value; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - isInstance = isInstance && "warningStatus" in value; - isInstance = isInstance && "alternateStatus" in value; - isInstance = isInstance && "otherDepStatuses" in value; - isInstance = isInstance && "tags" in value; - isInstance = isInstance && "status" in value; - - return isInstance; + if (!('id' in value)) return false; + if (!('otherFriendIds' in value)) return false; + if (!('friendAge' in value)) return false; + if (!('age' in value)) return false; + if (!('isHappy' in value)) return false; + if (!('isTall' in value)) return false; + if (!('category' in value)) return false; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + if (!('warningStatus' in value)) return false; + if (!('alternateStatus' in value)) return false; + if (!('otherDepStatuses' in value)) return false; + if (!('tags' in value)) return false; + if (!('status' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 dc670c88d8a4..a3a3020f239b 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 @@ -44,10 +44,8 @@ export interface PetRegionsResponse { * Check if a given object implements the PetRegionsResponse interface. */ export function instanceOfPetRegionsResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "meta" in value; - - return isInstance; + if (!('meta' in value)) return false; + return true; } export function PetRegionsResponseFromJSON(json: any): PetRegionsResponse { 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 ab30aa27af6b..940ea556e36b 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 @@ -100,10 +100,8 @@ export type ResponseMetaCodeEnum = typeof ResponseMetaCodeEnum[keyof typeof Resp * Check if a given object implements the ResponseMeta interface. */ export function instanceOfResponseMeta(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "code" in value; - - return isInstance; + if (!('code' in value)) return false; + return true; } export function ResponseMetaFromJSON(json: any): ResponseMeta { 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 1f10126ef079..3f159accd658 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 037f803a4c0b..068c78b35e84 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 @@ -85,11 +85,9 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - isInstance = isInstance && "subUser2" in value; - - return isInstance; + if (!('id' in value)) return false; + if (!('subUser2' in value)) return false; + return true; } export function UserFromJSON(json: any): User { 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 77f5d8b800e6..bbd3320b0da2 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 @@ -37,9 +37,7 @@ export interface AdditionalPropertiesClass { * Check if a given object implements the AdditionalPropertiesClass interface. */ export function instanceOfAdditionalPropertiesClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function AdditionalPropertiesClassFromJSON(json: any): AdditionalPropertiesClass { 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 8e796d9f1920..5141e93860bd 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 @@ -44,9 +44,7 @@ export interface AllOfWithSingleRef { * Check if a given object implements the AllOfWithSingleRef interface. */ export function instanceOfAllOfWithSingleRef(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function AllOfWithSingleRefFromJSON(json: any): AllOfWithSingleRef { 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 7975ca6d801e..3280f1674d55 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 @@ -42,10 +42,8 @@ export interface Animal { * Check if a given object implements the Animal interface. */ export function instanceOfAnimal(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "className" in value; - - return isInstance; + if (!('className' in value)) return false; + return true; } export function AnimalFromJSON(json: any): Animal { 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 93dbe901e11e..6a78fd045016 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 @@ -31,9 +31,7 @@ export interface ArrayOfArrayOfNumberOnly { * Check if a given object implements the ArrayOfArrayOfNumberOnly interface. */ export function instanceOfArrayOfArrayOfNumberOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ArrayOfArrayOfNumberOnlyFromJSON(json: any): ArrayOfArrayOfNumberOnly { 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 df1fdeeb9dd0..a0387227bb7e 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 @@ -31,9 +31,7 @@ export interface ArrayOfNumberOnly { * Check if a given object implements the ArrayOfNumberOnly interface. */ export function instanceOfArrayOfNumberOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ArrayOfNumberOnlyFromJSON(json: any): ArrayOfNumberOnly { 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 0558f27a2f6e..1ce94b762fcb 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 @@ -50,9 +50,7 @@ export interface ArrayTest { * Check if a given object implements the ArrayTest interface. */ export function instanceOfArrayTest(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ArrayTestFromJSON(json: any): ArrayTest { 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 6f06900a3437..0b29fa564ea5 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 @@ -62,9 +62,7 @@ export interface Capitalization { * Check if a given object implements the Capitalization interface. */ export function instanceOfCapitalization(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CapitalizationFromJSON(json: any): Capitalization { 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 325b72549b57..73d368191f2b 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 @@ -38,9 +38,7 @@ export interface Cat extends Animal { * Check if a given object implements the Cat interface. */ export function instanceOfCat(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CatFromJSON(json: any): Cat { 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 f05f090bf335..87cea65fe6f5 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 @@ -37,10 +37,8 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - - return isInstance; + if (!('name' in value)) return false; + return true; } export function CategoryFromJSON(json: any): Category { 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 f01f13e44796..7292e552629a 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 @@ -31,9 +31,7 @@ export interface ClassModel { * Check if a given object implements the ClassModel interface. */ export function instanceOfClassModel(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ClassModelFromJSON(json: any): ClassModel { 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 961b449ca3ef..80790e10b9db 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 @@ -31,9 +31,7 @@ export interface Client { * Check if a given object implements the Client interface. */ export function instanceOfClient(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ClientFromJSON(json: any): 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 65e56c1313b5..d5557822fbe1 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 @@ -31,9 +31,7 @@ export interface DeprecatedObject { * Check if a given object implements the DeprecatedObject interface. */ export function instanceOfDeprecatedObject(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function DeprecatedObjectFromJSON(json: any): DeprecatedObject { 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 72fcebd1e5d6..71c7d929582f 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 @@ -38,9 +38,7 @@ export interface Dog extends Animal { * Check if a given object implements the Dog interface. */ export function instanceOfDog(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function DogFromJSON(json: any): Dog { 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 56fdfaf91e55..1b10872b3afb 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 @@ -57,9 +57,7 @@ export type EnumArraysArrayEnumEnum = typeof EnumArraysArrayEnumEnum[keyof typeo * Check if a given object implements the EnumArrays interface. */ export function instanceOfEnumArrays(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function EnumArraysFromJSON(json: any): EnumArrays { 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 e6067424d707..633bb0999d1f 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 @@ -73,7 +73,7 @@ export interface EnumTest { * @type {OuterEnum} * @memberof EnumTest */ - outerEnum?: OuterEnum | null; + outerEnum?: OuterEnum; /** * * @type {OuterEnumInteger} @@ -138,10 +138,8 @@ export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof * Check if a given object implements the EnumTest interface. */ export function instanceOfEnumTest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "enumStringRequired" in value; - - return isInstance; + if (!('enumStringRequired' in value)) return false; + return true; } export function EnumTestFromJSON(json: any): EnumTest { 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 b246a7fb0038..e9dd2f055ab6 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 @@ -37,9 +37,7 @@ export interface FakeBigDecimalMap200Response { * Check if a given object implements the FakeBigDecimalMap200Response interface. */ export function instanceOfFakeBigDecimalMap200Response(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FakeBigDecimalMap200ResponseFromJSON(json: any): FakeBigDecimalMap200Response { 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 c891873688e6..cb459d89a200 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 @@ -37,9 +37,7 @@ export interface FileSchemaTestClass { * Check if a given object implements the FileSchemaTestClass interface. */ export function instanceOfFileSchemaTestClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FileSchemaTestClassFromJSON(json: any): FileSchemaTestClass { 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 c642344ac96f..eb4a11882665 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 @@ -31,9 +31,7 @@ export interface Foo { * Check if a given object implements the Foo interface. */ export function instanceOfFoo(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FooFromJSON(json: any): Foo { 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 bb198b05b7bc..4ade37d0c4c5 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 @@ -38,9 +38,7 @@ export interface FooGetDefaultResponse { * Check if a given object implements the FooGetDefaultResponse interface. */ export function instanceOfFooGetDefaultResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FooGetDefaultResponseFromJSON(json: any): FooGetDefaultResponse { 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 43e8ef88e3ad..97b1af1c9d67 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 @@ -128,13 +128,11 @@ export interface FormatTest { * Check if a given object implements the FormatTest interface. */ export function instanceOfFormatTest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "number" in value; - isInstance = isInstance && "_byte" in value; - isInstance = isInstance && "date" in value; - isInstance = isInstance && "password" in value; - - return isInstance; + if (!('number' in value)) return false; + if (!('_byte' in value)) return false; + if (!('date' in value)) return false; + if (!('password' in value)) return false; + return true; } export function FormatTestFromJSON(json: any): FormatTest { 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 cbda481a9c64..e59842cd3e2f 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 @@ -37,9 +37,7 @@ export interface HasOnlyReadOnly { * Check if a given object implements the HasOnlyReadOnly interface. */ export function instanceOfHasOnlyReadOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function HasOnlyReadOnlyFromJSON(json: any): HasOnlyReadOnly { 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 2470c4717626..ce90c996a4a8 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 @@ -24,16 +24,14 @@ export interface HealthCheckResult { * @type {string} * @memberof HealthCheckResult */ - nullableMessage?: string | null; + nullableMessage?: string; } /** * Check if a given object implements the HealthCheckResult interface. */ export function instanceOfHealthCheckResult(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function HealthCheckResultFromJSON(json: any): HealthCheckResult { 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 eaf10ce2ace8..61735bf041dd 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 @@ -31,9 +31,7 @@ export interface List { * Check if a given object implements the List interface. */ export function instanceOfList(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ListFromJSON(json: any): List { 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 edce7e732176..fd75eee91460 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 @@ -60,9 +60,7 @@ export type MapTestMapOfEnumStringEnum = typeof MapTestMapOfEnumStringEnum[keyof * Check if a given object implements the MapTest interface. */ export function instanceOfMapTest(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function MapTestFromJSON(json: any): MapTest { 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 3e5119bad70e..4097913c88f5 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 @@ -50,9 +50,7 @@ export interface MixedPropertiesAndAdditionalPropertiesClass { * Check if a given object implements the MixedPropertiesAndAdditionalPropertiesClass interface. */ export function instanceOfMixedPropertiesAndAdditionalPropertiesClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function MixedPropertiesAndAdditionalPropertiesClassFromJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { 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 079eb5089f44..5a702847aacc 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 @@ -37,9 +37,7 @@ export interface Model200Response { * Check if a given object implements the Model200Response interface. */ export function instanceOfModel200Response(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function Model200ResponseFromJSON(json: any): Model200Response { 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 26a56914ea84..1e94140a1edb 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 093f1fc04ed7..09b9e2a02cf2 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 @@ -31,9 +31,7 @@ export interface ModelFile { * Check if a given object implements the ModelFile interface. */ export function instanceOfModelFile(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelFileFromJSON(json: any): ModelFile { 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 994a87066062..be9875602c28 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 @@ -49,10 +49,8 @@ export interface Name { * Check if a given object implements the Name interface. */ export function instanceOfName(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - - return isInstance; + if (!('name' in value)) return false; + return true; } export function NameFromJSON(json: any): 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 f7fadc861af9..4c6ba1adf742 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 @@ -25,49 +25,49 @@ export interface NullableClass { * @type {number} * @memberof NullableClass */ - integerProp?: number | null; + integerProp?: number; /** * * @type {number} * @memberof NullableClass */ - numberProp?: number | null; + numberProp?: number; /** * * @type {boolean} * @memberof NullableClass */ - booleanProp?: boolean | null; + booleanProp?: boolean; /** * * @type {string} * @memberof NullableClass */ - stringProp?: string | null; + stringProp?: string; /** * * @type {Date} * @memberof NullableClass */ - dateProp?: Date | null; + dateProp?: Date; /** * * @type {Date} * @memberof NullableClass */ - datetimeProp?: Date | null; + datetimeProp?: Date; /** * * @type {Array} * @memberof NullableClass */ - arrayNullableProp?: Array | null; + arrayNullableProp?: Array; /** * * @type {Array} * @memberof NullableClass */ - arrayAndItemsNullableProp?: Array | null; + arrayAndItemsNullableProp?: Array; /** * * @type {Array} @@ -79,13 +79,13 @@ export interface NullableClass { * @type {{ [key: string]: object; }} * @memberof NullableClass */ - objectNullableProp?: { [key: string]: object; } | null; + objectNullableProp?: { [key: string]: object; }; /** * * @type {{ [key: string]: object | null; }} * @memberof NullableClass */ - objectAndItemsNullableProp?: { [key: string]: object | null; } | null; + objectAndItemsNullableProp?: { [key: string]: object | null; }; /** * * @type {{ [key: string]: object | null; }} @@ -98,9 +98,7 @@ export interface NullableClass { * Check if a given object implements the NullableClass interface. */ export function instanceOfNullableClass(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function NullableClassFromJSON(json: any): NullableClass { 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 83ca620556e5..144e5363127c 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 @@ -31,9 +31,7 @@ export interface NumberOnly { * Check if a given object implements the NumberOnly interface. */ export function instanceOfNumberOnly(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function NumberOnlyFromJSON(json: any): NumberOnly { 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 39e71c83ad99..518d87ecfe9e 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 @@ -59,9 +59,7 @@ export interface ObjectWithDeprecatedFields { * Check if a given object implements the ObjectWithDeprecatedFields interface. */ export function instanceOfObjectWithDeprecatedFields(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ObjectWithDeprecatedFieldsFromJSON(json: any): ObjectWithDeprecatedFields { 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 05f01c27ff38..815c7531b1f2 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 081204e9e36a..07771ec7202e 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 @@ -43,9 +43,7 @@ export interface OuterComposite { * Check if a given object implements the OuterComposite interface. */ export function instanceOfOuterComposite(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OuterCompositeFromJSON(json: any): OuterComposite { 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 cfe2e74e1d6d..4e746368a7d9 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 @@ -38,10 +38,8 @@ export interface OuterObjectWithEnumProperty { * Check if a given object implements the OuterObjectWithEnumProperty interface. */ export function instanceOfOuterObjectWithEnumProperty(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "value" in value; - - return isInstance; + if (!('value' in value)) return false; + return true; } export function OuterObjectWithEnumPropertyFromJSON(json: any): OuterObjectWithEnumProperty { 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 8a16ba594e23..4c79710cd38b 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 @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 0cd5d709cb38..9269c0f7b44e 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 @@ -37,9 +37,7 @@ export interface ReadOnlyFirst { * Check if a given object implements the ReadOnlyFirst interface. */ export function instanceOfReadOnlyFirst(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ReadOnlyFirstFromJSON(json: any): ReadOnlyFirst { 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 94243865ac96..cd481d2e842d 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 @@ -31,9 +31,7 @@ export interface Return { * Check if a given object implements the Return interface. */ export function instanceOfReturn(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ReturnFromJSON(json: any): Return { 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 f13fbbea9d57..7b9780125d22 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 @@ -31,9 +31,7 @@ export interface SpecialModelName { * Check if a given object implements the SpecialModelName interface. */ export function instanceOfSpecialModelName(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function SpecialModelNameFromJSON(json: any): SpecialModelName { 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 593df16d395e..4b8840070b42 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 c8d0e3e5e0a3..7bdc391dd43c 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 @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { 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 7465414725e9..4ea5eba7fe7d 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 @@ -37,9 +37,7 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CategoryFromJSON(json: any): Category { 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 04685e0915f1..69fee6449c2c 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 e7533030c3e5..3246795cb314 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 9d0530abd1ba..f9dda35da96a 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 @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 1f10126ef079..3f159accd658 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 6e0aefd2ff81..fcd03bd8bf7f 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 @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { 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 7465414725e9..4ea5eba7fe7d 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 @@ -37,9 +37,7 @@ export interface Category { * Check if a given object implements the Category interface. */ export function instanceOfCategory(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function CategoryFromJSON(json: any): Category { 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 04685e0915f1..69fee6449c2c 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 @@ -43,9 +43,7 @@ export interface ModelApiResponse { * Check if a given object implements the ModelApiResponse interface. */ export function instanceOfModelApiResponse(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function ModelApiResponseFromJSON(json: any): ModelApiResponse { 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 e7533030c3e5..3246795cb314 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 @@ -73,9 +73,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu * Check if a given object implements the Order interface. */ export function instanceOfOrder(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function OrderFromJSON(json: any): Order { 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 9d0530abd1ba..f9dda35da96a 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 @@ -86,11 +86,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; * Check if a given object implements the Pet interface. */ export function instanceOfPet(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "photoUrls" in value; - - return isInstance; + if (!('name' in value)) return false; + if (!('photoUrls' in value)) return false; + return true; } export function PetFromJSON(json: any): Pet { 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 1f10126ef079..3f159accd658 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 @@ -37,9 +37,7 @@ export interface Tag { * Check if a given object implements the Tag interface. */ export function instanceOfTag(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function TagFromJSON(json: any): Tag { 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 6e0aefd2ff81..fcd03bd8bf7f 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 @@ -73,9 +73,7 @@ export interface User { * Check if a given object implements the User interface. */ export function instanceOfUser(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function UserFromJSON(json: any): User { diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts index 09bc772a5856..e46b49a1b571 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts @@ -40,9 +40,9 @@ export interface FakeEnumRequestGetInlineRequest { export interface FakeEnumRequestGetRefRequest { stringEnum?: StringEnum; - nullableStringEnum?: StringEnum | null; + nullableStringEnum?: StringEnum; numberEnum?: NumberEnum; - nullableNumberEnum?: NumberEnum | null; + nullableNumberEnum?: NumberEnum; } export interface FakeEnumRequestPostInlineRequest { 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 7013d67ff4eb..f217c10419df 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 @@ -43,7 +43,7 @@ export interface EnumPatternObject { * @type {StringEnum} * @memberof EnumPatternObject */ - nullableStringEnum?: StringEnum | null; + nullableStringEnum?: StringEnum; /** * * @type {NumberEnum} @@ -55,16 +55,14 @@ export interface EnumPatternObject { * @type {NumberEnum} * @memberof EnumPatternObject */ - nullableNumberEnum?: NumberEnum | null; + nullableNumberEnum?: NumberEnum; } /** * Check if a given object implements the EnumPatternObject interface. */ export function instanceOfEnumPatternObject(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function EnumPatternObjectFromJSON(json: any): EnumPatternObject { 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 2b643394ba7d..134ed1afca9a 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 @@ -87,9 +87,7 @@ export enum FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum { * Check if a given object implements the FakeEnumRequestGetInline200Response interface. */ export function instanceOfFakeEnumRequestGetInline200Response(value: object): boolean { - let isInstance = true; - - return isInstance; + return true; } export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnumRequestGetInline200Response { From fee69f0b79410ae4ca04e86badb960bca3cb53ed Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 10:23:14 +0100 Subject: [PATCH 6/8] Use `exists()` in generated API clients. --- .../src/main/resources/typescript-fetch/apis.mustache | 4 ++-- .../main/resources/typescript-fetch/runtime.mustache | 2 +- .../typescript-fetch/builds/allOf-nullable/runtime.ts | 2 +- .../typescript-fetch/builds/allOf-readonly/runtime.ts | 2 +- .../builds/default-v3.0/apis/FakeApi.ts | 10 +++++----- .../builds/default-v3.0/apis/PetApi.ts | 2 +- .../typescript-fetch/builds/default-v3.0/runtime.ts | 2 +- .../typescript-fetch/builds/default/apis/PetApi.ts | 2 +- .../typescript-fetch/builds/default/runtime.ts | 2 +- .../petstore/typescript-fetch/builds/enum/runtime.ts | 2 +- .../builds/es6-target/src/apis/PetApi.ts | 2 +- .../typescript-fetch/builds/es6-target/src/runtime.ts | 2 +- .../builds/multiple-parameters/apis/PetApi.ts | 2 +- .../builds/multiple-parameters/runtime.ts | 2 +- .../prefix-parameter-interfaces/src/apis/PetApi.ts | 2 +- .../builds/prefix-parameter-interfaces/src/runtime.ts | 2 +- .../builds/sagas-and-records/src/apis/PetApi.ts | 2 +- .../builds/sagas-and-records/src/runtime.ts | 2 +- .../builds/snakecase-discriminator/apis/FakeApi.ts | 10 +++++----- .../builds/snakecase-discriminator/apis/PetApi.ts | 2 +- .../builds/snakecase-discriminator/runtime.ts | 2 +- .../builds/with-interfaces/apis/PetApi.ts | 2 +- .../typescript-fetch/builds/with-interfaces/runtime.ts | 2 +- .../builds/with-npm-version/src/apis/PetApi.ts | 2 +- .../builds/with-npm-version/src/runtime.ts | 2 +- .../builds/with-string-enums/runtime.ts | 2 +- .../builds/without-runtime-checks/src/apis/PetApi.ts | 2 +- 27 files changed, 36 insertions(+), 36 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 2f9b0e4ad233..c0313a6a79ee 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -158,13 +158,13 @@ export class {{classname}} extends runtime.BaseAPI { {{/bodyParam}} {{#headerParams}} {{#isArray}} - if (requestParameters.{{paramName}}) { + if (runtime.exists(requestParameters, '{{paramName}}')) { headerParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters.{{paramName}}{{#uniqueItems}}){{/uniqueItems}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]); } {{/isArray}} {{^isArray}} - if (requestParameters.{{paramName}} !== undefined && requestParameters.{{paramName}} !== null) { + if (runtime.exists(requestParameters, '{{paramName}}')) { headerParameters['{{baseName}}'] = String(requestParameters.{{paramName}}); } diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache index 224f91c193ab..0db3b0ac14eb 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -302,7 +302,7 @@ export interface RequestOpts { {{^withoutRuntimeChecks}} export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } {{/withoutRuntimeChecks}} diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts index a2c3d39c60ef..3daec13bee5b 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts index a2c3d39c60ef..3daec13bee5b 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts index d3ae945edd1d..67ebc3c0b82f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts @@ -243,7 +243,7 @@ export class FakeApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; - if (requestParameters.header1 !== undefined && requestParameters.header1 !== null) { + if (runtime.exists(requestParameters, 'header1')) { headerParameters['header_1'] = String(requestParameters.header1); } @@ -745,11 +745,11 @@ export class FakeApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.enumHeaderStringArray) { + if (runtime.exists(requestParameters, 'enumHeaderStringArray')) { headerParameters['enum_header_string_array'] = requestParameters.enumHeaderStringArray.join(runtime.COLLECTION_FORMATS["csv"]); } - if (requestParameters.enumHeaderString !== undefined && requestParameters.enumHeaderString !== null) { + if (runtime.exists(requestParameters, 'enumHeaderString')) { headerParameters['enum_header_string'] = String(requestParameters.enumHeaderString); } @@ -831,11 +831,11 @@ export class FakeApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.requiredBooleanGroup !== undefined && requestParameters.requiredBooleanGroup !== null) { + if (runtime.exists(requestParameters, 'requiredBooleanGroup')) { headerParameters['required_boolean_group'] = String(requestParameters.requiredBooleanGroup); } - if (requestParameters.booleanGroup !== undefined && requestParameters.booleanGroup !== null) { + if (runtime.exists(requestParameters, 'booleanGroup')) { headerParameters['boolean_group'] = String(requestParameters.booleanGroup); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts index a2ed0b2a20b4..ca99a6f22ac4 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts @@ -125,7 +125,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts index 3066ba8b27f8..11b3fb68ebf9 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts index 7bc92d7b409d..1b1d0acd7fab 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts @@ -116,7 +116,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index 62e044bf623d..813bf0fb4dfe 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts index 99eb2c4e2042..4f1da922f6df 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts index 7bc92d7b409d..1b1d0acd7fab 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts @@ -116,7 +116,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts index 62e044bf623d..813bf0fb4dfe 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts index b577f23ebc5e..fed344c7b2db 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts @@ -116,7 +116,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts index 62e044bf623d..813bf0fb4dfe 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts index 6f29f6b70883..c5ba04cee3b9 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts @@ -116,7 +116,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts index 62e044bf623d..813bf0fb4dfe 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts index 7ccf7c1c691a..45de8f602ed9 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts @@ -145,7 +145,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts index 62e044bf623d..813bf0fb4dfe 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts index 1d3d82f2c654..ed42c8b96b01 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts @@ -221,7 +221,7 @@ export class FakeApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; - if (requestParameters.header1 !== undefined && requestParameters.header1 !== null) { + if (runtime.exists(requestParameters, 'header1')) { headerParameters['header_1'] = String(requestParameters.header1); } @@ -689,11 +689,11 @@ export class FakeApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.enumHeaderStringArray) { + if (runtime.exists(requestParameters, 'enumHeaderStringArray')) { headerParameters['enum_header_string_array'] = requestParameters.enumHeaderStringArray.join(runtime.COLLECTION_FORMATS["csv"]); } - if (requestParameters.enumHeaderString !== undefined && requestParameters.enumHeaderString !== null) { + if (runtime.exists(requestParameters, 'enumHeaderString')) { headerParameters['enum_header_string'] = String(requestParameters.enumHeaderString); } @@ -775,11 +775,11 @@ export class FakeApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.requiredBooleanGroup !== undefined && requestParameters.requiredBooleanGroup !== null) { + if (runtime.exists(requestParameters, 'requiredBooleanGroup')) { headerParameters['required_boolean_group'] = String(requestParameters.requiredBooleanGroup); } - if (requestParameters.booleanGroup !== undefined && requestParameters.booleanGroup !== null) { + if (runtime.exists(requestParameters, 'booleanGroup')) { headerParameters['boolean_group'] = String(requestParameters.booleanGroup); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts index a2ed0b2a20b4..ca99a6f22ac4 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts @@ -125,7 +125,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts index 3066ba8b27f8..11b3fb68ebf9 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts index 344cffc08ca1..b1a0a9c8a487 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts @@ -255,7 +255,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts index 62e044bf623d..813bf0fb4dfe 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts index 7bc92d7b409d..1b1d0acd7fab 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts @@ -116,7 +116,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts index 62e044bf623d..813bf0fb4dfe 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts index 99eb2c4e2042..4f1da922f6df 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/runtime.ts @@ -312,7 +312,7 @@ export interface RequestOpts { export function exists(json: any, key: string): boolean { const value = json[key]; - return value !== null && value !== undefined; + return value !== undefined && value !== null; } export function querystring(params: HTTPQuery, prefix: string = ''): string { diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts index f6d851b5253b..b9a384c6a6c5 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts @@ -110,7 +110,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { + if (runtime.exists(requestParameters, 'apiKey')) { headerParameters['api_key'] = String(requestParameters.apiKey); } From a88c7f1598728806883bce5131860018f8257283 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 10:37:15 +0100 Subject: [PATCH 7/8] Use `exists()` in generated API clients. --- .../resources/typescript-fetch/apis.mustache | 49 +-- .../builds/allOf-nullable/apis/DefaultApi.ts | 7 +- .../builds/allOf-readonly/apis/DefaultApi.ts | 7 +- .../default-v3.0/apis/AnotherFakeApi.ts | 7 +- .../builds/default-v3.0/apis/FakeApi.ts | 319 +++++++++++------- .../apis/FakeClassnameTags123Api.ts | 7 +- .../builds/default-v3.0/apis/PetApi.ts | 98 ++++-- .../builds/default-v3.0/apis/StoreApi.ts | 21 +- .../builds/default-v3.0/apis/UserApi.ts | 67 ++-- .../builds/default/apis/PetApi.ts | 78 +++-- .../builds/default/apis/StoreApi.ts | 21 +- .../builds/default/apis/UserApi.ts | 67 ++-- .../builds/enum/apis/DefaultApi.ts | 36 +- .../builds/es6-target/src/apis/PetApi.ts | 78 +++-- .../builds/es6-target/src/apis/StoreApi.ts | 21 +- .../builds/es6-target/src/apis/UserApi.ts | 67 ++-- .../builds/multiple-parameters/apis/PetApi.ts | 78 +++-- .../multiple-parameters/apis/StoreApi.ts | 21 +- .../multiple-parameters/apis/UserApi.ts | 67 ++-- .../src/apis/PetApi.ts | 78 +++-- .../src/apis/StoreApi.ts | 21 +- .../src/apis/UserApi.ts | 67 ++-- .../sagas-and-records/src/apis/BehaviorApi.ts | 14 +- .../sagas-and-records/src/apis/PetApi.ts | 117 ++++--- .../sagas-and-records/src/apis/PetPartApi.ts | 49 ++- .../sagas-and-records/src/apis/StoreApi.ts | 21 +- .../sagas-and-records/src/apis/UserApi.ts | 67 ++-- .../apis/AnotherFakeApi.ts | 7 +- .../snakecase-discriminator/apis/FakeApi.ts | 291 ++++++++++------ .../apis/FakeClassnameTags123Api.ts | 7 +- .../snakecase-discriminator/apis/PetApi.ts | 98 ++++-- .../snakecase-discriminator/apis/StoreApi.ts | 21 +- .../snakecase-discriminator/apis/UserApi.ts | 67 ++-- .../builds/with-interfaces/apis/PetApi.ts | 78 +++-- .../builds/with-interfaces/apis/StoreApi.ts | 21 +- .../builds/with-interfaces/apis/UserApi.ts | 67 ++-- .../with-npm-version/src/apis/PetApi.ts | 78 +++-- .../with-npm-version/src/apis/StoreApi.ts | 21 +- .../with-npm-version/src/apis/UserApi.ts | 67 ++-- .../with-string-enums/apis/DefaultApi.ts | 36 +- .../without-runtime-checks/src/apis/PetApi.ts | 78 +++-- .../src/apis/StoreApi.ts | 21 +- .../src/apis/UserApi.ts | 67 ++-- 43 files changed, 1697 insertions(+), 878 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index c0313a6a79ee..f2cfe345f1f6 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -108,7 +108,10 @@ export class {{classname}} extends runtime.BaseAPI { {{#allParams}} {{#required}} if (!runtime.exists(requestParameters, '{{paramName}}')) { - throw new runtime.RequiredError('{{paramName}}','Required parameter requestParameters.{{paramName}} was null or undefined when calling {{nickname}}.'); + throw new runtime.RequiredError( + '{{paramName}}', + 'Required parameter "{{paramName}}" was null or undefined when calling {{nickname}}().' + ); } {{/required}} @@ -117,27 +120,27 @@ export class {{classname}} extends runtime.BaseAPI { {{#queryParams}} {{#isArray}} - if (requestParameters.{{paramName}}) { + if (runtime.exists(requestParameters, '{{paramName}}')) { {{#isCollectionFormatMulti}} - queryParameters['{{baseName}}'] = requestParameters.{{paramName}}; + queryParameters['{{baseName}}'] = requestParameters['{{paramName}}']; {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - queryParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters.{{paramName}}{{#uniqueItems}}){{/uniqueItems}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]); + queryParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]); {{/isCollectionFormatMulti}} } {{/isArray}} {{^isArray}} - if (requestParameters.{{paramName}} !== undefined) { + if (runtime.exists(requestParameters, '{{paramName}}')) { {{#isDateTimeType}} - queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString(); + queryParameters['{{baseName}}'] = (requestParameters['{{paramName}}'] as any).toISOString(); {{/isDateTimeType}} {{^isDateTimeType}} {{#isDateType}} - queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString().substring(0,10); + queryParameters['{{baseName}}'] = (requestParameters['{{paramName}}'] as any).toISOString().substring(0,10); {{/isDateType}} {{^isDateType}} - queryParameters['{{baseName}}'] = requestParameters.{{paramName}}; + queryParameters['{{baseName}}'] = requestParameters['{{paramName}}']; {{/isDateType}} {{/isDateTimeType}} } @@ -159,13 +162,13 @@ export class {{classname}} extends runtime.BaseAPI { {{#headerParams}} {{#isArray}} if (runtime.exists(requestParameters, '{{paramName}}')) { - headerParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters.{{paramName}}{{#uniqueItems}}){{/uniqueItems}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]); + headerParameters['{{baseName}}'] = {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"]); } {{/isArray}} {{^isArray}} if (runtime.exists(requestParameters, '{{paramName}}')) { - headerParameters['{{baseName}}'] = String(requestParameters.{{paramName}}); + headerParameters['{{baseName}}'] = String(requestParameters['{{paramName}}']); } {{/isArray}} @@ -235,28 +238,28 @@ export class {{classname}} extends runtime.BaseAPI { {{#formParams}} {{#isArray}} - if (requestParameters.{{paramName}}) { + if (runtime.exists(requestParameters, '{{paramName}}')) { {{#isCollectionFormatMulti}} - requestParameters.{{paramName}}.forEach((element) => { + requestParameters['{{paramName}}'].forEach((element) => { formParams.append('{{baseName}}', element as any); }) {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - formParams.append('{{baseName}}', {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters.{{paramName}}{{#uniqueItems}}){{/uniqueItems}}.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"])); + formParams.append('{{baseName}}', {{#uniqueItems}}Array.from({{/uniqueItems}}requestParameters['{{paramName}}']{{#uniqueItems}}){{/uniqueItems}}!.join(runtime.COLLECTION_FORMATS["{{collectionFormat}}"])); {{/isCollectionFormatMulti}} } {{/isArray}} {{^isArray}} - if (requestParameters.{{paramName}} !== undefined) { + if (runtime.exists(requestParameters, '{{paramName}}')) { {{#isPrimitiveType}} - formParams.append('{{baseName}}', requestParameters.{{paramName}} as any); + formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any); {{/isPrimitiveType}} {{^isPrimitiveType}} {{^withoutRuntimeChecks}} - formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters.{{paramName}}))], { type: "application/json", })); + formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", })); {{/withoutRuntimeChecks}}{{#withoutRuntimeChecks}} - formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters.{{paramName}})], { type: "application/json", })); + formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", })); {{/withoutRuntimeChecks}} {{/isPrimitiveType}} } @@ -265,7 +268,7 @@ export class {{classname}} extends runtime.BaseAPI { {{/formParams}} {{/hasFormParams}} const response = await this.request({ - path: `{{{path}}}`{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters.{{paramName}}))){{/pathParams}}, + path: `{{{path}}}`{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters['{{paramName}}']))){{/pathParams}}, method: '{{httpMethod}}', headers: headerParameters, query: queryParameters, @@ -273,23 +276,23 @@ export class {{classname}} extends runtime.BaseAPI { {{#bodyParam}} {{#isContainer}} {{^withoutRuntimeChecks}} - body: requestParameters.{{paramName}}{{#isArray}}{{#items}}{{^isPrimitiveType}}.map({{datatype}}ToJSON){{/isPrimitiveType}}{{/items}}{{/isArray}}, + body: requestParameters['{{paramName}}']{{#isArray}}{{#items}}{{^isPrimitiveType}}!.map({{datatype}}ToJSON){{/isPrimitiveType}}{{/items}}{{/isArray}}, {{/withoutRuntimeChecks}} {{#withoutRuntimeChecks}} - body: requestParameters.{{paramName}}, + body: requestParameters['{{paramName}}'], {{/withoutRuntimeChecks}} {{/isContainer}} {{^isContainer}} {{^isPrimitiveType}} {{^withoutRuntimeChecks}} - body: {{dataType}}ToJSON(requestParameters.{{paramName}}), + body: {{dataType}}ToJSON(requestParameters['{{paramName}}']), {{/withoutRuntimeChecks}} {{#withoutRuntimeChecks}} - body: requestParameters.{{paramName}}, + body: requestParameters['{{paramName}}'], {{/withoutRuntimeChecks}} {{/isPrimitiveType}} {{#isPrimitiveType}} - body: requestParameters.{{paramName}} as any, + body: requestParameters['{{paramName}}'] as any, {{/isPrimitiveType}} {{/isContainer}} {{/bodyParam}} diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts index 9b56d7764afc..fd8a011fc7cd 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.ts @@ -35,7 +35,10 @@ export class DefaultApi extends runtime.BaseAPI { */ async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'personId')) { - throw new runtime.RequiredError('personId','Required parameter requestParameters.personId was null or undefined when calling list.'); + throw new runtime.RequiredError( + 'personId', + 'Required parameter "personId" was null or undefined when calling list().' + ); } const queryParameters: any = {}; @@ -43,7 +46,7 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/person/display/{personId}`.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters.personId))), + path: `/person/display/{personId}`.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters['personId']))), method: 'GET', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts index 9b56d7764afc..fd8a011fc7cd 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/apis/DefaultApi.ts @@ -35,7 +35,10 @@ export class DefaultApi extends runtime.BaseAPI { */ async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'personId')) { - throw new runtime.RequiredError('personId','Required parameter requestParameters.personId was null or undefined when calling list.'); + throw new runtime.RequiredError( + 'personId', + 'Required parameter "personId" was null or undefined when calling list().' + ); } const queryParameters: any = {}; @@ -43,7 +46,7 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/person/display/{personId}`.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters.personId))), + path: `/person/display/{personId}`.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters['personId']))), method: 'GET', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts index 73394ee15281..cec7e569d020 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/AnotherFakeApi.ts @@ -37,7 +37,10 @@ export class AnotherFakeApi extends runtime.BaseAPI { */ async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'client')) { - throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling _123testSpecialTags.'); + throw new runtime.RequiredError( + 'client', + 'Required parameter "client" was null or undefined when calling _123testSpecialTags().' + ); } const queryParameters: any = {}; @@ -51,7 +54,7 @@ export class AnotherFakeApi extends runtime.BaseAPI { method: 'PATCH', headers: headerParameters, query: queryParameters, - body: ClientToJSON(requestParameters.client), + body: ClientToJSON(requestParameters['client']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts index 67ebc3c0b82f..12110a8f6a5b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts @@ -230,13 +230,16 @@ export class FakeApi extends runtime.BaseAPI { */ async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pet')) { - throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling fakeHttpSignatureTest.'); + throw new runtime.RequiredError( + 'pet', + 'Required parameter "pet" was null or undefined when calling fakeHttpSignatureTest().' + ); } const queryParameters: any = {}; - if (requestParameters.query1 !== undefined) { - queryParameters['query_1'] = requestParameters.query1; + if (runtime.exists(requestParameters, 'query1')) { + queryParameters['query_1'] = requestParameters['query1']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -244,7 +247,7 @@ export class FakeApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; if (runtime.exists(requestParameters, 'header1')) { - headerParameters['header_1'] = String(requestParameters.header1); + headerParameters['header_1'] = String(requestParameters['header1']); } const response = await this.request({ @@ -252,7 +255,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.pet), + body: PetToJSON(requestParameters['pet']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -280,7 +283,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { @@ -313,7 +316,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OuterCompositeToJSON(requestParameters.outerComposite), + body: OuterCompositeToJSON(requestParameters['outerComposite']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterCompositeFromJSON(jsonValue)); @@ -342,7 +345,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { @@ -375,7 +378,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { @@ -398,7 +401,10 @@ export class FakeApi extends runtime.BaseAPI { */ async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'outerObjectWithEnumProperty')) { - throw new runtime.RequiredError('outerObjectWithEnumProperty','Required parameter requestParameters.outerObjectWithEnumProperty was null or undefined when calling fakePropertyEnumIntegerSerialize.'); + throw new runtime.RequiredError( + 'outerObjectWithEnumProperty', + 'Required parameter "outerObjectWithEnumProperty" was null or undefined when calling fakePropertyEnumIntegerSerialize().' + ); } const queryParameters: any = {}; @@ -412,7 +418,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OuterObjectWithEnumPropertyToJSON(requestParameters.outerObjectWithEnumProperty), + body: OuterObjectWithEnumPropertyToJSON(requestParameters['outerObjectWithEnumProperty']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterObjectWithEnumPropertyFromJSON(jsonValue)); @@ -432,7 +438,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testAdditionalPropertiesReferenceRaw(requestParameters: TestAdditionalPropertiesReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'requestBody')) { - throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testAdditionalPropertiesReference.'); + throw new runtime.RequiredError( + 'requestBody', + 'Required parameter "requestBody" was null or undefined when calling testAdditionalPropertiesReference().' + ); } const queryParameters: any = {}; @@ -446,7 +455,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.requestBody, + body: requestParameters['requestBody'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -465,7 +474,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling testBodyWithBinary.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling testBodyWithBinary().' + ); } const queryParameters: any = {}; @@ -479,7 +491,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); return new runtime.VoidApiResponse(response); @@ -497,7 +509,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'fileSchemaTestClass')) { - throw new runtime.RequiredError('fileSchemaTestClass','Required parameter requestParameters.fileSchemaTestClass was null or undefined when calling testBodyWithFileSchema.'); + throw new runtime.RequiredError( + 'fileSchemaTestClass', + 'Required parameter "fileSchemaTestClass" was null or undefined when calling testBodyWithFileSchema().' + ); } const queryParameters: any = {}; @@ -511,7 +526,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: FileSchemaTestClassToJSON(requestParameters.fileSchemaTestClass), + body: FileSchemaTestClassToJSON(requestParameters['fileSchemaTestClass']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -528,17 +543,23 @@ export class FakeApi extends runtime.BaseAPI { */ async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'query')) { - throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling testBodyWithQueryParams.'); + throw new runtime.RequiredError( + 'query', + 'Required parameter "query" was null or undefined when calling testBodyWithQueryParams().' + ); } if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling testBodyWithQueryParams.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling testBodyWithQueryParams().' + ); } const queryParameters: any = {}; - if (requestParameters.query !== undefined) { - queryParameters['query'] = requestParameters.query; + if (runtime.exists(requestParameters, 'query')) { + queryParameters['query'] = requestParameters['query']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -550,7 +571,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.user), + body: UserToJSON(requestParameters['user']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -568,7 +589,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'client')) { - throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClientModel.'); + throw new runtime.RequiredError( + 'client', + 'Required parameter "client" was null or undefined when calling testClientModel().' + ); } const queryParameters: any = {}; @@ -582,7 +606,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PATCH', headers: headerParameters, query: queryParameters, - body: ClientToJSON(requestParameters.client), + body: ClientToJSON(requestParameters['client']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); @@ -603,19 +627,31 @@ export class FakeApi extends runtime.BaseAPI { */ async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'number')) { - throw new runtime.RequiredError('number','Required parameter requestParameters.number was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + 'number', + 'Required parameter "number" was null or undefined when calling testEndpointParameters().' + ); } if (!runtime.exists(requestParameters, '_double')) { - throw new runtime.RequiredError('_double','Required parameter requestParameters._double was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + '_double', + 'Required parameter "_double" was null or undefined when calling testEndpointParameters().' + ); } if (!runtime.exists(requestParameters, 'patternWithoutDelimiter')) { - throw new runtime.RequiredError('patternWithoutDelimiter','Required parameter requestParameters.patternWithoutDelimiter was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + 'patternWithoutDelimiter', + 'Required parameter "patternWithoutDelimiter" was null or undefined when calling testEndpointParameters().' + ); } if (!runtime.exists(requestParameters, '_byte')) { - throw new runtime.RequiredError('_byte','Required parameter requestParameters._byte was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + '_byte', + 'Required parameter "_byte" was null or undefined when calling testEndpointParameters().' + ); } const queryParameters: any = {}; @@ -641,60 +677,60 @@ export class FakeApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.integer !== undefined) { - formParams.append('integer', requestParameters.integer as any); + if (runtime.exists(requestParameters, 'integer')) { + formParams.append('integer', requestParameters['integer'] as any); } - if (requestParameters.int32 !== undefined) { - formParams.append('int32', requestParameters.int32 as any); + if (runtime.exists(requestParameters, 'int32')) { + formParams.append('int32', requestParameters['int32'] as any); } - if (requestParameters.int64 !== undefined) { - formParams.append('int64', requestParameters.int64 as any); + if (runtime.exists(requestParameters, 'int64')) { + formParams.append('int64', requestParameters['int64'] as any); } - if (requestParameters.number !== undefined) { - formParams.append('number', requestParameters.number as any); + if (runtime.exists(requestParameters, 'number')) { + formParams.append('number', requestParameters['number'] as any); } - if (requestParameters._float !== undefined) { - formParams.append('float', requestParameters._float as any); + if (runtime.exists(requestParameters, '_float')) { + formParams.append('float', requestParameters['_float'] as any); } - if (requestParameters._double !== undefined) { - formParams.append('double', requestParameters._double as any); + if (runtime.exists(requestParameters, '_double')) { + formParams.append('double', requestParameters['_double'] as any); } - if (requestParameters.string !== undefined) { - formParams.append('string', requestParameters.string as any); + if (runtime.exists(requestParameters, 'string')) { + formParams.append('string', requestParameters['string'] as any); } - if (requestParameters.patternWithoutDelimiter !== undefined) { - formParams.append('pattern_without_delimiter', requestParameters.patternWithoutDelimiter as any); + if (runtime.exists(requestParameters, 'patternWithoutDelimiter')) { + formParams.append('pattern_without_delimiter', requestParameters['patternWithoutDelimiter'] as any); } - if (requestParameters._byte !== undefined) { - formParams.append('byte', requestParameters._byte as any); + if (runtime.exists(requestParameters, '_byte')) { + formParams.append('byte', requestParameters['_byte'] as any); } - if (requestParameters.binary !== undefined) { - formParams.append('binary', requestParameters.binary as any); + if (runtime.exists(requestParameters, 'binary')) { + formParams.append('binary', requestParameters['binary'] as any); } - if (requestParameters.date !== undefined) { - formParams.append('date', requestParameters.date as any); + if (runtime.exists(requestParameters, 'date')) { + formParams.append('date', requestParameters['date'] as any); } - if (requestParameters.dateTime !== undefined) { - formParams.append('dateTime', requestParameters.dateTime as any); + if (runtime.exists(requestParameters, 'dateTime')) { + formParams.append('dateTime', requestParameters['dateTime'] as any); } - if (requestParameters.password !== undefined) { - formParams.append('password', requestParameters.password as any); + if (runtime.exists(requestParameters, 'password')) { + formParams.append('password', requestParameters['password'] as any); } - if (requestParameters.callback !== undefined) { - formParams.append('callback', requestParameters.callback as any); + if (runtime.exists(requestParameters, 'callback')) { + formParams.append('callback', requestParameters['callback'] as any); } const response = await this.request({ @@ -723,34 +759,34 @@ export class FakeApi extends runtime.BaseAPI { async testEnumParametersRaw(requestParameters: TestEnumParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.enumQueryStringArray) { - queryParameters['enum_query_string_array'] = requestParameters.enumQueryStringArray; + if (runtime.exists(requestParameters, 'enumQueryStringArray')) { + queryParameters['enum_query_string_array'] = requestParameters['enumQueryStringArray']; } - if (requestParameters.enumQueryString !== undefined) { - queryParameters['enum_query_string'] = requestParameters.enumQueryString; + if (runtime.exists(requestParameters, 'enumQueryString')) { + queryParameters['enum_query_string'] = requestParameters['enumQueryString']; } - if (requestParameters.enumQueryInteger !== undefined) { - queryParameters['enum_query_integer'] = requestParameters.enumQueryInteger; + if (runtime.exists(requestParameters, 'enumQueryInteger')) { + queryParameters['enum_query_integer'] = requestParameters['enumQueryInteger']; } - if (requestParameters.enumQueryDouble !== undefined) { - queryParameters['enum_query_double'] = requestParameters.enumQueryDouble; + if (runtime.exists(requestParameters, 'enumQueryDouble')) { + queryParameters['enum_query_double'] = requestParameters['enumQueryDouble']; } - if (requestParameters.enumQueryModelArray) { - queryParameters['enum_query_model_array'] = requestParameters.enumQueryModelArray; + if (runtime.exists(requestParameters, 'enumQueryModelArray')) { + queryParameters['enum_query_model_array'] = requestParameters['enumQueryModelArray']; } const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'enumHeaderStringArray')) { - headerParameters['enum_header_string_array'] = requestParameters.enumHeaderStringArray.join(runtime.COLLECTION_FORMATS["csv"]); + headerParameters['enum_header_string_array'] = requestParameters['enumHeaderStringArray']!.join(runtime.COLLECTION_FORMATS["csv"]); } if (runtime.exists(requestParameters, 'enumHeaderString')) { - headerParameters['enum_header_string'] = String(requestParameters.enumHeaderString); + headerParameters['enum_header_string'] = String(requestParameters['enumHeaderString']); } const consumes: runtime.Consume[] = [ @@ -767,12 +803,12 @@ export class FakeApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.enumFormStringArray) { - formParams.append('enum_form_string_array', requestParameters.enumFormStringArray.join(runtime.COLLECTION_FORMATS["csv"])); + if (runtime.exists(requestParameters, 'enumFormStringArray')) { + formParams.append('enum_form_string_array', requestParameters['enumFormStringArray']!.join(runtime.COLLECTION_FORMATS["csv"])); } - if (requestParameters.enumFormString !== undefined) { - formParams.append('enum_form_string', requestParameters.enumFormString as any); + if (runtime.exists(requestParameters, 'enumFormString')) { + formParams.append('enum_form_string', requestParameters['enumFormString'] as any); } const response = await this.request({ @@ -800,43 +836,52 @@ export class FakeApi extends runtime.BaseAPI { */ async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'requiredStringGroup')) { - throw new runtime.RequiredError('requiredStringGroup','Required parameter requestParameters.requiredStringGroup was null or undefined when calling testGroupParameters.'); + throw new runtime.RequiredError( + 'requiredStringGroup', + 'Required parameter "requiredStringGroup" was null or undefined when calling testGroupParameters().' + ); } if (!runtime.exists(requestParameters, 'requiredBooleanGroup')) { - throw new runtime.RequiredError('requiredBooleanGroup','Required parameter requestParameters.requiredBooleanGroup was null or undefined when calling testGroupParameters.'); + throw new runtime.RequiredError( + 'requiredBooleanGroup', + 'Required parameter "requiredBooleanGroup" was null or undefined when calling testGroupParameters().' + ); } if (!runtime.exists(requestParameters, 'requiredInt64Group')) { - throw new runtime.RequiredError('requiredInt64Group','Required parameter requestParameters.requiredInt64Group was null or undefined when calling testGroupParameters.'); + throw new runtime.RequiredError( + 'requiredInt64Group', + 'Required parameter "requiredInt64Group" was null or undefined when calling testGroupParameters().' + ); } const queryParameters: any = {}; - if (requestParameters.requiredStringGroup !== undefined) { - queryParameters['required_string_group'] = requestParameters.requiredStringGroup; + if (runtime.exists(requestParameters, 'requiredStringGroup')) { + queryParameters['required_string_group'] = requestParameters['requiredStringGroup']; } - if (requestParameters.requiredInt64Group !== undefined) { - queryParameters['required_int64_group'] = requestParameters.requiredInt64Group; + if (runtime.exists(requestParameters, 'requiredInt64Group')) { + queryParameters['required_int64_group'] = requestParameters['requiredInt64Group']; } - if (requestParameters.stringGroup !== undefined) { - queryParameters['string_group'] = requestParameters.stringGroup; + if (runtime.exists(requestParameters, 'stringGroup')) { + queryParameters['string_group'] = requestParameters['stringGroup']; } - if (requestParameters.int64Group !== undefined) { - queryParameters['int64_group'] = requestParameters.int64Group; + if (runtime.exists(requestParameters, 'int64Group')) { + queryParameters['int64_group'] = requestParameters['int64Group']; } const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'requiredBooleanGroup')) { - headerParameters['required_boolean_group'] = String(requestParameters.requiredBooleanGroup); + headerParameters['required_boolean_group'] = String(requestParameters['requiredBooleanGroup']); } if (runtime.exists(requestParameters, 'booleanGroup')) { - headerParameters['boolean_group'] = String(requestParameters.booleanGroup); + headerParameters['boolean_group'] = String(requestParameters['booleanGroup']); } if (this.configuration && this.configuration.accessToken) { @@ -871,7 +916,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'requestBody')) { - throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testInlineAdditionalProperties.'); + throw new runtime.RequiredError( + 'requestBody', + 'Required parameter "requestBody" was null or undefined when calling testInlineAdditionalProperties().' + ); } const queryParameters: any = {}; @@ -885,7 +933,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.requestBody, + body: requestParameters['requestBody'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -905,7 +953,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testInlineFreeformAdditionalPropertiesRaw(requestParameters: TestInlineFreeformAdditionalPropertiesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'testInlineFreeformAdditionalPropertiesRequest')) { - throw new runtime.RequiredError('testInlineFreeformAdditionalPropertiesRequest','Required parameter requestParameters.testInlineFreeformAdditionalPropertiesRequest was null or undefined when calling testInlineFreeformAdditionalProperties.'); + throw new runtime.RequiredError( + 'testInlineFreeformAdditionalPropertiesRequest', + 'Required parameter "testInlineFreeformAdditionalPropertiesRequest" was null or undefined when calling testInlineFreeformAdditionalProperties().' + ); } const queryParameters: any = {}; @@ -919,7 +970,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: TestInlineFreeformAdditionalPropertiesRequestToJSON(requestParameters.testInlineFreeformAdditionalPropertiesRequest), + body: TestInlineFreeformAdditionalPropertiesRequestToJSON(requestParameters['testInlineFreeformAdditionalPropertiesRequest']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -939,11 +990,17 @@ export class FakeApi extends runtime.BaseAPI { */ async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'param')) { - throw new runtime.RequiredError('param','Required parameter requestParameters.param was null or undefined when calling testJsonFormData.'); + throw new runtime.RequiredError( + 'param', + 'Required parameter "param" was null or undefined when calling testJsonFormData().' + ); } if (!runtime.exists(requestParameters, 'param2')) { - throw new runtime.RequiredError('param2','Required parameter requestParameters.param2 was null or undefined when calling testJsonFormData.'); + throw new runtime.RequiredError( + 'param2', + 'Required parameter "param2" was null or undefined when calling testJsonFormData().' + ); } const queryParameters: any = {}; @@ -964,12 +1021,12 @@ export class FakeApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.param !== undefined) { - formParams.append('param', requestParameters.param as any); + if (runtime.exists(requestParameters, 'param')) { + formParams.append('param', requestParameters['param'] as any); } - if (requestParameters.param2 !== undefined) { - formParams.append('param2', requestParameters.param2 as any); + if (runtime.exists(requestParameters, 'param2')) { + formParams.append('param2', requestParameters['param2'] as any); } const response = await this.request({ @@ -997,7 +1054,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testNullableRaw(requestParameters: TestNullableRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'childWithNullable')) { - throw new runtime.RequiredError('childWithNullable','Required parameter requestParameters.childWithNullable was null or undefined when calling testNullable.'); + throw new runtime.RequiredError( + 'childWithNullable', + 'Required parameter "childWithNullable" was null or undefined when calling testNullable().' + ); } const queryParameters: any = {}; @@ -1011,7 +1071,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: ChildWithNullableToJSON(requestParameters.childWithNullable), + body: ChildWithNullableToJSON(requestParameters['childWithNullable']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -1030,57 +1090,75 @@ export class FakeApi extends runtime.BaseAPI { */ async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pipe')) { - throw new runtime.RequiredError('pipe','Required parameter requestParameters.pipe was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'pipe', + 'Required parameter "pipe" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'ioutil')) { - throw new runtime.RequiredError('ioutil','Required parameter requestParameters.ioutil was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'ioutil', + 'Required parameter "ioutil" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'http')) { - throw new runtime.RequiredError('http','Required parameter requestParameters.http was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'http', + 'Required parameter "http" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'url')) { - throw new runtime.RequiredError('url','Required parameter requestParameters.url was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'url', + 'Required parameter "url" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'context')) { - throw new runtime.RequiredError('context','Required parameter requestParameters.context was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'context', + 'Required parameter "context" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'allowEmpty')) { - throw new runtime.RequiredError('allowEmpty','Required parameter requestParameters.allowEmpty was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'allowEmpty', + 'Required parameter "allowEmpty" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } const queryParameters: any = {}; - if (requestParameters.pipe) { - queryParameters['pipe'] = requestParameters.pipe.join(runtime.COLLECTION_FORMATS["pipes"]); + if (runtime.exists(requestParameters, 'pipe')) { + queryParameters['pipe'] = requestParameters['pipe']!.join(runtime.COLLECTION_FORMATS["pipes"]); } - if (requestParameters.ioutil) { - queryParameters['ioutil'] = requestParameters.ioutil.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'ioutil')) { + queryParameters['ioutil'] = requestParameters['ioutil']!.join(runtime.COLLECTION_FORMATS["csv"]); } - if (requestParameters.http) { - queryParameters['http'] = requestParameters.http.join(runtime.COLLECTION_FORMATS["ssv"]); + if (runtime.exists(requestParameters, 'http')) { + queryParameters['http'] = requestParameters['http']!.join(runtime.COLLECTION_FORMATS["ssv"]); } - if (requestParameters.url) { - queryParameters['url'] = requestParameters.url.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'url')) { + queryParameters['url'] = requestParameters['url']!.join(runtime.COLLECTION_FORMATS["csv"]); } - if (requestParameters.context) { - queryParameters['context'] = requestParameters.context; + if (runtime.exists(requestParameters, 'context')) { + queryParameters['context'] = requestParameters['context']; } - if (requestParameters.language !== undefined) { - queryParameters['language'] = requestParameters.language; + if (runtime.exists(requestParameters, 'language')) { + queryParameters['language'] = requestParameters['language']; } - if (requestParameters.allowEmpty !== undefined) { - queryParameters['allowEmpty'] = requestParameters.allowEmpty; + if (runtime.exists(requestParameters, 'allowEmpty')) { + queryParameters['allowEmpty'] = requestParameters['allowEmpty']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -1108,7 +1186,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testStringMapReferenceRaw(requestParameters: TestStringMapReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'requestBody')) { - throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testStringMapReference.'); + throw new runtime.RequiredError( + 'requestBody', + 'Required parameter "requestBody" was null or undefined when calling testStringMapReference().' + ); } const queryParameters: any = {}; @@ -1122,7 +1203,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.requestBody, + body: requestParameters['requestBody'], }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts index 6f599cb8c493..ce9f567a5324 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeClassnameTags123Api.ts @@ -37,7 +37,10 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { */ async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'client')) { - throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClassname.'); + throw new runtime.RequiredError( + 'client', + 'Required parameter "client" was null or undefined when calling testClassname().' + ); } const queryParameters: any = {}; @@ -55,7 +58,7 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { method: 'PATCH', headers: headerParameters, query: queryParameters, - body: ClientToJSON(requestParameters.client), + body: ClientToJSON(requestParameters['client']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts index ca99a6f22ac4..389f7d7077f3 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts @@ -79,7 +79,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pet')) { - throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'pet', + 'Required parameter "pet" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -98,7 +101,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.pet), + body: PetToJSON(requestParameters['pet']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -118,7 +121,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -126,7 +132,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -135,7 +141,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -158,13 +164,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -200,13 +209,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = Array.from(requestParameters.tags).join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = Array.from(requestParameters['tags'])!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -242,7 +254,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -254,7 +269,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -278,7 +293,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pet')) { - throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'pet', + 'Required parameter "pet" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -297,7 +315,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.pet), + body: PetToJSON(requestParameters['pet']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -317,7 +335,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -343,16 +364,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -376,7 +397,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -404,16 +428,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -438,11 +462,17 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFileWithRequiredFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFileWithRequiredFile().' + ); } if (!runtime.exists(requestParameters, 'requiredFile')) { - throw new runtime.RequiredError('requiredFile','Required parameter requestParameters.requiredFile was null or undefined when calling uploadFileWithRequiredFile.'); + throw new runtime.RequiredError( + 'requiredFile', + 'Required parameter "requiredFile" was null or undefined when calling uploadFileWithRequiredFile().' + ); } const queryParameters: any = {}; @@ -470,16 +500,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.requiredFile !== undefined) { - formParams.append('requiredFile', requestParameters.requiredFile as any); + if (runtime.exists(requestParameters, 'requiredFile')) { + formParams.append('requiredFile', requestParameters['requiredFile'] as any); } const response = await this.request({ - path: `/fake/{petId}/uploadImageWithRequiredFile`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/fake/{petId}/uploadImageWithRequiredFile`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts index 433a2289bd4d..4444f71d4cd0 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -140,7 +146,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'order')) { - throw new runtime.RequiredError('order','Required parameter requestParameters.order was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'order', + 'Required parameter "order" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -154,7 +163,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.order), + body: OrderToJSON(requestParameters['order']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts index 490810fdb119..36114480012f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/UserApi.ts @@ -63,7 +63,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -77,7 +80,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.user), + body: UserToJSON(requestParameters['user']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -97,7 +100,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -111,7 +117,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.user.map(UserToJSON), + body: requestParameters['user']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -131,7 +137,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -145,7 +154,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.user.map(UserToJSON), + body: requestParameters['user']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -165,7 +174,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -173,7 +185,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -196,7 +208,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -204,7 +219,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -228,21 +243,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -303,11 +324,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -317,11 +344,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.user), + body: UserToJSON(requestParameters['user']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts index 1b1d0acd7fab..87cab8f993a2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts @@ -72,7 +72,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -91,7 +94,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -109,7 +112,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -117,7 +123,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -126,7 +132,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -148,13 +154,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -190,13 +199,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -232,7 +244,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -244,7 +259,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -267,7 +282,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -286,7 +304,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -304,7 +322,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -330,16 +351,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -361,7 +382,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -389,16 +413,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts index e36f9270bf55..74fc267af7da 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -139,7 +145,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -153,7 +162,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.body), + body: OrderToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts index e10b9a986a4f..565ceefcaab9 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts @@ -63,7 +63,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -77,7 +80,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -96,7 +99,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -110,7 +116,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -128,7 +134,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -142,7 +151,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -161,7 +170,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -169,7 +181,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -191,7 +203,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -199,7 +214,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -221,21 +236,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -293,11 +314,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -307,11 +334,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts index ccf7d1c2ffcf..f54273179d37 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts @@ -63,20 +63,20 @@ export class DefaultApi extends runtime.BaseAPI { async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.stringEnum !== undefined) { - queryParameters['string-enum'] = requestParameters.stringEnum; + if (runtime.exists(requestParameters, 'stringEnum')) { + queryParameters['string-enum'] = requestParameters['stringEnum']; } - if (requestParameters.nullableStringEnum !== undefined) { - queryParameters['nullable-string-enum'] = requestParameters.nullableStringEnum; + if (runtime.exists(requestParameters, 'nullableStringEnum')) { + queryParameters['nullable-string-enum'] = requestParameters['nullableStringEnum']; } - if (requestParameters.numberEnum !== undefined) { - queryParameters['number-enum'] = requestParameters.numberEnum; + if (runtime.exists(requestParameters, 'numberEnum')) { + queryParameters['number-enum'] = requestParameters['numberEnum']; } - if (requestParameters.nullableNumberEnum !== undefined) { - queryParameters['nullable-number-enum'] = requestParameters.nullableNumberEnum; + if (runtime.exists(requestParameters, 'nullableNumberEnum')) { + queryParameters['nullable-number-enum'] = requestParameters['nullableNumberEnum']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -103,20 +103,20 @@ export class DefaultApi extends runtime.BaseAPI { async fakeEnumRequestGetRefRaw(requestParameters: FakeEnumRequestGetRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.stringEnum !== undefined) { - queryParameters['string-enum'] = requestParameters.stringEnum; + if (runtime.exists(requestParameters, 'stringEnum')) { + queryParameters['string-enum'] = requestParameters['stringEnum']; } - if (requestParameters.nullableStringEnum !== undefined) { - queryParameters['nullable-string-enum'] = requestParameters.nullableStringEnum; + if (runtime.exists(requestParameters, 'nullableStringEnum')) { + queryParameters['nullable-string-enum'] = requestParameters['nullableStringEnum']; } - if (requestParameters.numberEnum !== undefined) { - queryParameters['number-enum'] = requestParameters.numberEnum; + if (runtime.exists(requestParameters, 'numberEnum')) { + queryParameters['number-enum'] = requestParameters['numberEnum']; } - if (requestParameters.nullableNumberEnum !== undefined) { - queryParameters['nullable-number-enum'] = requestParameters.nullableNumberEnum; + if (runtime.exists(requestParameters, 'nullableNumberEnum')) { + queryParameters['nullable-number-enum'] = requestParameters['nullableNumberEnum']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -152,7 +152,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters.fakeEnumRequestGetInline200Response), + body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters['fakeEnumRequestGetInline200Response']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); @@ -179,7 +179,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: EnumPatternObjectToJSON(requestParameters.enumPatternObject), + body: EnumPatternObjectToJSON(requestParameters['enumPatternObject']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnumPatternObjectFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts index 1b1d0acd7fab..87cab8f993a2 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts @@ -72,7 +72,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -91,7 +94,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -109,7 +112,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -117,7 +123,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -126,7 +132,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -148,13 +154,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -190,13 +199,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -232,7 +244,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -244,7 +259,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -267,7 +282,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -286,7 +304,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -304,7 +322,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -330,16 +351,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -361,7 +382,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -389,16 +413,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts index e36f9270bf55..74fc267af7da 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -139,7 +145,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -153,7 +162,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.body), + body: OrderToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts index e10b9a986a4f..565ceefcaab9 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts @@ -63,7 +63,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -77,7 +80,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -96,7 +99,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -110,7 +116,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -128,7 +134,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -142,7 +151,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -161,7 +170,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -169,7 +181,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -191,7 +203,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -199,7 +214,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -221,21 +236,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -293,11 +314,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -307,11 +334,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts index fed344c7b2db..bfef64a126ac 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts @@ -72,7 +72,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -91,7 +94,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -109,7 +112,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -117,7 +123,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -126,7 +132,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -148,13 +154,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -190,13 +199,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -232,7 +244,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -244,7 +259,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -267,7 +282,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -286,7 +304,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -304,7 +322,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -330,16 +351,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -361,7 +382,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -389,16 +413,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts index 182e80bc718e..71f08a8daed8 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -139,7 +145,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -153,7 +162,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.body), + body: OrderToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts index 7ed0f598281d..49ed31f55b8f 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts @@ -63,7 +63,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -77,7 +80,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -96,7 +99,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -110,7 +116,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -128,7 +134,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -142,7 +151,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -161,7 +170,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -169,7 +181,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -191,7 +203,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -199,7 +214,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -221,21 +236,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -293,11 +314,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -307,11 +334,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts index c5ba04cee3b9..c1e5d3f61069 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts @@ -72,7 +72,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: PetApiAddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -91,7 +94,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -109,7 +112,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: PetApiDeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -117,7 +123,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -126,7 +132,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -148,13 +154,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: PetApiFindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -190,13 +199,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: PetApiFindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -232,7 +244,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: PetApiGetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -244,7 +259,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -267,7 +282,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: PetApiUpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -286,7 +304,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -304,7 +322,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: PetApiUpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -330,16 +351,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -361,7 +382,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: PetApiUploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -389,16 +413,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts index b31517091a8d..c4166be39728 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: StoreApiDeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: StoreApiGetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -139,7 +145,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: StoreApiPlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -153,7 +162,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.body), + body: OrderToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts index 012a2f5b8bf9..c0830aaf5bee 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts @@ -63,7 +63,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: UserApiCreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -77,7 +80,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -96,7 +99,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: UserApiCreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -110,7 +116,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -128,7 +134,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: UserApiCreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -142,7 +151,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -161,7 +170,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: UserApiDeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -169,7 +181,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -191,7 +203,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: UserApiGetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -199,7 +214,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -221,21 +236,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: UserApiLoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -293,11 +314,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UserApiUpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -307,11 +334,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts index c751adf35fff..1f9c29198de2 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApi.ts @@ -43,7 +43,10 @@ export class BehaviorApi extends runtime.BaseAPI { */ async getBehaviorPermissionsRaw(requestParameters: GetBehaviorPermissionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'behaviorId')) { - throw new runtime.RequiredError('behaviorId','Required parameter requestParameters.behaviorId was null or undefined when calling getBehaviorPermissions.'); + throw new runtime.RequiredError( + 'behaviorId', + 'Required parameter "behaviorId" was null or undefined when calling getBehaviorPermissions().' + ); } const queryParameters: any = {}; @@ -51,7 +54,7 @@ export class BehaviorApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/fake_behavior/{behavior-id}/permissions`.replace(`{${"behavior-id"}}`, encodeURIComponent(String(requestParameters.behaviorId))), + path: `/fake_behavior/{behavior-id}/permissions`.replace(`{${"behavior-id"}}`, encodeURIComponent(String(requestParameters['behaviorId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -73,7 +76,10 @@ export class BehaviorApi extends runtime.BaseAPI { */ async getBehaviorTypeRaw(requestParameters: GetBehaviorTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'behaviorId')) { - throw new runtime.RequiredError('behaviorId','Required parameter requestParameters.behaviorId was null or undefined when calling getBehaviorType.'); + throw new runtime.RequiredError( + 'behaviorId', + 'Required parameter "behaviorId" was null or undefined when calling getBehaviorType().' + ); } const queryParameters: any = {}; @@ -81,7 +87,7 @@ export class BehaviorApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/fake_behavior/{behavior-id}/type`.replace(`{${"behavior-id"}}`, encodeURIComponent(String(requestParameters.behaviorId))), + path: `/fake_behavior/{behavior-id}/type`.replace(`{${"behavior-id"}}`, encodeURIComponent(String(requestParameters['behaviorId']))), method: 'GET', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts index 45de8f602ed9..8aa504326391 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts @@ -101,7 +101,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'dummyCat')) { - throw new runtime.RequiredError('dummyCat','Required parameter requestParameters.dummyCat was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'dummyCat', + 'Required parameter "dummyCat" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -120,7 +123,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: CategoryToJSON(requestParameters.dummyCat), + body: CategoryToJSON(requestParameters['dummyCat']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -138,7 +141,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -146,7 +152,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -155,7 +161,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -178,13 +184,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByIdsRaw(requestParameters: FindPetsByIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'ids')) { - throw new runtime.RequiredError('ids','Required parameter requestParameters.ids was null or undefined when calling findPetsByIds.'); + throw new runtime.RequiredError( + 'ids', + 'Required parameter "ids" was null or undefined when calling findPetsByIds().' + ); } const queryParameters: any = {}; - if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'ids')) { + queryParameters['ids'] = requestParameters['ids']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -220,13 +229,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -262,13 +274,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -305,13 +320,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByUserIdsRaw(requestParameters: FindPetsByUserIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'ids')) { - throw new runtime.RequiredError('ids','Required parameter requestParameters.ids was null or undefined when calling findPetsByUserIds.'); + throw new runtime.RequiredError( + 'ids', + 'Required parameter "ids" was null or undefined when calling findPetsByUserIds().' + ); } const queryParameters: any = {}; - if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'ids')) { + queryParameters['ids'] = requestParameters['ids']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -347,7 +365,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -359,7 +380,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -382,7 +403,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetRegionsRaw(requestParameters: GetPetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetRegions.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetRegions().' + ); } const queryParameters: any = {}; @@ -390,7 +414,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -412,7 +436,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -431,7 +458,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -449,11 +476,17 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRegionsRaw(requestParameters: UpdatePetRegionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetRegions.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetRegions().' + ); } if (!runtime.exists(requestParameters, 'newRegions')) { - throw new runtime.RequiredError('newRegions','Required parameter requestParameters.newRegions was null or undefined when calling updatePetRegions.'); + throw new runtime.RequiredError( + 'newRegions', + 'Required parameter "newRegions" was null or undefined when calling updatePetRegions().' + ); } const queryParameters: any = {}; @@ -463,11 +496,11 @@ export class PetApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: requestParameters.newRegions, + body: requestParameters['newRegions'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PetRegionsResponseFromJSON(jsonValue)); @@ -486,7 +519,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -512,16 +548,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -543,7 +579,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -571,16 +610,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts index bc475ba9b2b1..5317ee8f514d 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApi.ts @@ -48,7 +48,10 @@ export class PetPartApi extends runtime.BaseAPI { */ async getFakePetPartTypeRaw(requestParameters: GetFakePetPartTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'fakePetPartId')) { - throw new runtime.RequiredError('fakePetPartId','Required parameter requestParameters.fakePetPartId was null or undefined when calling getFakePetPartType.'); + throw new runtime.RequiredError( + 'fakePetPartId', + 'Required parameter "fakePetPartId" was null or undefined when calling getFakePetPartType().' + ); } const queryParameters: any = {}; @@ -56,7 +59,7 @@ export class PetPartApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/fake_petParts/{fake_petPart-id}/part-type`.replace(`{${"fake_petPart-id"}}`, encodeURIComponent(String(requestParameters.fakePetPartId))), + path: `/fake_petParts/{fake_petPart-id}/part-type`.replace(`{${"fake_petPart-id"}}`, encodeURIComponent(String(requestParameters['fakePetPartId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -78,47 +81,59 @@ export class PetPartApi extends runtime.BaseAPI { */ async getMatchingPartsRaw(requestParameters: GetMatchingPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'fakePetPartId')) { - throw new runtime.RequiredError('fakePetPartId','Required parameter requestParameters.fakePetPartId was null or undefined when calling getMatchingParts.'); + throw new runtime.RequiredError( + 'fakePetPartId', + 'Required parameter "fakePetPartId" was null or undefined when calling getMatchingParts().' + ); } if (!runtime.exists(requestParameters, '_long')) { - throw new runtime.RequiredError('_long','Required parameter requestParameters._long was null or undefined when calling getMatchingParts.'); + throw new runtime.RequiredError( + '_long', + 'Required parameter "_long" was null or undefined when calling getMatchingParts().' + ); } if (!runtime.exists(requestParameters, 'smooth')) { - throw new runtime.RequiredError('smooth','Required parameter requestParameters.smooth was null or undefined when calling getMatchingParts.'); + throw new runtime.RequiredError( + 'smooth', + 'Required parameter "smooth" was null or undefined when calling getMatchingParts().' + ); } if (!runtime.exists(requestParameters, '_short')) { - throw new runtime.RequiredError('_short','Required parameter requestParameters._short was null or undefined when calling getMatchingParts.'); + throw new runtime.RequiredError( + '_short', + 'Required parameter "_short" was null or undefined when calling getMatchingParts().' + ); } const queryParameters: any = {}; - if (requestParameters._long !== undefined) { - queryParameters['long'] = requestParameters._long; + if (runtime.exists(requestParameters, '_long')) { + queryParameters['long'] = requestParameters['_long']; } - if (requestParameters.smooth !== undefined) { - queryParameters['smooth'] = requestParameters.smooth; + if (runtime.exists(requestParameters, 'smooth')) { + queryParameters['smooth'] = requestParameters['smooth']; } - if (requestParameters.name !== undefined) { - queryParameters['name'] = requestParameters.name; + if (runtime.exists(requestParameters, 'name')) { + queryParameters['name'] = requestParameters['name']; } - if (requestParameters.connectedPart !== undefined) { - queryParameters['connected-part'] = requestParameters.connectedPart; + if (runtime.exists(requestParameters, 'connectedPart')) { + queryParameters['connected-part'] = requestParameters['connectedPart']; } - if (requestParameters._short !== undefined) { - queryParameters['short'] = requestParameters._short; + if (runtime.exists(requestParameters, '_short')) { + queryParameters['short'] = requestParameters['_short']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/fake_petParts/{fake_petPart-id}/matching-parts`.replace(`{${"fake_petPart-id"}}`, encodeURIComponent(String(requestParameters.fakePetPartId))), + path: `/fake_petParts/{fake_petPart-id}/matching-parts`.replace(`{${"fake_petPart-id"}}`, encodeURIComponent(String(requestParameters['fakePetPartId']))), method: 'GET', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts index 182e80bc718e..71f08a8daed8 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -139,7 +145,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -153,7 +162,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.body), + body: OrderToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts index 9eff00a219d1..e2c54ff475c7 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts @@ -66,7 +66,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -80,7 +83,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -99,7 +102,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -113,7 +119,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -131,7 +137,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -145,7 +154,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -164,7 +173,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -172,7 +184,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -194,7 +206,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -202,7 +217,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -224,21 +239,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -296,11 +317,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -310,11 +337,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DefaultMetaOnlyResponseFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts index 73394ee15281..cec7e569d020 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/AnotherFakeApi.ts @@ -37,7 +37,10 @@ export class AnotherFakeApi extends runtime.BaseAPI { */ async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'client')) { - throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling _123testSpecialTags.'); + throw new runtime.RequiredError( + 'client', + 'Required parameter "client" was null or undefined when calling _123testSpecialTags().' + ); } const queryParameters: any = {}; @@ -51,7 +54,7 @@ export class AnotherFakeApi extends runtime.BaseAPI { method: 'PATCH', headers: headerParameters, query: queryParameters, - body: ClientToJSON(requestParameters.client), + body: ClientToJSON(requestParameters['client']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts index ed42c8b96b01..db35c115a6ff 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeApi.ts @@ -208,13 +208,16 @@ export class FakeApi extends runtime.BaseAPI { */ async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pet')) { - throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling fakeHttpSignatureTest.'); + throw new runtime.RequiredError( + 'pet', + 'Required parameter "pet" was null or undefined when calling fakeHttpSignatureTest().' + ); } const queryParameters: any = {}; - if (requestParameters.query1 !== undefined) { - queryParameters['query_1'] = requestParameters.query1; + if (runtime.exists(requestParameters, 'query1')) { + queryParameters['query_1'] = requestParameters['query1']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -222,7 +225,7 @@ export class FakeApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; if (runtime.exists(requestParameters, 'header1')) { - headerParameters['header_1'] = String(requestParameters.header1); + headerParameters['header_1'] = String(requestParameters['header1']); } const response = await this.request({ @@ -230,7 +233,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.pet), + body: PetToJSON(requestParameters['pet']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -258,7 +261,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { @@ -291,7 +294,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OuterCompositeToJSON(requestParameters.outerComposite), + body: OuterCompositeToJSON(requestParameters['outerComposite']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterCompositeFromJSON(jsonValue)); @@ -320,7 +323,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { @@ -353,7 +356,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { @@ -376,7 +379,10 @@ export class FakeApi extends runtime.BaseAPI { */ async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'outerObjectWithEnumProperty')) { - throw new runtime.RequiredError('outerObjectWithEnumProperty','Required parameter requestParameters.outerObjectWithEnumProperty was null or undefined when calling fakePropertyEnumIntegerSerialize.'); + throw new runtime.RequiredError( + 'outerObjectWithEnumProperty', + 'Required parameter "outerObjectWithEnumProperty" was null or undefined when calling fakePropertyEnumIntegerSerialize().' + ); } const queryParameters: any = {}; @@ -390,7 +396,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OuterObjectWithEnumPropertyToJSON(requestParameters.outerObjectWithEnumProperty), + body: OuterObjectWithEnumPropertyToJSON(requestParameters['outerObjectWithEnumProperty']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OuterObjectWithEnumPropertyFromJSON(jsonValue)); @@ -409,7 +415,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling testBodyWithBinary.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling testBodyWithBinary().' + ); } const queryParameters: any = {}; @@ -423,7 +432,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: requestParameters.body as any, + body: requestParameters['body'] as any, }, initOverrides); return new runtime.VoidApiResponse(response); @@ -441,7 +450,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'fileSchemaTestClass')) { - throw new runtime.RequiredError('fileSchemaTestClass','Required parameter requestParameters.fileSchemaTestClass was null or undefined when calling testBodyWithFileSchema.'); + throw new runtime.RequiredError( + 'fileSchemaTestClass', + 'Required parameter "fileSchemaTestClass" was null or undefined when calling testBodyWithFileSchema().' + ); } const queryParameters: any = {}; @@ -455,7 +467,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: FileSchemaTestClassToJSON(requestParameters.fileSchemaTestClass), + body: FileSchemaTestClassToJSON(requestParameters['fileSchemaTestClass']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -472,17 +484,23 @@ export class FakeApi extends runtime.BaseAPI { */ async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'query')) { - throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling testBodyWithQueryParams.'); + throw new runtime.RequiredError( + 'query', + 'Required parameter "query" was null or undefined when calling testBodyWithQueryParams().' + ); } if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling testBodyWithQueryParams.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling testBodyWithQueryParams().' + ); } const queryParameters: any = {}; - if (requestParameters.query !== undefined) { - queryParameters['query'] = requestParameters.query; + if (runtime.exists(requestParameters, 'query')) { + queryParameters['query'] = requestParameters['query']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -494,7 +512,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.user), + body: UserToJSON(requestParameters['user']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -512,7 +530,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'client')) { - throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClientModel.'); + throw new runtime.RequiredError( + 'client', + 'Required parameter "client" was null or undefined when calling testClientModel().' + ); } const queryParameters: any = {}; @@ -526,7 +547,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'PATCH', headers: headerParameters, query: queryParameters, - body: ClientToJSON(requestParameters.client), + body: ClientToJSON(requestParameters['client']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); @@ -547,19 +568,31 @@ export class FakeApi extends runtime.BaseAPI { */ async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'number')) { - throw new runtime.RequiredError('number','Required parameter requestParameters.number was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + 'number', + 'Required parameter "number" was null or undefined when calling testEndpointParameters().' + ); } if (!runtime.exists(requestParameters, '_double')) { - throw new runtime.RequiredError('_double','Required parameter requestParameters._double was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + '_double', + 'Required parameter "_double" was null or undefined when calling testEndpointParameters().' + ); } if (!runtime.exists(requestParameters, 'patternWithoutDelimiter')) { - throw new runtime.RequiredError('patternWithoutDelimiter','Required parameter requestParameters.patternWithoutDelimiter was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + 'patternWithoutDelimiter', + 'Required parameter "patternWithoutDelimiter" was null or undefined when calling testEndpointParameters().' + ); } if (!runtime.exists(requestParameters, '_byte')) { - throw new runtime.RequiredError('_byte','Required parameter requestParameters._byte was null or undefined when calling testEndpointParameters.'); + throw new runtime.RequiredError( + '_byte', + 'Required parameter "_byte" was null or undefined when calling testEndpointParameters().' + ); } const queryParameters: any = {}; @@ -585,60 +618,60 @@ export class FakeApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.integer !== undefined) { - formParams.append('integer', requestParameters.integer as any); + if (runtime.exists(requestParameters, 'integer')) { + formParams.append('integer', requestParameters['integer'] as any); } - if (requestParameters.int32 !== undefined) { - formParams.append('int32', requestParameters.int32 as any); + if (runtime.exists(requestParameters, 'int32')) { + formParams.append('int32', requestParameters['int32'] as any); } - if (requestParameters.int64 !== undefined) { - formParams.append('int64', requestParameters.int64 as any); + if (runtime.exists(requestParameters, 'int64')) { + formParams.append('int64', requestParameters['int64'] as any); } - if (requestParameters.number !== undefined) { - formParams.append('number', requestParameters.number as any); + if (runtime.exists(requestParameters, 'number')) { + formParams.append('number', requestParameters['number'] as any); } - if (requestParameters._float !== undefined) { - formParams.append('float', requestParameters._float as any); + if (runtime.exists(requestParameters, '_float')) { + formParams.append('float', requestParameters['_float'] as any); } - if (requestParameters._double !== undefined) { - formParams.append('double', requestParameters._double as any); + if (runtime.exists(requestParameters, '_double')) { + formParams.append('double', requestParameters['_double'] as any); } - if (requestParameters.string !== undefined) { - formParams.append('string', requestParameters.string as any); + if (runtime.exists(requestParameters, 'string')) { + formParams.append('string', requestParameters['string'] as any); } - if (requestParameters.patternWithoutDelimiter !== undefined) { - formParams.append('pattern_without_delimiter', requestParameters.patternWithoutDelimiter as any); + if (runtime.exists(requestParameters, 'patternWithoutDelimiter')) { + formParams.append('pattern_without_delimiter', requestParameters['patternWithoutDelimiter'] as any); } - if (requestParameters._byte !== undefined) { - formParams.append('byte', requestParameters._byte as any); + if (runtime.exists(requestParameters, '_byte')) { + formParams.append('byte', requestParameters['_byte'] as any); } - if (requestParameters.binary !== undefined) { - formParams.append('binary', requestParameters.binary as any); + if (runtime.exists(requestParameters, 'binary')) { + formParams.append('binary', requestParameters['binary'] as any); } - if (requestParameters.date !== undefined) { - formParams.append('date', requestParameters.date as any); + if (runtime.exists(requestParameters, 'date')) { + formParams.append('date', requestParameters['date'] as any); } - if (requestParameters.dateTime !== undefined) { - formParams.append('dateTime', requestParameters.dateTime as any); + if (runtime.exists(requestParameters, 'dateTime')) { + formParams.append('dateTime', requestParameters['dateTime'] as any); } - if (requestParameters.password !== undefined) { - formParams.append('password', requestParameters.password as any); + if (runtime.exists(requestParameters, 'password')) { + formParams.append('password', requestParameters['password'] as any); } - if (requestParameters.callback !== undefined) { - formParams.append('callback', requestParameters.callback as any); + if (runtime.exists(requestParameters, 'callback')) { + formParams.append('callback', requestParameters['callback'] as any); } const response = await this.request({ @@ -667,34 +700,34 @@ export class FakeApi extends runtime.BaseAPI { async testEnumParametersRaw(requestParameters: TestEnumParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.enumQueryStringArray) { - queryParameters['enum_query_string_array'] = requestParameters.enumQueryStringArray; + if (runtime.exists(requestParameters, 'enumQueryStringArray')) { + queryParameters['enum_query_string_array'] = requestParameters['enumQueryStringArray']; } - if (requestParameters.enumQueryString !== undefined) { - queryParameters['enum_query_string'] = requestParameters.enumQueryString; + if (runtime.exists(requestParameters, 'enumQueryString')) { + queryParameters['enum_query_string'] = requestParameters['enumQueryString']; } - if (requestParameters.enumQueryInteger !== undefined) { - queryParameters['enum_query_integer'] = requestParameters.enumQueryInteger; + if (runtime.exists(requestParameters, 'enumQueryInteger')) { + queryParameters['enum_query_integer'] = requestParameters['enumQueryInteger']; } - if (requestParameters.enumQueryDouble !== undefined) { - queryParameters['enum_query_double'] = requestParameters.enumQueryDouble; + if (runtime.exists(requestParameters, 'enumQueryDouble')) { + queryParameters['enum_query_double'] = requestParameters['enumQueryDouble']; } - if (requestParameters.enumQueryModelArray) { - queryParameters['enum_query_model_array'] = requestParameters.enumQueryModelArray; + if (runtime.exists(requestParameters, 'enumQueryModelArray')) { + queryParameters['enum_query_model_array'] = requestParameters['enumQueryModelArray']; } const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'enumHeaderStringArray')) { - headerParameters['enum_header_string_array'] = requestParameters.enumHeaderStringArray.join(runtime.COLLECTION_FORMATS["csv"]); + headerParameters['enum_header_string_array'] = requestParameters['enumHeaderStringArray']!.join(runtime.COLLECTION_FORMATS["csv"]); } if (runtime.exists(requestParameters, 'enumHeaderString')) { - headerParameters['enum_header_string'] = String(requestParameters.enumHeaderString); + headerParameters['enum_header_string'] = String(requestParameters['enumHeaderString']); } const consumes: runtime.Consume[] = [ @@ -711,12 +744,12 @@ export class FakeApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.enumFormStringArray) { - formParams.append('enum_form_string_array', requestParameters.enumFormStringArray.join(runtime.COLLECTION_FORMATS["csv"])); + if (runtime.exists(requestParameters, 'enumFormStringArray')) { + formParams.append('enum_form_string_array', requestParameters['enumFormStringArray']!.join(runtime.COLLECTION_FORMATS["csv"])); } - if (requestParameters.enumFormString !== undefined) { - formParams.append('enum_form_string', requestParameters.enumFormString as any); + if (runtime.exists(requestParameters, 'enumFormString')) { + formParams.append('enum_form_string', requestParameters['enumFormString'] as any); } const response = await this.request({ @@ -744,43 +777,52 @@ export class FakeApi extends runtime.BaseAPI { */ async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'requiredStringGroup')) { - throw new runtime.RequiredError('requiredStringGroup','Required parameter requestParameters.requiredStringGroup was null or undefined when calling testGroupParameters.'); + throw new runtime.RequiredError( + 'requiredStringGroup', + 'Required parameter "requiredStringGroup" was null or undefined when calling testGroupParameters().' + ); } if (!runtime.exists(requestParameters, 'requiredBooleanGroup')) { - throw new runtime.RequiredError('requiredBooleanGroup','Required parameter requestParameters.requiredBooleanGroup was null or undefined when calling testGroupParameters.'); + throw new runtime.RequiredError( + 'requiredBooleanGroup', + 'Required parameter "requiredBooleanGroup" was null or undefined when calling testGroupParameters().' + ); } if (!runtime.exists(requestParameters, 'requiredInt64Group')) { - throw new runtime.RequiredError('requiredInt64Group','Required parameter requestParameters.requiredInt64Group was null or undefined when calling testGroupParameters.'); + throw new runtime.RequiredError( + 'requiredInt64Group', + 'Required parameter "requiredInt64Group" was null or undefined when calling testGroupParameters().' + ); } const queryParameters: any = {}; - if (requestParameters.requiredStringGroup !== undefined) { - queryParameters['required_string_group'] = requestParameters.requiredStringGroup; + if (runtime.exists(requestParameters, 'requiredStringGroup')) { + queryParameters['required_string_group'] = requestParameters['requiredStringGroup']; } - if (requestParameters.requiredInt64Group !== undefined) { - queryParameters['required_int64_group'] = requestParameters.requiredInt64Group; + if (runtime.exists(requestParameters, 'requiredInt64Group')) { + queryParameters['required_int64_group'] = requestParameters['requiredInt64Group']; } - if (requestParameters.stringGroup !== undefined) { - queryParameters['string_group'] = requestParameters.stringGroup; + if (runtime.exists(requestParameters, 'stringGroup')) { + queryParameters['string_group'] = requestParameters['stringGroup']; } - if (requestParameters.int64Group !== undefined) { - queryParameters['int64_group'] = requestParameters.int64Group; + if (runtime.exists(requestParameters, 'int64Group')) { + queryParameters['int64_group'] = requestParameters['int64Group']; } const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'requiredBooleanGroup')) { - headerParameters['required_boolean_group'] = String(requestParameters.requiredBooleanGroup); + headerParameters['required_boolean_group'] = String(requestParameters['requiredBooleanGroup']); } if (runtime.exists(requestParameters, 'booleanGroup')) { - headerParameters['boolean_group'] = String(requestParameters.booleanGroup); + headerParameters['boolean_group'] = String(requestParameters['booleanGroup']); } if (this.configuration && this.configuration.accessToken) { @@ -815,7 +857,10 @@ export class FakeApi extends runtime.BaseAPI { */ async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'requestBody')) { - throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testInlineAdditionalProperties.'); + throw new runtime.RequiredError( + 'requestBody', + 'Required parameter "requestBody" was null or undefined when calling testInlineAdditionalProperties().' + ); } const queryParameters: any = {}; @@ -829,7 +874,7 @@ export class FakeApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.requestBody, + body: requestParameters['requestBody'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -849,11 +894,17 @@ export class FakeApi extends runtime.BaseAPI { */ async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'param')) { - throw new runtime.RequiredError('param','Required parameter requestParameters.param was null or undefined when calling testJsonFormData.'); + throw new runtime.RequiredError( + 'param', + 'Required parameter "param" was null or undefined when calling testJsonFormData().' + ); } if (!runtime.exists(requestParameters, 'param2')) { - throw new runtime.RequiredError('param2','Required parameter requestParameters.param2 was null or undefined when calling testJsonFormData.'); + throw new runtime.RequiredError( + 'param2', + 'Required parameter "param2" was null or undefined when calling testJsonFormData().' + ); } const queryParameters: any = {}; @@ -874,12 +925,12 @@ export class FakeApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.param !== undefined) { - formParams.append('param', requestParameters.param as any); + if (runtime.exists(requestParameters, 'param')) { + formParams.append('param', requestParameters['param'] as any); } - if (requestParameters.param2 !== undefined) { - formParams.append('param2', requestParameters.param2 as any); + if (runtime.exists(requestParameters, 'param2')) { + formParams.append('param2', requestParameters['param2'] as any); } const response = await this.request({ @@ -906,57 +957,75 @@ export class FakeApi extends runtime.BaseAPI { */ async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pipe')) { - throw new runtime.RequiredError('pipe','Required parameter requestParameters.pipe was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'pipe', + 'Required parameter "pipe" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'ioutil')) { - throw new runtime.RequiredError('ioutil','Required parameter requestParameters.ioutil was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'ioutil', + 'Required parameter "ioutil" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'http')) { - throw new runtime.RequiredError('http','Required parameter requestParameters.http was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'http', + 'Required parameter "http" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'url')) { - throw new runtime.RequiredError('url','Required parameter requestParameters.url was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'url', + 'Required parameter "url" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'context')) { - throw new runtime.RequiredError('context','Required parameter requestParameters.context was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'context', + 'Required parameter "context" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } if (!runtime.exists(requestParameters, 'allowEmpty')) { - throw new runtime.RequiredError('allowEmpty','Required parameter requestParameters.allowEmpty was null or undefined when calling testQueryParameterCollectionFormat.'); + throw new runtime.RequiredError( + 'allowEmpty', + 'Required parameter "allowEmpty" was null or undefined when calling testQueryParameterCollectionFormat().' + ); } const queryParameters: any = {}; - if (requestParameters.pipe) { - queryParameters['pipe'] = requestParameters.pipe.join(runtime.COLLECTION_FORMATS["pipes"]); + if (runtime.exists(requestParameters, 'pipe')) { + queryParameters['pipe'] = requestParameters['pipe']!.join(runtime.COLLECTION_FORMATS["pipes"]); } - if (requestParameters.ioutil) { - queryParameters['ioutil'] = requestParameters.ioutil.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'ioutil')) { + queryParameters['ioutil'] = requestParameters['ioutil']!.join(runtime.COLLECTION_FORMATS["csv"]); } - if (requestParameters.http) { - queryParameters['http'] = requestParameters.http.join(runtime.COLLECTION_FORMATS["ssv"]); + if (runtime.exists(requestParameters, 'http')) { + queryParameters['http'] = requestParameters['http']!.join(runtime.COLLECTION_FORMATS["ssv"]); } - if (requestParameters.url) { - queryParameters['url'] = requestParameters.url.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'url')) { + queryParameters['url'] = requestParameters['url']!.join(runtime.COLLECTION_FORMATS["csv"]); } - if (requestParameters.context) { - queryParameters['context'] = requestParameters.context; + if (runtime.exists(requestParameters, 'context')) { + queryParameters['context'] = requestParameters['context']; } - if (requestParameters.language !== undefined) { - queryParameters['language'] = requestParameters.language; + if (runtime.exists(requestParameters, 'language')) { + queryParameters['language'] = requestParameters['language']; } - if (requestParameters.allowEmpty !== undefined) { - queryParameters['allowEmpty'] = requestParameters.allowEmpty; + if (runtime.exists(requestParameters, 'allowEmpty')) { + queryParameters['allowEmpty'] = requestParameters['allowEmpty']; } const headerParameters: runtime.HTTPHeaders = {}; diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts index 6f599cb8c493..ce9f567a5324 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/FakeClassnameTags123Api.ts @@ -37,7 +37,10 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { */ async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'client')) { - throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClassname.'); + throw new runtime.RequiredError( + 'client', + 'Required parameter "client" was null or undefined when calling testClassname().' + ); } const queryParameters: any = {}; @@ -55,7 +58,7 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI { method: 'PATCH', headers: headerParameters, query: queryParameters, - body: ClientToJSON(requestParameters.client), + body: ClientToJSON(requestParameters['client']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts index ca99a6f22ac4..389f7d7077f3 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/PetApi.ts @@ -79,7 +79,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pet')) { - throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'pet', + 'Required parameter "pet" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -98,7 +101,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.pet), + body: PetToJSON(requestParameters['pet']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -118,7 +121,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -126,7 +132,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -135,7 +141,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -158,13 +164,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -200,13 +209,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = Array.from(requestParameters.tags).join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = Array.from(requestParameters['tags'])!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -242,7 +254,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -254,7 +269,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -278,7 +293,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'pet')) { - throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'pet', + 'Required parameter "pet" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -297,7 +315,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.pet), + body: PetToJSON(requestParameters['pet']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -317,7 +335,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -343,16 +364,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -376,7 +397,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -404,16 +428,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -438,11 +462,17 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileWithRequiredFileRaw(requestParameters: UploadFileWithRequiredFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFileWithRequiredFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFileWithRequiredFile().' + ); } if (!runtime.exists(requestParameters, 'requiredFile')) { - throw new runtime.RequiredError('requiredFile','Required parameter requestParameters.requiredFile was null or undefined when calling uploadFileWithRequiredFile.'); + throw new runtime.RequiredError( + 'requiredFile', + 'Required parameter "requiredFile" was null or undefined when calling uploadFileWithRequiredFile().' + ); } const queryParameters: any = {}; @@ -470,16 +500,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.requiredFile !== undefined) { - formParams.append('requiredFile', requestParameters.requiredFile as any); + if (runtime.exists(requestParameters, 'requiredFile')) { + formParams.append('requiredFile', requestParameters['requiredFile'] as any); } const response = await this.request({ - path: `/fake/{petId}/uploadImageWithRequiredFile`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/fake/{petId}/uploadImageWithRequiredFile`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts index 433a2289bd4d..4444f71d4cd0 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{order_id}`.replace(`{${"order_id"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -140,7 +146,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'order')) { - throw new runtime.RequiredError('order','Required parameter requestParameters.order was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'order', + 'Required parameter "order" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -154,7 +163,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.order), + body: OrderToJSON(requestParameters['order']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts index 490810fdb119..36114480012f 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/apis/UserApi.ts @@ -63,7 +63,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -77,7 +80,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.user), + body: UserToJSON(requestParameters['user']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -97,7 +100,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -111,7 +117,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.user.map(UserToJSON), + body: requestParameters['user']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -131,7 +137,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -145,7 +154,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.user.map(UserToJSON), + body: requestParameters['user']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -165,7 +174,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -173,7 +185,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -196,7 +208,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -204,7 +219,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -228,21 +243,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -303,11 +324,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'user')) { - throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'user', + 'Required parameter "user" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -317,11 +344,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.user), + body: UserToJSON(requestParameters['user']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts index b1a0a9c8a487..5e23cca93b1a 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts @@ -211,7 +211,10 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -230,7 +233,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -248,7 +251,10 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -256,7 +262,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -265,7 +271,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -287,13 +293,16 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -329,13 +338,16 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -371,7 +383,10 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -383,7 +398,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -406,7 +421,10 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -425,7 +443,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -443,7 +461,10 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -469,16 +490,16 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -500,7 +521,10 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -528,16 +552,16 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts index 4e23f251554c..3b01cbdee12c 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts @@ -116,7 +116,10 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -124,7 +127,7 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -179,7 +182,10 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -187,7 +193,7 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -210,7 +216,10 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -224,7 +233,7 @@ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.body), + body: OrderToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts index dbe7cad198b5..fcd1170d4fa8 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts @@ -196,7 +196,10 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -210,7 +213,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -229,7 +232,10 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -243,7 +249,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -261,7 +267,10 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -275,7 +284,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -294,7 +303,10 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -302,7 +314,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -324,7 +336,10 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -332,7 +347,7 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -354,21 +369,27 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -426,11 +447,17 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -440,11 +467,11 @@ export class UserApi extends runtime.BaseAPI implements UserApiInterface { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts index 1b1d0acd7fab..87cab8f993a2 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts @@ -72,7 +72,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -91,7 +94,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -109,7 +112,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -117,7 +123,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -126,7 +132,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -148,13 +154,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -190,13 +199,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -232,7 +244,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -244,7 +259,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -267,7 +282,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -286,7 +304,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: PetToJSON(requestParameters.body), + body: PetToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -304,7 +322,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -330,16 +351,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -361,7 +382,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -389,16 +413,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts index e36f9270bf55..74fc267af7da 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts @@ -45,7 +45,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -53,7 +56,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -108,7 +111,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -116,7 +122,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -139,7 +145,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -153,7 +162,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: OrderToJSON(requestParameters.body), + body: OrderToJSON(requestParameters['body']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => OrderFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts index e10b9a986a4f..565ceefcaab9 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts @@ -63,7 +63,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -77,7 +80,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -96,7 +99,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -110,7 +116,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -128,7 +134,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -142,7 +151,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body.map(UserToJSON), + body: requestParameters['body']!.map(UserToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); @@ -161,7 +170,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -169,7 +181,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -191,7 +203,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -199,7 +214,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -221,21 +236,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -293,11 +314,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -307,11 +334,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: UserToJSON(requestParameters.body), + body: UserToJSON(requestParameters['body']), }, initOverrides); return new runtime.VoidApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts index e46b49a1b571..8cefb3e075cd 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts @@ -63,20 +63,20 @@ export class DefaultApi extends runtime.BaseAPI { async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.stringEnum !== undefined) { - queryParameters['string-enum'] = requestParameters.stringEnum; + if (runtime.exists(requestParameters, 'stringEnum')) { + queryParameters['string-enum'] = requestParameters['stringEnum']; } - if (requestParameters.nullableStringEnum !== undefined) { - queryParameters['nullable-string-enum'] = requestParameters.nullableStringEnum; + if (runtime.exists(requestParameters, 'nullableStringEnum')) { + queryParameters['nullable-string-enum'] = requestParameters['nullableStringEnum']; } - if (requestParameters.numberEnum !== undefined) { - queryParameters['number-enum'] = requestParameters.numberEnum; + if (runtime.exists(requestParameters, 'numberEnum')) { + queryParameters['number-enum'] = requestParameters['numberEnum']; } - if (requestParameters.nullableNumberEnum !== undefined) { - queryParameters['nullable-number-enum'] = requestParameters.nullableNumberEnum; + if (runtime.exists(requestParameters, 'nullableNumberEnum')) { + queryParameters['nullable-number-enum'] = requestParameters['nullableNumberEnum']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -103,20 +103,20 @@ export class DefaultApi extends runtime.BaseAPI { async fakeEnumRequestGetRefRaw(requestParameters: FakeEnumRequestGetRefRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.stringEnum !== undefined) { - queryParameters['string-enum'] = requestParameters.stringEnum; + if (runtime.exists(requestParameters, 'stringEnum')) { + queryParameters['string-enum'] = requestParameters['stringEnum']; } - if (requestParameters.nullableStringEnum !== undefined) { - queryParameters['nullable-string-enum'] = requestParameters.nullableStringEnum; + if (runtime.exists(requestParameters, 'nullableStringEnum')) { + queryParameters['nullable-string-enum'] = requestParameters['nullableStringEnum']; } - if (requestParameters.numberEnum !== undefined) { - queryParameters['number-enum'] = requestParameters.numberEnum; + if (runtime.exists(requestParameters, 'numberEnum')) { + queryParameters['number-enum'] = requestParameters['numberEnum']; } - if (requestParameters.nullableNumberEnum !== undefined) { - queryParameters['nullable-number-enum'] = requestParameters.nullableNumberEnum; + if (runtime.exists(requestParameters, 'nullableNumberEnum')) { + queryParameters['nullable-number-enum'] = requestParameters['nullableNumberEnum']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -152,7 +152,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters.fakeEnumRequestGetInline200Response), + body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters['fakeEnumRequestGetInline200Response']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); @@ -179,7 +179,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: EnumPatternObjectToJSON(requestParameters.enumPatternObject), + body: EnumPatternObjectToJSON(requestParameters['enumPatternObject']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnumPatternObjectFromJSON(jsonValue)); diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts index b9a384c6a6c5..8bef5a9c322c 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/PetApi.ts @@ -66,7 +66,10 @@ export class PetApi extends runtime.BaseAPI { */ async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling addPet().' + ); } const queryParameters: any = {}; @@ -85,7 +88,7 @@ export class PetApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body, + body: requestParameters['body'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -103,7 +106,10 @@ export class PetApi extends runtime.BaseAPI { */ async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling deletePet().' + ); } const queryParameters: any = {}; @@ -111,7 +117,7 @@ export class PetApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; if (runtime.exists(requestParameters, 'apiKey')) { - headerParameters['api_key'] = String(requestParameters.apiKey); + headerParameters['api_key'] = String(requestParameters['apiKey']); } if (this.configuration && this.configuration.accessToken) { @@ -120,7 +126,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -142,13 +148,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'status')) { - throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); + throw new runtime.RequiredError( + 'status', + 'Required parameter "status" was null or undefined when calling findPetsByStatus().' + ); } const queryParameters: any = {}; - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'status')) { + queryParameters['status'] = requestParameters['status']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -184,13 +193,16 @@ export class PetApi extends runtime.BaseAPI { */ async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (!runtime.exists(requestParameters, 'tags')) { - throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); + throw new runtime.RequiredError( + 'tags', + 'Required parameter "tags" was null or undefined when calling findPetsByTags().' + ); } const queryParameters: any = {}; - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(runtime.COLLECTION_FORMATS["csv"]); + if (runtime.exists(requestParameters, 'tags')) { + queryParameters['tags'] = requestParameters['tags']!.join(runtime.COLLECTION_FORMATS["csv"]); } const headerParameters: runtime.HTTPHeaders = {}; @@ -226,7 +238,10 @@ export class PetApi extends runtime.BaseAPI { */ async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling getPetById().' + ); } const queryParameters: any = {}; @@ -238,7 +253,7 @@ export class PetApi extends runtime.BaseAPI { } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -261,7 +276,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updatePet().' + ); } const queryParameters: any = {}; @@ -280,7 +298,7 @@ export class PetApi extends runtime.BaseAPI { method: 'PUT', headers: headerParameters, query: queryParameters, - body: requestParameters.body, + body: requestParameters['body'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -298,7 +316,10 @@ export class PetApi extends runtime.BaseAPI { */ async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling updatePetWithForm().' + ); } const queryParameters: any = {}; @@ -324,16 +345,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.name !== undefined) { - formParams.append('name', requestParameters.name as any); + if (runtime.exists(requestParameters, 'name')) { + formParams.append('name', requestParameters['name'] as any); } - if (requestParameters.status !== undefined) { - formParams.append('status', requestParameters.status as any); + if (runtime.exists(requestParameters, 'status')) { + formParams.append('status', requestParameters['status'] as any); } const response = await this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, @@ -355,7 +376,10 @@ export class PetApi extends runtime.BaseAPI { */ async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'petId')) { - throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); + throw new runtime.RequiredError( + 'petId', + 'Required parameter "petId" was null or undefined when calling uploadFile().' + ); } const queryParameters: any = {}; @@ -383,16 +407,16 @@ export class PetApi extends runtime.BaseAPI { formParams = new URLSearchParams(); } - if (requestParameters.additionalMetadata !== undefined) { - formParams.append('additionalMetadata', requestParameters.additionalMetadata as any); + if (runtime.exists(requestParameters, 'additionalMetadata')) { + formParams.append('additionalMetadata', requestParameters['additionalMetadata'] as any); } - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); + if (runtime.exists(requestParameters, 'file')) { + formParams.append('file', requestParameters['file'] as any); } const response = await this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId']))), method: 'POST', headers: headerParameters, query: queryParameters, diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts index 56ed7b363f8e..e5443fc60605 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/StoreApi.ts @@ -41,7 +41,10 @@ export class StoreApi extends runtime.BaseAPI { */ async deleteOrderRaw(requestParameters: DeleteOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling deleteOrder().' + ); } const queryParameters: any = {}; @@ -49,7 +52,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -104,7 +107,10 @@ export class StoreApi extends runtime.BaseAPI { */ async getOrderByIdRaw(requestParameters: GetOrderByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'orderId')) { - throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); + throw new runtime.RequiredError( + 'orderId', + 'Required parameter "orderId" was null or undefined when calling getOrderById().' + ); } const queryParameters: any = {}; @@ -112,7 +118,7 @@ export class StoreApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters['orderId']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -135,7 +141,10 @@ export class StoreApi extends runtime.BaseAPI { */ async placeOrderRaw(requestParameters: PlaceOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling placeOrder().' + ); } const queryParameters: any = {}; @@ -149,7 +158,7 @@ export class StoreApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body, + body: requestParameters['body'], }, initOverrides); return new runtime.JSONApiResponse(response); diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts index efc6483d0dc7..42175e737dee 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/src/apis/UserApi.ts @@ -59,7 +59,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUserRaw(requestParameters: CreateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUser().' + ); } const queryParameters: any = {}; @@ -73,7 +76,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body, + body: requestParameters['body'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -92,7 +95,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithArrayInput().' + ); } const queryParameters: any = {}; @@ -106,7 +112,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body, + body: requestParameters['body'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -124,7 +130,10 @@ export class UserApi extends runtime.BaseAPI { */ async createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling createUsersWithListInput().' + ); } const queryParameters: any = {}; @@ -138,7 +147,7 @@ export class UserApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: requestParameters.body, + body: requestParameters['body'], }, initOverrides); return new runtime.VoidApiResponse(response); @@ -157,7 +166,10 @@ export class UserApi extends runtime.BaseAPI { */ async deleteUserRaw(requestParameters: DeleteUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling deleteUser().' + ); } const queryParameters: any = {}; @@ -165,7 +177,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'DELETE', headers: headerParameters, query: queryParameters, @@ -187,7 +199,10 @@ export class UserApi extends runtime.BaseAPI { */ async getUserByNameRaw(requestParameters: GetUserByNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling getUserByName().' + ); } const queryParameters: any = {}; @@ -195,7 +210,7 @@ export class UserApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'GET', headers: headerParameters, query: queryParameters, @@ -217,21 +232,27 @@ export class UserApi extends runtime.BaseAPI { */ async loginUserRaw(requestParameters: LoginUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling loginUser().' + ); } if (!runtime.exists(requestParameters, 'password')) { - throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); + throw new runtime.RequiredError( + 'password', + 'Required parameter "password" was null or undefined when calling loginUser().' + ); } const queryParameters: any = {}; - if (requestParameters.username !== undefined) { - queryParameters['username'] = requestParameters.username; + if (runtime.exists(requestParameters, 'username')) { + queryParameters['username'] = requestParameters['username']; } - if (requestParameters.password !== undefined) { - queryParameters['password'] = requestParameters.password; + if (runtime.exists(requestParameters, 'password')) { + queryParameters['password'] = requestParameters['password']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -289,11 +310,17 @@ export class UserApi extends runtime.BaseAPI { */ async updateUserRaw(requestParameters: UpdateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (!runtime.exists(requestParameters, 'username')) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'username', + 'Required parameter "username" was null or undefined when calling updateUser().' + ); } if (!runtime.exists(requestParameters, 'body')) { - throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); + throw new runtime.RequiredError( + 'body', + 'Required parameter "body" was null or undefined when calling updateUser().' + ); } const queryParameters: any = {}; @@ -303,11 +330,11 @@ export class UserApi extends runtime.BaseAPI { headerParameters['Content-Type'] = 'application/json'; const response = await this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters['username']))), method: 'PUT', headers: headerParameters, query: queryParameters, - body: requestParameters.body, + body: requestParameters['body'], }, initOverrides); return new runtime.VoidApiResponse(response); From 78b04f53c6c39d57ee32c110853f170a0156c475 Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Tue, 6 Feb 2024 21:34:37 +0100 Subject: [PATCH 8/8] Refer to properties differently. --- .../typescript-fetch/modelGeneric.mustache | 18 ++++---- .../typescript-fetch/recordGeneric.mustache | 24 +++++----- .../resources/typescript-fetch/sagas.mustache | 2 +- .../builds/allOf-nullable/models/Club.ts | 2 +- .../builds/allOf-nullable/models/Owner.ts | 2 +- .../builds/allOf-readonly/models/Owner.ts | 2 +- .../models/AdditionalPropertiesClass.ts | 4 +- .../default-v3.0/models/AllOfWithSingleRef.ts | 4 +- .../builds/default-v3.0/models/Animal.ts | 4 +- .../models/ArrayOfArrayOfNumberOnly.ts | 2 +- .../default-v3.0/models/ArrayOfNumberOnly.ts | 2 +- .../builds/default-v3.0/models/ArrayTest.ts | 6 +-- .../default-v3.0/models/Capitalization.ts | 12 ++--- .../builds/default-v3.0/models/Cat.ts | 2 +- .../builds/default-v3.0/models/Category.ts | 4 +- .../default-v3.0/models/ChildWithNullable.ts | 2 +- .../builds/default-v3.0/models/ClassModel.ts | 2 +- .../builds/default-v3.0/models/Client.ts | 2 +- .../default-v3.0/models/DeprecatedObject.ts | 2 +- .../builds/default-v3.0/models/Dog.ts | 2 +- .../builds/default-v3.0/models/EnumArrays.ts | 4 +- .../builds/default-v3.0/models/EnumTest.ts | 16 +++---- .../models/FakeBigDecimalMap200Response.ts | 4 +- .../models/FileSchemaTestClass.ts | 4 +- .../builds/default-v3.0/models/Foo.ts | 2 +- .../models/FooGetDefaultResponse.ts | 2 +- .../builds/default-v3.0/models/FormatTest.ts | 32 ++++++------- .../default-v3.0/models/HealthCheckResult.ts | 2 +- .../builds/default-v3.0/models/List.ts | 2 +- .../builds/default-v3.0/models/MapTest.ts | 8 ++-- ...dPropertiesAndAdditionalPropertiesClass.ts | 6 +-- .../default-v3.0/models/Model200Response.ts | 4 +- .../default-v3.0/models/ModelApiResponse.ts | 6 +-- .../builds/default-v3.0/models/ModelFile.ts | 2 +- .../builds/default-v3.0/models/Name.ts | 4 +- .../default-v3.0/models/NullableClass.ts | 24 +++++----- .../builds/default-v3.0/models/NumberOnly.ts | 2 +- .../models/ObjectWithDeprecatedFields.ts | 8 ++-- .../builds/default-v3.0/models/Order.ts | 12 ++--- .../default-v3.0/models/OuterComposite.ts | 6 +-- .../models/OuterObjectWithEnumProperty.ts | 2 +- .../default-v3.0/models/ParentWithNullable.ts | 4 +- .../builds/default-v3.0/models/Pet.ts | 12 ++--- .../default-v3.0/models/ReadOnlyFirst.ts | 2 +- .../builds/default-v3.0/models/Return.ts | 2 +- .../default-v3.0/models/SpecialModelName.ts | 2 +- .../builds/default-v3.0/models/Tag.ts | 4 +- ...lineFreeformAdditionalPropertiesRequest.ts | 2 +- .../builds/default-v3.0/models/User.ts | 16 +++---- .../builds/default/models/Category.ts | 4 +- .../builds/default/models/ModelApiResponse.ts | 6 +-- .../builds/default/models/Order.ts | 12 ++--- .../builds/default/models/Pet.ts | 12 ++--- .../builds/default/models/Tag.ts | 4 +- .../builds/default/models/User.ts | 16 +++---- .../builds/enum/models/EnumPatternObject.ts | 8 ++-- .../FakeEnumRequestGetInline200Response.ts | 8 ++-- .../builds/es6-target/src/models/Category.ts | 4 +- .../es6-target/src/models/ModelApiResponse.ts | 6 +-- .../builds/es6-target/src/models/Order.ts | 12 ++--- .../builds/es6-target/src/models/Pet.ts | 12 ++--- .../builds/es6-target/src/models/Tag.ts | 4 +- .../builds/es6-target/src/models/User.ts | 16 +++---- .../multiple-parameters/models/Category.ts | 4 +- .../models/ModelApiResponse.ts | 6 +-- .../multiple-parameters/models/Order.ts | 12 ++--- .../builds/multiple-parameters/models/Pet.ts | 12 ++--- .../builds/multiple-parameters/models/Tag.ts | 4 +- .../builds/multiple-parameters/models/User.ts | 16 +++---- .../src/models/Category.ts | 4 +- .../src/models/ModelApiResponse.ts | 6 +-- .../src/models/Order.ts | 12 ++--- .../src/models/Pet.ts | 12 ++--- .../src/models/Tag.ts | 4 +- .../src/models/User.ts | 16 +++---- .../src/apis/BehaviorApiSagas.ts | 4 +- .../sagas-and-records/src/apis/PetApiSagas.ts | 24 +++++----- .../src/apis/PetPartApiSagas.ts | 4 +- .../src/apis/StoreApiSagas.ts | 8 ++-- .../src/apis/UserApiSagas.ts | 16 +++---- .../sagas-and-records/src/models/Category.ts | 4 +- .../src/models/CategoryRecord.ts | 4 +- .../src/models/DefaultMetaOnlyResponse.ts | 2 +- .../models/DefaultMetaOnlyResponseRecord.ts | 4 +- .../src/models/FindPetsByStatusResponse.ts | 4 +- .../models/FindPetsByStatusResponseRecord.ts | 8 ++-- .../src/models/FindPetsByUserResponse.ts | 4 +- .../models/FindPetsByUserResponseRecord.ts | 8 ++-- .../models/GetBehaviorPermissionsResponse.ts | 4 +- .../GetBehaviorPermissionsResponseRecord.ts | 4 +- .../src/models/GetBehaviorTypeResponse.ts | 4 +- .../models/GetBehaviorTypeResponseRecord.ts | 4 +- .../src/models/GetMatchingPartsResponse.ts | 4 +- .../models/GetMatchingPartsResponseRecord.ts | 8 ++-- .../src/models/GetPetPartTypeResponse.ts | 4 +- .../models/GetPetPartTypeResponseRecord.ts | 4 +- .../sagas-and-records/src/models/ItemId.ts | 4 +- .../src/models/MatchingParts.ts | 4 +- .../src/models/MatchingPartsRecord.ts | 8 ++-- .../src/models/ModelApiResponse.ts | 6 +-- .../src/models/ModelError.ts | 8 ++-- .../src/models/ModelErrorRecord.ts | 4 +- .../sagas-and-records/src/models/Order.ts | 12 ++--- .../src/models/OrderRecord.ts | 4 +- .../sagas-and-records/src/models/Part.ts | 4 +- .../src/models/PartRecord.ts | 4 +- .../sagas-and-records/src/models/Pet.ts | 42 ++++++++--------- .../sagas-and-records/src/models/PetRecord.ts | 46 +++++++++---------- .../src/models/PetRegionsResponse.ts | 4 +- .../src/models/PetRegionsResponseRecord.ts | 8 ++-- .../src/models/ResponseMeta.ts | 12 ++--- .../sagas-and-records/src/models/Tag.ts | 4 +- .../sagas-and-records/src/models/TagRecord.ts | 4 +- .../sagas-and-records/src/models/User.ts | 20 ++++---- .../src/models/UserRecord.ts | 4 +- .../models/AdditionalPropertiesClass.ts | 4 +- .../models/AllOfWithSingleRef.ts | 4 +- .../snakecase-discriminator/models/Animal.ts | 4 +- .../models/ArrayOfArrayOfNumberOnly.ts | 2 +- .../models/ArrayOfNumberOnly.ts | 2 +- .../models/ArrayTest.ts | 6 +-- .../models/Capitalization.ts | 12 ++--- .../snakecase-discriminator/models/Cat.ts | 2 +- .../models/Category.ts | 4 +- .../models/ClassModel.ts | 2 +- .../snakecase-discriminator/models/Client.ts | 2 +- .../models/DeprecatedObject.ts | 2 +- .../snakecase-discriminator/models/Dog.ts | 2 +- .../models/EnumArrays.ts | 4 +- .../models/EnumTest.ts | 16 +++---- .../models/FakeBigDecimalMap200Response.ts | 4 +- .../models/FileSchemaTestClass.ts | 4 +- .../snakecase-discriminator/models/Foo.ts | 2 +- .../models/FooGetDefaultResponse.ts | 2 +- .../models/FormatTest.ts | 32 ++++++------- .../models/HealthCheckResult.ts | 2 +- .../snakecase-discriminator/models/List.ts | 2 +- .../snakecase-discriminator/models/MapTest.ts | 8 ++-- ...dPropertiesAndAdditionalPropertiesClass.ts | 6 +-- .../models/Model200Response.ts | 4 +- .../models/ModelApiResponse.ts | 6 +-- .../models/ModelFile.ts | 2 +- .../snakecase-discriminator/models/Name.ts | 4 +- .../models/NullableClass.ts | 24 +++++----- .../models/NumberOnly.ts | 2 +- .../models/ObjectWithDeprecatedFields.ts | 8 ++-- .../snakecase-discriminator/models/Order.ts | 12 ++--- .../models/OuterComposite.ts | 6 +-- .../models/OuterObjectWithEnumProperty.ts | 2 +- .../snakecase-discriminator/models/Pet.ts | 12 ++--- .../models/ReadOnlyFirst.ts | 2 +- .../snakecase-discriminator/models/Return.ts | 2 +- .../models/SpecialModelName.ts | 2 +- .../snakecase-discriminator/models/Tag.ts | 4 +- .../snakecase-discriminator/models/User.ts | 16 +++---- .../builds/with-interfaces/models/Category.ts | 4 +- .../models/ModelApiResponse.ts | 6 +-- .../builds/with-interfaces/models/Order.ts | 12 ++--- .../builds/with-interfaces/models/Pet.ts | 12 ++--- .../builds/with-interfaces/models/Tag.ts | 4 +- .../builds/with-interfaces/models/User.ts | 16 +++---- .../with-npm-version/src/models/Category.ts | 4 +- .../src/models/ModelApiResponse.ts | 6 +-- .../with-npm-version/src/models/Order.ts | 12 ++--- .../builds/with-npm-version/src/models/Pet.ts | 12 ++--- .../builds/with-npm-version/src/models/Tag.ts | 4 +- .../with-npm-version/src/models/User.ts | 16 +++---- .../models/EnumPatternObject.ts | 8 ++-- .../FakeEnumRequestGetInline200Response.ts | 8 ++-- 169 files changed, 611 insertions(+), 611 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache index 653657d5152c..df0df852beb9 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -117,18 +117,18 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any { {{^isReadOnly}} {{#isPrimitiveType}} {{#isDateType}} - '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value.{{name}}{{#isNullable}} as any{{/isNullable}}).toISOString().substring(0,10)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value['{{name}}']{{#isNullable}} as any{{/isNullable}}).toISOString().substring(0,10)), {{/isDateType}} {{#isDateTimeType}} - '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value.{{name}}{{#isNullable}} as any{{/isNullable}}).toISOString()), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value['{{name}}']{{#isNullable}} as any{{/isNullable}}).toISOString()), {{/isDateTimeType}} {{#isArray}} - '{{baseName}}': {{#uniqueItems}}{{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}{{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}Array.from(value.{{name}} as Set){{/uniqueItems}}{{^uniqueItems}}value.{{name}}{{/uniqueItems}}, + '{{baseName}}': {{#uniqueItems}}{{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}{{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}Array.from(value['{{name}}'] as Set){{/uniqueItems}}{{^uniqueItems}}value['{{name}}']{{/uniqueItems}}, {{/isArray}} {{^isDateType}} {{^isDateTimeType}} {{^isArray}} - '{{baseName}}': value.{{name}}, + '{{baseName}}': value['{{name}}'], {{/isArray}} {{/isDateTimeType}} {{/isDateType}} @@ -136,22 +136,22 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any { {{^isPrimitiveType}} {{#isArray}} {{#uniqueItems}} - '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}Array.from(value.{{name}} as Set).map({{#items}}{{datatype}}{{/items}}ToJSON)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}Array.from(value['{{name}}'] as Set).map({{#items}}{{datatype}}{{/items}}ToJSON)), {{/uniqueItems}} {{^uniqueItems}} - '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value.{{name}} as Array).map({{#items}}{{datatype}}{{/items}}ToJSON)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}(value['{{name}}'] as Array).map({{#items}}{{datatype}}{{/items}}ToJSON)), {{/uniqueItems}} {{/isArray}} {{#isMap}} - '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}mapValues(value.{{name}}, {{#items}}{{datatype}}{{/items}}ToJSON)), + '{{baseName}}': {{^required}}!exists(value, '{{name}}') ? undefined : {{/required}}({{#required}}{{#isNullable}}!exists(value, '{{name}}') ? null : {{/isNullable}}{{/required}}mapValues(value['{{name}}'], {{#items}}{{datatype}}{{/items}}ToJSON)), {{/isMap}} {{^isArray}} {{^isMap}} {{^isFreeFormObject}} - '{{baseName}}': {{datatype}}ToJSON(value.{{name}}), + '{{baseName}}': {{datatype}}ToJSON(value['{{name}}']), {{/isFreeFormObject}} {{#isFreeFormObject}} - '{{baseName}}': value.{{name}}, + '{{baseName}}': value['{{name}}'], {{/isFreeFormObject}} {{/isMap}} {{/isArray}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache index 8909906d6745..819a29e44ee8 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache @@ -98,23 +98,23 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname {{#isUniqueId}} {{#isArray}} {{#items.isArray}} - {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.map(item => item.map(item2 => item2?.toString()));{{^required}} } {{/required}} + {{^required}}if (apiObject['{{name}}']) { {{/required}}(apiObject as any)['{{name}}'] = apiObject['{{name}}'].map(item => item.map(item2 => item2?.toString()));{{^required}} } {{/required}} {{/items.isArray}} {{^items.isArray}} - {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.map(item => item?.toString());{{^required}} } {{/required}} + {{^required}}if (apiObject['{{name}}']) { {{/required}}(apiObject as any)['{{name}}'] = apiObject['{{name}}'].map(item => item?.toString());{{^required}} } {{/required}} {{/items.isArray}} {{/isArray}} {{^isArray}} - {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.toString();{{^required}} } {{/required}} + {{^required}}if (apiObject['{{name}}']) { {{/required}}(apiObject as any)['{{name}}'] = apiObject['{{name}}'].toString();{{^required}} } {{/required}} {{/isArray}} {{/isUniqueId}} {{^keepAsJSObject}} {{#isModel}} - {{^required}}if (apiObject.{{name}}) { {{/required}}{{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.normalize(apiObject.{{name}});{{^required}} } {{/required}} + {{^required}}if (apiObject['{{name}}']) { {{/required}}{{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.normalize(apiObject['{{name}}']);{{^required}} } {{/required}} {{/isModel}} {{#isArray}} {{#items.isModel}} - {{^required}}if (apiObject.{{name}}) { {{/required}}{{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.normalizeArray(apiObject.{{name}});{{^required}} } {{/required}} + {{^required}}if (apiObject['{{name}}']) { {{/required}}{{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.normalizeArray(apiObject['{{name}}']);{{^required}} } {{/required}} {{/items.isModel}} {{/isArray}} {{/keepAsJSObject}} @@ -172,14 +172,14 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname {{#isEntity}} {{^keepAsJSObject}} // @ts-ignore - {{name}}: {{^required}}entity.{{name}} ? {{/required}}yield call({{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toInlined, entity.{{name}}){{^required}} : null{{/required}}, + {{name}}: {{^required}}entity['{{name}}'] ? {{/required}}yield call({{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toInlined, entity['{{name}}']){{^required}} : null{{/required}}, {{/keepAsJSObject}} {{/isEntity}} {{#isArray}} {{#items.isEntity}} {{^keepAsJSObject}} // @ts-ignore - {{name}}: {{^required}}entity.{{name}} ? {{/required}}yield call({{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toInlinedArray, entity.{{name}}){{^required}} : null{{/required}}, + {{name}}: {{^required}}entity['{{name}}'] ? {{/required}}yield call({{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toInlinedArray, entity['{{name}}']){{^required}} : null{{/required}}, {{/keepAsJSObject}} {{/items.isEntity}} {{/isArray}} @@ -212,23 +212,23 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname {{#isUniqueId}} {{#isArray}} {{#items.isArray}} - {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(){{/isArray}};{{^required}} } {{/required}} + {{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#isArray}}record['{{name}}'].map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(){{/isArray}};{{^required}} } {{/required}} {{/items.isArray}} {{^items.isArray}} - {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => (item ? parseFloat(item) : null) as number).toArray(){{/isArray}};{{^required}} } {{/required}} + {{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#isArray}}record['{{name}}'].map(item => (item ? parseFloat(item) : null) as number).toArray(){{/isArray}};{{^required}} } {{/required}} {{/items.isArray}} {{/isArray}} {{^isArray}} - {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{^isArray}}parseFloat(record.{{name}}){{/isArray}};{{^required}} } {{/required}} + {{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{^isArray}}parseFloat(record['{{name}}']){{/isArray}};{{^required}} } {{/required}} {{/isArray}} {{/isUniqueId}} {{^keepAsJSObject}} {{#isModel}} - {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toApi(record.{{name}});{{^required}} } {{/required}} + {{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toApi(record['{{name}}']);{{^required}} } {{/required}} {{/isModel}} {{#isArray}} {{#items.isModel}} - {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toApiArray(record.{{name}});{{^required}} } {{/required}} + {{^required}}if (record['{{name}}']) { {{/required}}apiObject['{{name}}'] = {{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toApiArray(record['{{name}}']);{{^required}} } {{/required}} {{/items.isModel}} {{/isArray}} {{/keepAsJSObject}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache index 5f0b4a8e4512..304324cbd5a8 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache @@ -105,7 +105,7 @@ export function *{{nickname}}SagaImp(_action_: Action{{/returnType}} = yield apiCall(Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}, Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.{{nickname}}, + const response{{#returnType}}: Required<{{{returnType}}}>{{/returnType}} = yield apiCall(Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}, Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}['{{nickname}}'], {{#allParams.0}} {{#allParams}} {{#isUniqueId}} 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 e88146a7eb88..513f4f1ea976 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 @@ -64,7 +64,7 @@ export function ClubToJSON(value?: Club | null): any { } return { - 'owner': OwnerToJSON(value.owner), + '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 6be9b11728ba..da532a1c5503 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 @@ -57,7 +57,7 @@ export function OwnerToJSON(value?: Owner | null): any { } return { - 'name': value.name, + 'name': value['name'], }; } 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 6be9b11728ba..da532a1c5503 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 @@ -57,7 +57,7 @@ export function OwnerToJSON(value?: Owner | null): any { } return { - 'name': value.name, + '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 bbd3320b0da2..429a86538cd1 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 @@ -64,8 +64,8 @@ export function AdditionalPropertiesClassToJSON(value?: AdditionalPropertiesClas } return { - 'map_property': value.mapProperty, - 'map_of_map_property': value.mapOfMapProperty, + 'map_property': value['mapProperty'], + 'map_of_map_property': value['mapOfMapProperty'], }; } 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 5141e93860bd..5fc70179d079 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 @@ -71,8 +71,8 @@ export function AllOfWithSingleRefToJSON(value?: AllOfWithSingleRef | null): any } return { - 'username': value.username, - 'SingleRefType': SingleRefTypeToJSON(value.singleRefType), + 'username': value['username'], + 'SingleRefType': SingleRefTypeToJSON(value['singleRefType']), }; } 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 b73c9a196004..2d08a8e50e4a 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 @@ -78,8 +78,8 @@ export function AnimalToJSON(value?: Animal | null): any { } return { - 'className': value.className, - 'color': value.color, + 'className': value['className'], + 'color': value['color'], }; } 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 6a78fd045016..6aca52358716 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 @@ -57,7 +57,7 @@ export function ArrayOfArrayOfNumberOnlyToJSON(value?: ArrayOfArrayOfNumberOnly } return { - 'ArrayArrayNumber': value.arrayArrayNumber, + '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 a0387227bb7e..b39a628ed121 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 @@ -57,7 +57,7 @@ export function ArrayOfNumberOnlyToJSON(value?: ArrayOfNumberOnly | null): any { } return { - 'ArrayNumber': value.arrayNumber, + '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 1ce94b762fcb..2396708971fa 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 @@ -78,9 +78,9 @@ export function ArrayTestToJSON(value?: ArrayTest | null): any { } return { - 'array_of_string': value.arrayOfString, - 'array_array_of_integer': value.arrayArrayOfInteger, - 'array_array_of_model': value.arrayArrayOfModel, + 'array_of_string': value['arrayOfString'], + 'array_array_of_integer': value['arrayArrayOfInteger'], + 'array_array_of_model': value['arrayArrayOfModel'], }; } 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 0b29fa564ea5..30a6a48dfde4 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 @@ -93,12 +93,12 @@ export function CapitalizationToJSON(value?: Capitalization | null): any { } return { - 'smallCamel': value.smallCamel, - 'CapitalCamel': value.capitalCamel, - 'small_Snake': value.smallSnake, - 'Capital_Snake': value.capitalSnake, - 'SCA_ETH_Flow_Points': value.sCAETHFlowPoints, - 'ATT_NAME': value.aTTNAME, + 'smallCamel': value['smallCamel'], + 'CapitalCamel': value['capitalCamel'], + 'small_Snake': value['smallSnake'], + 'Capital_Snake': value['capitalSnake'], + 'SCA_ETH_Flow_Points': value['sCAETHFlowPoints'], + 'ATT_NAME': value['aTTNAME'], }; } 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 73d368191f2b..94507ba96b1f 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 @@ -64,7 +64,7 @@ export function CatToJSON(value?: Cat | null): any { } return { ...AnimalToJSON(value), - 'declawed': value.declawed, + '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 87cea65fe6f5..3b4d927fb025 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 @@ -65,8 +65,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 1c3d993effd8..d1424e2d3d66 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 @@ -66,7 +66,7 @@ export function ChildWithNullableToJSON(value?: ChildWithNullable | null): any { } return { ...ParentWithNullableToJSON(value), - 'otherProperty': value.otherProperty, + '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 7292e552629a..6309f0dfce81 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 @@ -57,7 +57,7 @@ export function ClassModelToJSON(value?: ClassModel | null): any { } return { - '_class': value._class, + '_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 80790e10b9db..96e2993ca963 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 @@ -57,7 +57,7 @@ export function ClientToJSON(value?: Client | null): any { } return { - 'client': value.client, + '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 d5557822fbe1..c8113b4c9a39 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 @@ -57,7 +57,7 @@ export function DeprecatedObjectToJSON(value?: DeprecatedObject | null): any { } return { - 'name': value.name, + '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 71c7d929582f..fec18e3e484c 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 @@ -64,7 +64,7 @@ export function DogToJSON(value?: Dog | null): any { } return { ...AnimalToJSON(value), - 'breed': value.breed, + '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 1b10872b3afb..0c93a179655a 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 @@ -84,8 +84,8 @@ export function EnumArraysToJSON(value?: EnumArrays | null): any { } return { - 'just_symbol': value.justSymbol, - 'array_enum': value.arrayEnum, + 'just_symbol': value['justSymbol'], + 'array_enum': value['arrayEnum'], }; } 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 633bb0999d1f..9a8b5051c321 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 @@ -172,14 +172,14 @@ export function EnumTestToJSON(value?: EnumTest | null): any { } return { - 'enum_string': value.enumString, - 'enum_string_required': value.enumStringRequired, - 'enum_integer': value.enumInteger, - 'enum_number': value.enumNumber, - 'outerEnum': OuterEnumToJSON(value.outerEnum), - 'outerEnumInteger': OuterEnumIntegerToJSON(value.outerEnumInteger), - 'outerEnumDefaultValue': OuterEnumDefaultValueToJSON(value.outerEnumDefaultValue), - 'outerEnumIntegerDefaultValue': OuterEnumIntegerDefaultValueToJSON(value.outerEnumIntegerDefaultValue), + 'enum_string': value['enumString'], + 'enum_string_required': value['enumStringRequired'], + 'enum_integer': value['enumInteger'], + 'enum_number': value['enumNumber'], + 'outerEnum': OuterEnumToJSON(value['outerEnum']), + 'outerEnumInteger': OuterEnumIntegerToJSON(value['outerEnumInteger']), + 'outerEnumDefaultValue': OuterEnumDefaultValueToJSON(value['outerEnumDefaultValue']), + 'outerEnumIntegerDefaultValue': OuterEnumIntegerDefaultValueToJSON(value['outerEnumIntegerDefaultValue']), }; } 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 e9dd2f055ab6..bf4371a93c1e 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 @@ -64,8 +64,8 @@ export function FakeBigDecimalMap200ResponseToJSON(value?: FakeBigDecimalMap200R } return { - 'someId': value.someId, - 'someMap': value.someMap, + 'someId': value['someId'], + 'someMap': value['someMap'], }; } 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 cb459d89a200..10e7e77f8f87 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 @@ -64,8 +64,8 @@ export function FileSchemaTestClassToJSON(value?: FileSchemaTestClass | null): a } return { - 'file': value.file, - 'files': value.files, + 'file': value['file'], + 'files': value['files'], }; } 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 eb4a11882665..ec179ce581b5 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 @@ -57,7 +57,7 @@ export function FooToJSON(value?: Foo | null): any { } return { - 'bar': value.bar, + '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 4ade37d0c4c5..ffd3e185c760 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 @@ -64,7 +64,7 @@ export function FooGetDefaultResponseToJSON(value?: FooGetDefaultResponse | null } return { - 'string': FooToJSON(value.string), + '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 97b1af1c9d67..b509f3575a2f 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 @@ -173,22 +173,22 @@ export function FormatTestToJSON(value?: FormatTest | null): any { } return { - 'integer': value.integer, - 'int32': value.int32, - 'int64': value.int64, - 'number': value.number, - 'float': value._float, - 'double': value._double, - 'decimal': DecimalToJSON(value.decimal), - 'string': value.string, - 'byte': value._byte, - 'binary': value.binary, - 'date': ((value.date).toISOString().substring(0,10)), - 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), - 'uuid': value.uuid, - 'password': value.password, - 'pattern_with_digits': value.patternWithDigits, - 'pattern_with_digits_and_delimiter': value.patternWithDigitsAndDelimiter, + 'integer': value['integer'], + 'int32': value['int32'], + 'int64': value['int64'], + 'number': value['number'], + 'float': value['_float'], + 'double': value['_double'], + 'decimal': DecimalToJSON(value['decimal']), + 'string': value['string'], + 'byte': value['_byte'], + 'binary': value['binary'], + 'date': ((value['date']).toISOString().substring(0,10)), + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value['dateTime']).toISOString()), + 'uuid': value['uuid'], + 'password': value['password'], + 'pattern_with_digits': value['patternWithDigits'], + 'pattern_with_digits_and_delimiter': value['patternWithDigitsAndDelimiter'], }; } 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 ce90c996a4a8..6d58f178cdcb 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 @@ -57,7 +57,7 @@ export function HealthCheckResultToJSON(value?: HealthCheckResult | null): any { } return { - 'NullableMessage': value.nullableMessage, + '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 61735bf041dd..c4afb61a4de4 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 @@ -57,7 +57,7 @@ export function ListToJSON(value?: List | null): any { } return { - '123-list': value._123list, + '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 fd75eee91460..b36dfda98d88 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 @@ -89,10 +89,10 @@ export function MapTestToJSON(value?: MapTest | null): any { } return { - 'map_map_of_string': value.mapMapOfString, - 'map_of_enum_string': value.mapOfEnumString, - 'direct_map': value.directMap, - 'indirect_map': value.indirectMap, + 'map_map_of_string': value['mapMapOfString'], + 'map_of_enum_string': value['mapOfEnumString'], + 'direct_map': value['directMap'], + 'indirect_map': value['indirectMap'], }; } 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 4097913c88f5..f22b2b72a221 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 @@ -78,9 +78,9 @@ export function MixedPropertiesAndAdditionalPropertiesClassToJSON(value?: MixedP } return { - 'uuid': value.uuid, - 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), - 'map': !exists(value, 'map') ? undefined : (mapValues(value.map, AnimalToJSON)), + 'uuid': value['uuid'], + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value['dateTime']).toISOString()), + 'map': !exists(value, 'map') ? undefined : (mapValues(value['map'], AnimalToJSON)), }; } 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 5a702847aacc..8cabcd2d4b3e 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 @@ -64,8 +64,8 @@ export function Model200ResponseToJSON(value?: Model200Response | null): any { } return { - 'name': value.name, - 'class': value._class, + 'name': value['name'], + 'class': value['_class'], }; } 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 1e94140a1edb..b3685aea30ad 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 09b9e2a02cf2..0611bad737d6 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 @@ -57,7 +57,7 @@ export function ModelFileToJSON(value?: ModelFile | null): any { } return { - 'sourceURI': value.sourceURI, + '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 be9875602c28..4ba736c85a45 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 @@ -79,8 +79,8 @@ export function NameToJSON(value?: Name | null): any { } return { - 'name': value.name, - 'property': value.property, + 'name': value['name'], + 'property': value['property'], }; } 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 4c6ba1adf742..de25ab3382a4 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 @@ -137,18 +137,18 @@ export function NullableClassToJSON(value?: NullableClass | null): any { return { ...value, - 'integer_prop': value.integerProp, - 'number_prop': value.numberProp, - 'boolean_prop': value.booleanProp, - 'string_prop': value.stringProp, - 'date_prop': !exists(value, 'dateProp') ? undefined : ((value.dateProp as any).toISOString().substring(0,10)), - 'datetime_prop': !exists(value, 'datetimeProp') ? undefined : ((value.datetimeProp as any).toISOString()), - 'array_nullable_prop': value.arrayNullableProp, - 'array_and_items_nullable_prop': value.arrayAndItemsNullableProp, - 'array_items_nullable': value.arrayItemsNullable, - 'object_nullable_prop': value.objectNullableProp, - 'object_and_items_nullable_prop': value.objectAndItemsNullableProp, - 'object_items_nullable': value.objectItemsNullable, + 'integer_prop': value['integerProp'], + 'number_prop': value['numberProp'], + 'boolean_prop': value['booleanProp'], + 'string_prop': value['stringProp'], + 'date_prop': !exists(value, 'dateProp') ? undefined : ((value['dateProp'] as any).toISOString().substring(0,10)), + 'datetime_prop': !exists(value, 'datetimeProp') ? undefined : ((value['datetimeProp'] as any).toISOString()), + 'array_nullable_prop': value['arrayNullableProp'], + 'array_and_items_nullable_prop': value['arrayAndItemsNullableProp'], + 'array_items_nullable': value['arrayItemsNullable'], + 'object_nullable_prop': value['objectNullableProp'], + 'object_and_items_nullable_prop': value['objectAndItemsNullableProp'], + 'object_items_nullable': value['objectItemsNullable'], }; } 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 144e5363127c..7a25240d3537 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 @@ -57,7 +57,7 @@ export function NumberOnlyToJSON(value?: NumberOnly | null): any { } return { - 'JustNumber': value.justNumber, + '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 518d87ecfe9e..4a921582669f 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 @@ -88,10 +88,10 @@ export function ObjectWithDeprecatedFieldsToJSON(value?: ObjectWithDeprecatedFie } return { - 'uuid': value.uuid, - 'id': value.id, - 'deprecatedRef': DeprecatedObjectToJSON(value.deprecatedRef), - 'bars': value.bars, + 'uuid': value['uuid'], + 'id': value['id'], + 'deprecatedRef': DeprecatedObjectToJSON(value['deprecatedRef']), + 'bars': value['bars'], }; } 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 815c7531b1f2..6f2b79b5c85b 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 07771ec7202e..14b4e4542fab 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 @@ -71,9 +71,9 @@ export function OuterCompositeToJSON(value?: OuterComposite | null): any { } return { - 'my_number': value.myNumber, - 'my_string': value.myString, - 'my_boolean': value.myBoolean, + 'my_number': value['myNumber'], + 'my_string': value['myString'], + 'my_boolean': value['myBoolean'], }; } 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 4e746368a7d9..1182b747df28 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 @@ -65,7 +65,7 @@ export function OuterObjectWithEnumPropertyToJSON(value?: OuterObjectWithEnumPro } return { - 'value': OuterEnumIntegerToJSON(value.value), + '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 be4fc5448c75..829781419f2c 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 @@ -83,8 +83,8 @@ export function ParentWithNullableToJSON(value?: ParentWithNullable | null): any } return { - 'type': value.type, - 'nullableProperty': value.nullableProperty, + 'type': value['type'], + 'nullableProperty': value['nullableProperty'], }; } 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 4c79710cd38b..e53a44fc33f5 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 @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': Array.from(value.photoUrls as Set), - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': Array.from(value['photoUrls'] as Set), + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 9269c0f7b44e..97c192be7826 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 @@ -64,7 +64,7 @@ export function ReadOnlyFirstToJSON(value?: ReadOnlyFirst | null): any { } return { - 'baz': value.baz, + '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 cd481d2e842d..9d2a3787c26d 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 @@ -57,7 +57,7 @@ export function ReturnToJSON(value?: Return | null): any { } return { - 'return': value._return, + 'return': value['_return'], }; } 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 7b9780125d22..414fcb168909 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 @@ -57,7 +57,7 @@ export function SpecialModelNameToJSON(value?: SpecialModelName | null): any { } return { - '$special[property.name]': value.$specialPropertyName, + '$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 4b8840070b42..446a1d0da769 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 67834a258010..c3c3a41f093f 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 @@ -60,7 +60,7 @@ export function TestInlineFreeformAdditionalPropertiesRequestToJSON(value?: Test return { ...value, - 'someProperty': value.someProperty, + 'someProperty': value['someProperty'], }; } 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 7bdc391dd43c..ed2c73a101e7 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 @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } 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 4ea5eba7fe7d..001bc135bb96 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts @@ -64,8 +64,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 69fee6449c2c..a7fc63d81f1b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 3246795cb314..9e12fc242793 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 f9dda35da96a..8906602f6f4b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': value.photoUrls, - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': value['photoUrls'], + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 3f159accd658..24a25f383dba 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 fcd03bd8bf7f..00ab35b80563 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } 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 f217c10419df..38d190ba0f39 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts @@ -91,10 +91,10 @@ export function EnumPatternObjectToJSON(value?: EnumPatternObject | null): any { } return { - 'string-enum': StringEnumToJSON(value.stringEnum), - 'nullable-string-enum': StringEnumToJSON(value.nullableStringEnum), - 'number-enum': NumberEnumToJSON(value.numberEnum), - 'nullable-number-enum': NumberEnumToJSON(value.nullableNumberEnum), + 'string-enum': StringEnumToJSON(value['stringEnum']), + 'nullable-string-enum': StringEnumToJSON(value['nullableStringEnum']), + 'number-enum': NumberEnumToJSON(value['numberEnum']), + 'nullable-number-enum': NumberEnumToJSON(value['nullableNumberEnum']), }; } 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 e995231c6ab1..3ce94b18453f 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -120,10 +120,10 @@ export function FakeEnumRequestGetInline200ResponseToJSON(value?: FakeEnumReques } return { - 'string-enum': value.stringEnum, - 'nullable-string-enum': value.nullableStringEnum, - 'number-enum': value.numberEnum, - 'nullable-number-enum': value.nullableNumberEnum, + 'string-enum': value['stringEnum'], + 'nullable-string-enum': value['nullableStringEnum'], + 'number-enum': value['numberEnum'], + 'nullable-number-enum': value['nullableNumberEnum'], }; } 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 4ea5eba7fe7d..001bc135bb96 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 @@ -64,8 +64,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 69fee6449c2c..a7fc63d81f1b 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 3246795cb314..9e12fc242793 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 f9dda35da96a..8906602f6f4b 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 @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': value.photoUrls, - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': value['photoUrls'], + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 3f159accd658..24a25f383dba 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 fcd03bd8bf7f..00ab35b80563 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 @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } 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 4ea5eba7fe7d..001bc135bb96 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 @@ -64,8 +64,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 69fee6449c2c..a7fc63d81f1b 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 3246795cb314..9e12fc242793 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 f9dda35da96a..8906602f6f4b 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 @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': value.photoUrls, - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': value['photoUrls'], + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 3f159accd658..24a25f383dba 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 fcd03bd8bf7f..00ab35b80563 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 @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } 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 4ea5eba7fe7d..001bc135bb96 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 @@ -64,8 +64,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 69fee6449c2c..a7fc63d81f1b 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 3246795cb314..9e12fc242793 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 f9dda35da96a..8906602f6f4b 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 @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': value.photoUrls, - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': value['photoUrls'], + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 3f159accd658..24a25f383dba 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 fcd03bd8bf7f..00ab35b80563 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 @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApiSagas.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApiSagas.ts index cb6c3371f0a4..0c98a78f6338 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApiSagas.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/BehaviorApiSagas.ts @@ -69,7 +69,7 @@ export function *getBehaviorPermissionsSagaImp(_action_: Action = yield apiCall(Api.behaviorApi, Api.behaviorApi.getBehaviorPermissions, + const response: Required = yield apiCall(Api.behaviorApi, Api.behaviorApi['getBehaviorPermissions'], parseFloat(behaviorId), ); @@ -113,7 +113,7 @@ export function *getBehaviorTypeSagaImp(_action_: Action yield put(getBehaviorTypeRequest(_action_.payload)); - const response: Required = yield apiCall(Api.behaviorApi, Api.behaviorApi.getBehaviorType, + const response: Required = yield apiCall(Api.behaviorApi, Api.behaviorApi['getBehaviorType'], parseFloat(behaviorId), ); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts index da8af274744e..841f613f3910 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts @@ -95,7 +95,7 @@ export function *addPetSagaImp(_action_: Action) { yield put(addPetRequest(_action_.payload)); - const response = yield apiCall(Api.petApi, Api.petApi.addPet, + const response = yield apiCall(Api.petApi, Api.petApi['addPet'], categoryRecordUtils.toApi(dummyCat), ); @@ -139,7 +139,7 @@ export function *deletePetSagaImp(_action_: Action) { yield put(deletePetRequest(_action_.payload)); - const response = yield apiCall(Api.petApi, Api.petApi.deletePet, + const response = yield apiCall(Api.petApi, Api.petApi['deletePet'], parseFloat(petId), apiKey, ); @@ -184,7 +184,7 @@ export function *findPetsByIdsSagaImp(_action_: Action) { yield put(findPetsByIdsRequest(requestPayload)); - const response: Required> = yield apiCall(Api.petApi, Api.petApi.findPetsByIds, + const response: Required> = yield apiCall(Api.petApi, Api.petApi['findPetsByIds'], ids.map(p => (p ? parseFloat(p) : null) as number ).toArray(), ); @@ -237,7 +237,7 @@ export function *findPetsByStatusSagaImp(_action_: Action = yield apiCall(Api.petApi, Api.petApi.findPetsByStatus, + const response: Required = yield apiCall(Api.petApi, Api.petApi['findPetsByStatus'], status.toJS(), ); @@ -290,7 +290,7 @@ export function *findPetsByTagsSagaImp(_action_: Action) yield put(findPetsByTagsRequest(requestPayload)); - const response: Required> = yield apiCall(Api.petApi, Api.petApi.findPetsByTags, + const response: Required> = yield apiCall(Api.petApi, Api.petApi['findPetsByTags'], tags.toJS(), ); @@ -343,7 +343,7 @@ export function *findPetsByUserIdsSagaImp(_action_: Action = yield apiCall(Api.petApi, Api.petApi.findPetsByUserIds, + const response: Required = yield apiCall(Api.petApi, Api.petApi['findPetsByUserIds'], ids.map(p => (p ? parseFloat(p) : null) as number ).toArray(), ); @@ -396,7 +396,7 @@ export function *getPetByIdSagaImp(_action_: Action) { yield put(getPetByIdRequest(requestPayload)); - const response: Required = yield apiCall(Api.petApi, Api.petApi.getPetById, + const response: Required = yield apiCall(Api.petApi, Api.petApi['getPetById'], parseFloat(petId), ); @@ -447,7 +447,7 @@ export function *getPetRegionsSagaImp(_action_: Action) { yield put(getPetRegionsRequest(_action_.payload)); - const response: Required = yield apiCall(Api.petApi, Api.petApi.getPetRegions, + const response: Required = yield apiCall(Api.petApi, Api.petApi['getPetRegions'], parseFloat(petId), ); @@ -491,7 +491,7 @@ export function *updatePetSagaImp(_action_: Action) { yield put(updatePetRequest(_action_.payload)); - const response = yield apiCall(Api.petApi, Api.petApi.updatePet, + const response = yield apiCall(Api.petApi, Api.petApi['updatePet'], petRecordUtils.toApi(body), ); @@ -535,7 +535,7 @@ export function *updatePetRegionsSagaImp(_action_: Action = yield apiCall(Api.petApi, Api.petApi.updatePetRegions, + const response: Required = yield apiCall(Api.petApi, Api.petApi['updatePetRegions'], parseFloat(petId), newRegions.map(p => p.toArray().map(p2 => (p2 ? parseFloat(p2) : null) as number)).toArray(), ); @@ -584,7 +584,7 @@ export function *updatePetWithFormSagaImp(_action_: Action) { yield put(uploadFileRequest(requestPayload)); - const response: Required = yield apiCall(Api.petApi, Api.petApi.uploadFile, + const response: Required = yield apiCall(Api.petApi, Api.petApi['uploadFile'], parseFloat(petId), additionalMetadata, file, diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApiSagas.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApiSagas.ts index 2975642fc138..41189b279198 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApiSagas.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetPartApiSagas.ts @@ -70,7 +70,7 @@ export function *getFakePetPartTypeSagaImp(_action_: Action = yield apiCall(Api.petPartApi, Api.petPartApi.getFakePetPartType, + const response: Required = yield apiCall(Api.petPartApi, Api.petPartApi['getFakePetPartType'], parseFloat(fakePetPartId), ); @@ -126,7 +126,7 @@ export function *getMatchingPartsSagaImp(_action_: Action = yield apiCall(Api.petPartApi, Api.petPartApi.getMatchingParts, + const response: Required = yield apiCall(Api.petPartApi, Api.petPartApi['getMatchingParts'], parseFloat(fakePetPartId), _long, smooth, diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApiSagas.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApiSagas.ts index bb97efa62433..ea92ff2f2163 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApiSagas.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/StoreApiSagas.ts @@ -67,7 +67,7 @@ export function *deleteOrderSagaImp(_action_: Action) { yield put(deleteOrderRequest(_action_.payload)); - const response = yield apiCall(Api.storeApi, Api.storeApi.deleteOrder, + const response = yield apiCall(Api.storeApi, Api.storeApi['deleteOrder'], orderId, ); @@ -103,7 +103,7 @@ export function *getInventorySagaImp(_action_: Action) { yield put(getInventoryRequest()); - const response: Required<{ [key: string]: number; }> = yield apiCall(Api.storeApi, Api.storeApi.getInventory, + const response: Required<{ [key: string]: number; }> = yield apiCall(Api.storeApi, Api.storeApi['getInventory'], ); let successReturnValue: any = undefined; @@ -147,7 +147,7 @@ export function *getOrderByIdSagaImp(_action_: Action) { yield put(getOrderByIdRequest(requestPayload)); - const response: Required = yield apiCall(Api.storeApi, Api.storeApi.getOrderById, + const response: Required = yield apiCall(Api.storeApi, Api.storeApi['getOrderById'], parseFloat(orderId), ); @@ -200,7 +200,7 @@ export function *placeOrderSagaImp(_action_: Action) { yield put(placeOrderRequest(requestPayload)); - const response: Required = yield apiCall(Api.storeApi, Api.storeApi.placeOrder, + const response: Required = yield apiCall(Api.storeApi, Api.storeApi['placeOrder'], orderRecordUtils.toApi(body), ); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApiSagas.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApiSagas.ts index ffad5d36d9ef..ddef1ef77b04 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApiSagas.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApiSagas.ts @@ -74,7 +74,7 @@ export function *createUserSagaImp(_action_: Action) { yield put(createUserRequest(_action_.payload)); - const response = yield apiCall(Api.userApi, Api.userApi.createUser, + const response = yield apiCall(Api.userApi, Api.userApi['createUser'], userRecordUtils.toApi(body), ); @@ -116,7 +116,7 @@ export function *createUsersWithArrayInputSagaImp(_action_: Action) { yield put(deleteUserRequest(_action_.payload)); - const response = yield apiCall(Api.userApi, Api.userApi.deleteUser, + const response = yield apiCall(Api.userApi, Api.userApi['deleteUser'], username, ); @@ -244,7 +244,7 @@ export function *getUserByNameSagaImp(_action_: Action) { yield put(getUserByNameRequest(requestPayload)); - const response: Required = yield apiCall(Api.userApi, Api.userApi.getUserByName, + const response: Required = yield apiCall(Api.userApi, Api.userApi['getUserByName'], username, ); @@ -297,7 +297,7 @@ export function *loginUserSagaImp(_action_: Action) { yield put(loginUserRequest(_action_.payload)); - const response: Required = yield apiCall(Api.userApi, Api.userApi.loginUser, + const response: Required = yield apiCall(Api.userApi, Api.userApi['loginUser'], username, password, ); @@ -335,7 +335,7 @@ export function *logoutUserSagaImp(_action_: Action) { yield put(logoutUserRequest()); - const response = yield apiCall(Api.userApi, Api.userApi.logoutUser, + const response = yield apiCall(Api.userApi, Api.userApi['logoutUser'], ); yield put(logoutUserSuccess()); @@ -378,7 +378,7 @@ export function *updateUserSagaImp(_action_: Action) { yield put(updateUserRequest(_action_.payload)); - const response: Required = yield apiCall(Api.userApi, Api.userApi.updateUser, + const response: Required = yield apiCall(Api.userApi, Api.userApi['updateUser'], username, userRecordUtils.toApi(body), ); 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 4ea5eba7fe7d..001bc135bb96 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 @@ -64,8 +64,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts index 905a06373264..2bb757b734aa 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts @@ -50,7 +50,7 @@ knownRecordFactories.set(CategoryRecordEntityProps.recType, CategoryRecordEntity class CategoryRecordUtils extends ApiRecordUtils { public normalize(apiObject: Category, asEntity?: boolean): Category { (apiObject as any).recType = asEntity ? CategoryRecordEntityProps.recType : CategoryRecordProps.recType; - if (apiObject.id) { (apiObject as any).id = apiObject.id.toString(); } + if (apiObject['id']) { (apiObject as any)['id'] = apiObject['id'].toString(); } return apiObject; } @@ -94,7 +94,7 @@ class CategoryRecordUtils extends ApiRecordUtils { public toApi(record: CategoryRecord): Category { const apiObject = super.toApi(record); - if (record.id) { apiObject.id = parseFloat(record.id); } + if (record['id']) { apiObject['id'] = parseFloat(record['id']); } return apiObject; } } 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 0fda53e16f64..93b4baacc1a0 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 @@ -65,7 +65,7 @@ export function DefaultMetaOnlyResponseToJSON(value?: DefaultMetaOnlyResponse | } return { - 'meta': ResponseMetaToJSON(value.meta), + 'meta': ResponseMetaToJSON(value['meta']), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponseRecord.ts index b59a715e84c9..73ce3a84c712 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponseRecord.ts @@ -46,13 +46,13 @@ knownRecordFactories.set(DefaultMetaOnlyResponseRecordProps.recType, DefaultMeta class DefaultMetaOnlyResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: DefaultMetaOnlyResponse, asEntity?: boolean): DefaultMetaOnlyResponse { (apiObject as any).recType = DefaultMetaOnlyResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); + responseMetaRecordUtils.normalize(apiObject['meta']); return apiObject; } public toApi(record: DefaultMetaOnlyResponseRecord): DefaultMetaOnlyResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); return apiObject; } } 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 7d02ae9622e9..2ee087651466 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 @@ -78,8 +78,8 @@ export function FindPetsByStatusResponseToJSON(value?: FindPetsByStatusResponse } return { - 'meta': ResponseMetaToJSON(value.meta), - 'data': !exists(value, 'data') ? undefined : ((value.data as Array).map(PetToJSON)), + 'meta': ResponseMetaToJSON(value['meta']), + 'data': !exists(value, 'data') ? undefined : ((value['data'] as Array).map(PetToJSON)), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponseRecord.ts index 3ac38102f828..f22a5c3f59cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponseRecord.ts @@ -54,15 +54,15 @@ knownRecordFactories.set(FindPetsByStatusResponseRecordProps.recType, FindPetsBy class FindPetsByStatusResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: FindPetsByStatusResponse, asEntity?: boolean): FindPetsByStatusResponse { (apiObject as any).recType = FindPetsByStatusResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); - if (apiObject.data) { petRecordUtils.normalizeArray(apiObject.data); } + responseMetaRecordUtils.normalize(apiObject['meta']); + if (apiObject['data']) { petRecordUtils.normalizeArray(apiObject['data']); } return apiObject; } public toApi(record: FindPetsByStatusResponseRecord): FindPetsByStatusResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); - if (record.data) { apiObject.data = petRecordUtils.toApiArray(record.data); } + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); + if (record['data']) { apiObject['data'] = petRecordUtils.toApiArray(record['data']); } return apiObject; } 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 29886e8f221c..49f4d6f17560 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 @@ -78,8 +78,8 @@ export function FindPetsByUserResponseToJSON(value?: FindPetsByUserResponse | nu } return { - 'meta': ResponseMetaToJSON(value.meta), - 'data': !exists(value, 'data') ? undefined : ((value.data as Array).map(UserToJSON)), + 'meta': ResponseMetaToJSON(value['meta']), + 'data': !exists(value, 'data') ? undefined : ((value['data'] as Array).map(UserToJSON)), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponseRecord.ts index b1cddadbf548..0af0862472d9 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponseRecord.ts @@ -54,15 +54,15 @@ knownRecordFactories.set(FindPetsByUserResponseRecordProps.recType, FindPetsByUs class FindPetsByUserResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: FindPetsByUserResponse, asEntity?: boolean): FindPetsByUserResponse { (apiObject as any).recType = FindPetsByUserResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); - if (apiObject.data) { userRecordUtils.normalizeArray(apiObject.data); } + responseMetaRecordUtils.normalize(apiObject['meta']); + if (apiObject['data']) { userRecordUtils.normalizeArray(apiObject['data']); } return apiObject; } public toApi(record: FindPetsByUserResponseRecord): FindPetsByUserResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); - if (record.data) { apiObject.data = userRecordUtils.toApiArray(record.data); } + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); + if (record['data']) { apiObject['data'] = userRecordUtils.toApiArray(record['data']); } return apiObject; } 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 e9e059de4907..10e2de71adc1 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 @@ -72,8 +72,8 @@ export function GetBehaviorPermissionsResponseToJSON(value?: GetBehaviorPermissi } return { - 'meta': ResponseMetaToJSON(value.meta), - 'data': value.data, + 'meta': ResponseMetaToJSON(value['meta']), + 'data': value['data'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponseRecord.ts index eb7f7fdd70f0..1769f9ba5b39 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponseRecord.ts @@ -47,13 +47,13 @@ knownRecordFactories.set(GetBehaviorPermissionsResponseRecordProps.recType, GetB class GetBehaviorPermissionsResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: GetBehaviorPermissionsResponse, asEntity?: boolean): GetBehaviorPermissionsResponse { (apiObject as any).recType = GetBehaviorPermissionsResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); + responseMetaRecordUtils.normalize(apiObject['meta']); return apiObject; } public toApi(record: GetBehaviorPermissionsResponseRecord): GetBehaviorPermissionsResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); return apiObject; } 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 1651f1470a97..d280962cf133 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 @@ -78,8 +78,8 @@ export function GetBehaviorTypeResponseToJSON(value?: GetBehaviorTypeResponse | } return { - 'meta': ResponseMetaToJSON(value.meta), - 'data': BehaviorTypeToJSON(value.data), + 'meta': ResponseMetaToJSON(value['meta']), + 'data': BehaviorTypeToJSON(value['data']), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponseRecord.ts index 7113f4a6aa24..55990ad5dcb0 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponseRecord.ts @@ -50,13 +50,13 @@ knownRecordFactories.set(GetBehaviorTypeResponseRecordProps.recType, GetBehavior class GetBehaviorTypeResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: GetBehaviorTypeResponse, asEntity?: boolean): GetBehaviorTypeResponse { (apiObject as any).recType = GetBehaviorTypeResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); + responseMetaRecordUtils.normalize(apiObject['meta']); return apiObject; } public toApi(record: GetBehaviorTypeResponseRecord): GetBehaviorTypeResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); return apiObject; } 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 b9b657b8920a..853ac803fd01 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 @@ -78,8 +78,8 @@ export function GetMatchingPartsResponseToJSON(value?: GetMatchingPartsResponse } return { - 'meta': ResponseMetaToJSON(value.meta), - 'data': MatchingPartsToJSON(value.data), + 'meta': ResponseMetaToJSON(value['meta']), + 'data': MatchingPartsToJSON(value['data']), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponseRecord.ts index 6b73951b1dfa..23663535b8cc 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponseRecord.ts @@ -54,15 +54,15 @@ knownRecordFactories.set(GetMatchingPartsResponseRecordProps.recType, GetMatchin class GetMatchingPartsResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: GetMatchingPartsResponse, asEntity?: boolean): GetMatchingPartsResponse { (apiObject as any).recType = GetMatchingPartsResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); - if (apiObject.data) { matchingPartsRecordUtils.normalize(apiObject.data); } + responseMetaRecordUtils.normalize(apiObject['meta']); + if (apiObject['data']) { matchingPartsRecordUtils.normalize(apiObject['data']); } return apiObject; } public toApi(record: GetMatchingPartsResponseRecord): GetMatchingPartsResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); - if (record.data) { apiObject.data = matchingPartsRecordUtils.toApi(record.data); } + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); + if (record['data']) { apiObject['data'] = matchingPartsRecordUtils.toApi(record['data']); } return apiObject; } 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 0ad8b63bc5a0..b39830b4601e 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 @@ -78,8 +78,8 @@ export function GetPetPartTypeResponseToJSON(value?: GetPetPartTypeResponse | nu } return { - 'meta': ResponseMetaToJSON(value.meta), - 'data': PetPartTypeToJSON(value.data), + 'meta': ResponseMetaToJSON(value['meta']), + 'data': PetPartTypeToJSON(value['data']), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponseRecord.ts index 69caf5d05462..57d64200571a 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponseRecord.ts @@ -50,13 +50,13 @@ knownRecordFactories.set(GetPetPartTypeResponseRecordProps.recType, GetPetPartTy class GetPetPartTypeResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: GetPetPartTypeResponse, asEntity?: boolean): GetPetPartTypeResponse { (apiObject as any).recType = GetPetPartTypeResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); + responseMetaRecordUtils.normalize(apiObject['meta']); return apiObject; } public toApi(record: GetPetPartTypeResponseRecord): GetPetPartTypeResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); return apiObject; } 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 b65e06f51385..69621e5eb7d7 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 @@ -66,8 +66,8 @@ export function ItemIdToJSON(value?: ItemId | null): any { } return { - 'id': value.id, - 'type': value.type, + 'id': value['id'], + 'type': value['type'], }; } 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 31abfffb9f05..125d78169bef 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 @@ -73,8 +73,8 @@ export function MatchingPartsToJSON(value?: MatchingParts | null): any { } return { - 'connected': ((value.connected as Array).map(PartToJSON)), - 'related': ((value.related as Array).map(PartToJSON)), + 'connected': ((value['connected'] as Array).map(PartToJSON)), + 'related': ((value['related'] as Array).map(PartToJSON)), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingPartsRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingPartsRecord.ts index edc7d033ebd1..4170d2f84e9e 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingPartsRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingPartsRecord.ts @@ -47,15 +47,15 @@ knownRecordFactories.set(MatchingPartsRecordProps.recType, MatchingPartsRecord); class MatchingPartsRecordUtils extends ApiRecordUtils { public normalize(apiObject: MatchingParts, asEntity?: boolean): MatchingParts { (apiObject as any).recType = MatchingPartsRecordProps.recType; - partRecordUtils.normalizeArray(apiObject.connected); - partRecordUtils.normalizeArray(apiObject.related); + partRecordUtils.normalizeArray(apiObject['connected']); + partRecordUtils.normalizeArray(apiObject['related']); return apiObject; } public toApi(record: MatchingPartsRecord): MatchingParts { const apiObject = super.toApi(record); - apiObject.connected = partRecordUtils.toApiArray(record.connected); - apiObject.related = partRecordUtils.toApiArray(record.related); + apiObject['connected'] = partRecordUtils.toApiArray(record['connected']); + apiObject['related'] = partRecordUtils.toApiArray(record['related']); return apiObject; } } 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 69fee6449c2c..a7fc63d81f1b 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 bf43c05a4481..166306af9663 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 @@ -86,10 +86,10 @@ export function ModelErrorToJSON(value?: ModelError | null): any { } return { - 'type': value.type, - 'itemInfo': ItemIdToJSON(value.itemInfo), - 'details': value.details, - 'exception': value.exception, + 'type': value['type'], + 'itemInfo': ItemIdToJSON(value['itemInfo']), + 'details': value['details'], + 'exception': value['exception'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelErrorRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelErrorRecord.ts index 29f964f5f14b..1abeef522e2a 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelErrorRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelErrorRecord.ts @@ -49,13 +49,13 @@ knownRecordFactories.set(ModelErrorRecordProps.recType, ModelErrorRecord); class ModelErrorRecordUtils extends ApiRecordUtils { public normalize(apiObject: ModelError, asEntity?: boolean): ModelError { (apiObject as any).recType = ModelErrorRecordProps.recType; - if (apiObject.itemInfo) { itemIdRecordUtils.normalize(apiObject.itemInfo); } + if (apiObject['itemInfo']) { itemIdRecordUtils.normalize(apiObject['itemInfo']); } return apiObject; } public toApi(record: ModelErrorRecord): ModelError { const apiObject = super.toApi(record); - if (record.itemInfo) { apiObject.itemInfo = itemIdRecordUtils.toApi(record.itemInfo); } + if (record['itemInfo']) { apiObject['itemInfo'] = itemIdRecordUtils.toApi(record['itemInfo']); } return apiObject; } } 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 3246795cb314..9e12fc242793 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts index 0d4f6e0b4429..a0ddf05e1ed8 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts @@ -55,7 +55,7 @@ knownRecordFactories.set(OrderRecordEntityProps.recType, OrderRecordEntity); class OrderRecordUtils extends ApiRecordUtils { public normalize(apiObject: Order, asEntity?: boolean): Order { (apiObject as any).recType = asEntity ? OrderRecordEntityProps.recType : OrderRecordProps.recType; - if (apiObject.id) { (apiObject as any).id = apiObject.id.toString(); } + if (apiObject['id']) { (apiObject as any)['id'] = apiObject['id'].toString(); } return apiObject; } @@ -99,7 +99,7 @@ class OrderRecordUtils extends ApiRecordUtils { public toApi(record: OrderRecord): Order { const apiObject = super.toApi(record); - if (record.id) { apiObject.id = parseFloat(record.id); } + if (record['id']) { apiObject['id'] = parseFloat(record['id']); } return apiObject; } } 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 13136484da99..15f467e89f82 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 @@ -66,8 +66,8 @@ export function PartToJSON(value?: Part | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PartRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PartRecord.ts index 0bbd36a831a9..539b8094c7a7 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PartRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PartRecord.ts @@ -40,13 +40,13 @@ knownRecordFactories.set(PartRecordProps.recType, PartRecord); class PartRecordUtils extends ApiRecordUtils { public normalize(apiObject: Part, asEntity?: boolean): Part { (apiObject as any).recType = PartRecordProps.recType; - (apiObject as any).id = apiObject.id.toString(); + (apiObject as any)['id'] = apiObject['id'].toString(); return apiObject; } public toApi(record: PartRecord): Part { const apiObject = super.toApi(record); - apiObject.id = parseFloat(record.id); + apiObject['id'] = parseFloat(record['id']); return apiObject; } } 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 c2e61543b485..c24da6bcb476 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 @@ -248,27 +248,27 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'friendId': value.friendId, - 'otherFriendIds': value.otherFriendIds, - 'friendAge': value.friendAge, - 'age': value.age, - 'isHappy': value.isHappy, - 'isTall': value.isTall, - 'category': CategoryToJSON(value.category), - 'optionalCategory': CategoryToJSON(value.optionalCategory), - 'name': value.name, - 'entries': !exists(value, '_entries') ? undefined : ((value._entries as Array).map(CategoryToJSON)), - 'surname': value.surname, - 'photoUrls': value.photoUrls, - 'warningStatus': WarningCodeToJSON(value.warningStatus), - 'depStatus': DeploymentRequestStatusToJSON(value.depStatus), - 'alternateStatus': DeploymentRequestStatusToJSON(value.alternateStatus), - 'otherDepStatuses': ((value.otherDepStatuses as Array).map(DeploymentRequestStatusToJSON)), - 'tags': ((value.tags as Array).map(TagToJSON)), - 'optionalTags': !exists(value, 'optionalTags') ? undefined : ((value.optionalTags as Array).map(TagToJSON)), - 'status': value.status, - 'regions': value.regions, + 'id': value['id'], + 'friendId': value['friendId'], + 'otherFriendIds': value['otherFriendIds'], + 'friendAge': value['friendAge'], + 'age': value['age'], + 'isHappy': value['isHappy'], + 'isTall': value['isTall'], + 'category': CategoryToJSON(value['category']), + 'optionalCategory': CategoryToJSON(value['optionalCategory']), + 'name': value['name'], + 'entries': !exists(value, '_entries') ? undefined : ((value['_entries'] as Array).map(CategoryToJSON)), + 'surname': value['surname'], + 'photoUrls': value['photoUrls'], + 'warningStatus': WarningCodeToJSON(value['warningStatus']), + 'depStatus': DeploymentRequestStatusToJSON(value['depStatus']), + 'alternateStatus': DeploymentRequestStatusToJSON(value['alternateStatus']), + 'otherDepStatuses': ((value['otherDepStatuses'] as Array).map(DeploymentRequestStatusToJSON)), + 'tags': ((value['tags'] as Array).map(TagToJSON)), + 'optionalTags': !exists(value, 'optionalTags') ? undefined : ((value['optionalTags'] as Array).map(TagToJSON)), + 'status': value['status'], + 'regions': value['regions'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts index 5f5348e24546..9c114b14d0f4 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts @@ -95,15 +95,15 @@ knownRecordFactories.set(PetRecordEntityProps.recType, PetRecordEntity); class PetRecordUtils extends ApiRecordUtils { public normalize(apiObject: Pet, asEntity?: boolean): Pet { (apiObject as any).recType = asEntity ? PetRecordEntityProps.recType : PetRecordProps.recType; - (apiObject as any).id = apiObject.id.toString(); - if (apiObject.friendId) { (apiObject as any).friendId = apiObject.friendId.toString(); } - (apiObject as any).otherFriendIds = apiObject.otherFriendIds.map(item => item?.toString()); - categoryRecordUtils.normalize(apiObject.category); - if (apiObject.optionalCategory) { categoryRecordUtils.normalize(apiObject.optionalCategory); } - if (apiObject._entries) { categoryRecordUtils.normalizeArray(apiObject._entries); } - tagRecordUtils.normalizeArray(apiObject.tags); - if (apiObject.optionalTags) { tagRecordUtils.normalizeArray(apiObject.optionalTags); } - if (apiObject.regions) { (apiObject as any).regions = apiObject.regions.map(item => item.map(item2 => item2?.toString())); } + (apiObject as any)['id'] = apiObject['id'].toString(); + if (apiObject['friendId']) { (apiObject as any)['friendId'] = apiObject['friendId'].toString(); } + (apiObject as any)['otherFriendIds'] = apiObject['otherFriendIds'].map(item => item?.toString()); + categoryRecordUtils.normalize(apiObject['category']); + if (apiObject['optionalCategory']) { categoryRecordUtils.normalize(apiObject['optionalCategory']); } + if (apiObject['_entries']) { categoryRecordUtils.normalizeArray(apiObject['_entries']); } + tagRecordUtils.normalizeArray(apiObject['tags']); + if (apiObject['optionalTags']) { tagRecordUtils.normalizeArray(apiObject['optionalTags']); } + if (apiObject['regions']) { (apiObject as any)['regions'] = apiObject['regions'].map(item => item.map(item2 => item2?.toString())); } return apiObject; } @@ -135,15 +135,15 @@ class PetRecordUtils extends ApiRecordUtils { const entityProperties = { // @ts-ignore - category: yield call(categoryRecordUtils.toInlined, entity.category), + category: yield call(categoryRecordUtils.toInlined, entity['category']), // @ts-ignore - optionalCategory: entity.optionalCategory ? yield call(categoryRecordUtils.toInlined, entity.optionalCategory) : null, + optionalCategory: entity['optionalCategory'] ? yield call(categoryRecordUtils.toInlined, entity['optionalCategory']) : null, // @ts-ignore - _entries: entity._entries ? yield call(categoryRecordUtils.toInlinedArray, entity._entries) : null, + _entries: entity['_entries'] ? yield call(categoryRecordUtils.toInlinedArray, entity['_entries']) : null, // @ts-ignore - tags: yield call(tagRecordUtils.toInlinedArray, entity.tags), + tags: yield call(tagRecordUtils.toInlinedArray, entity['tags']), // @ts-ignore - optionalTags: entity.optionalTags ? yield call(tagRecordUtils.toInlinedArray, entity.optionalTags) : null, + optionalTags: entity['optionalTags'] ? yield call(tagRecordUtils.toInlinedArray, entity['optionalTags']) : null, } return PetRecord({ @@ -167,15 +167,15 @@ class PetRecordUtils extends ApiRecordUtils { public toApi(record: PetRecord): Pet { const apiObject = super.toApi(record); - apiObject.id = parseFloat(record.id); - if (record.friendId) { apiObject.friendId = parseFloat(record.friendId); } - apiObject.otherFriendIds = record.otherFriendIds.map(item => (item ? parseFloat(item) : null) as number).toArray(); - apiObject.category = categoryRecordUtils.toApi(record.category); - if (record.optionalCategory) { apiObject.optionalCategory = categoryRecordUtils.toApi(record.optionalCategory); } - if (record._entries) { apiObject._entries = categoryRecordUtils.toApiArray(record._entries); } - apiObject.tags = tagRecordUtils.toApiArray(record.tags); - if (record.optionalTags) { apiObject.optionalTags = tagRecordUtils.toApiArray(record.optionalTags); } - if (record.regions) { apiObject.regions = record.regions.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); } + apiObject['id'] = parseFloat(record['id']); + if (record['friendId']) { apiObject['friendId'] = parseFloat(record['friendId']); } + apiObject['otherFriendIds'] = record['otherFriendIds'].map(item => (item ? parseFloat(item) : null) as number).toArray(); + apiObject['category'] = categoryRecordUtils.toApi(record['category']); + if (record['optionalCategory']) { apiObject['optionalCategory'] = categoryRecordUtils.toApi(record['optionalCategory']); } + if (record['_entries']) { apiObject['_entries'] = categoryRecordUtils.toApiArray(record['_entries']); } + apiObject['tags'] = tagRecordUtils.toApiArray(record['tags']); + if (record['optionalTags']) { apiObject['optionalTags'] = tagRecordUtils.toApiArray(record['optionalTags']); } + if (record['regions']) { apiObject['regions'] = record['regions'].map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); } return apiObject; } } 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 a3a3020f239b..cccb23bc1c54 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 @@ -72,8 +72,8 @@ export function PetRegionsResponseToJSON(value?: PetRegionsResponse | null): any } return { - 'meta': ResponseMetaToJSON(value.meta), - 'data': value.data, + 'meta': ResponseMetaToJSON(value['meta']), + 'data': value['data'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts index a56180207a55..df2bcc6d3cb2 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts @@ -47,15 +47,15 @@ knownRecordFactories.set(PetRegionsResponseRecordProps.recType, PetRegionsRespon class PetRegionsResponseRecordUtils extends ApiRecordUtils { public normalize(apiObject: PetRegionsResponse, asEntity?: boolean): PetRegionsResponse { (apiObject as any).recType = PetRegionsResponseRecordProps.recType; - responseMetaRecordUtils.normalize(apiObject.meta); - if (apiObject.data) { (apiObject as any).data = apiObject.data.map(item => item.map(item2 => item2?.toString())); } + responseMetaRecordUtils.normalize(apiObject['meta']); + if (apiObject['data']) { (apiObject as any)['data'] = apiObject['data'].map(item => item.map(item2 => item2?.toString())); } return apiObject; } public toApi(record: PetRegionsResponseRecord): PetRegionsResponse { const apiObject = super.toApi(record); - apiObject.meta = responseMetaRecordUtils.toApi(record.meta); - if (record.data) { apiObject.data = record.data.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); } + apiObject['meta'] = responseMetaRecordUtils.toApi(record['meta']); + if (record['data']) { apiObject['data'] = record['data'].map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); } return apiObject; } 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 940ea556e36b..b0049adc685f 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 @@ -132,12 +132,12 @@ export function ResponseMetaToJSON(value?: ResponseMeta | null): any { } return { - 'code': value.code, - 'detail': value.detail, - 'exception': value.exception, - 'type': value.type, - 'errorCode': ErrorCodeToJSON(value.errorCode), - 'errors': value.errors, + 'code': value['code'], + 'detail': value['detail'], + 'exception': value['exception'], + 'type': value['type'], + 'errorCode': ErrorCodeToJSON(value['errorCode']), + 'errors': value['errors'], }; } 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 3f159accd658..24a25f383dba 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts index 40e790f3c578..64f36c334a24 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts @@ -50,7 +50,7 @@ knownRecordFactories.set(TagRecordEntityProps.recType, TagRecordEntity); class TagRecordUtils extends ApiRecordUtils { public normalize(apiObject: Tag, asEntity?: boolean): Tag { (apiObject as any).recType = asEntity ? TagRecordEntityProps.recType : TagRecordProps.recType; - if (apiObject.id) { (apiObject as any).id = apiObject.id.toString(); } + if (apiObject['id']) { (apiObject as any)['id'] = apiObject['id'].toString(); } return apiObject; } @@ -94,7 +94,7 @@ class TagRecordUtils extends ApiRecordUtils { public toApi(record: TagRecord): Tag { const apiObject = super.toApi(record); - if (record.id) { apiObject.id = parseFloat(record.id); } + if (record['id']) { apiObject['id'] = parseFloat(record['id']); } return apiObject; } } 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 068c78b35e84..9f4c7d4d4c17 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 @@ -122,16 +122,16 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, - 'subUser': UserToJSON(value.subUser), - 'subUser2': UserToJSON(value.subUser2), + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], + 'subUser': UserToJSON(value['subUser']), + 'subUser2': UserToJSON(value['subUser2']), }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts index 59d9cba4b3ec..399720f55ea7 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts @@ -58,7 +58,7 @@ knownRecordFactories.set(UserRecordEntityProps.recType, UserRecordEntity); class UserRecordUtils extends ApiRecordUtils { public normalize(apiObject: User, asEntity?: boolean): User { (apiObject as any).recType = asEntity ? UserRecordEntityProps.recType : UserRecordProps.recType; - (apiObject as any).id = apiObject.id.toString(); + (apiObject as any)['id'] = apiObject['id'].toString(); return apiObject; } @@ -102,7 +102,7 @@ class UserRecordUtils extends ApiRecordUtils { public toApi(record: UserRecord): User { const apiObject = super.toApi(record); - apiObject.id = parseFloat(record.id); + apiObject['id'] = parseFloat(record['id']); return apiObject; } } 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 bbd3320b0da2..429a86538cd1 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 @@ -64,8 +64,8 @@ export function AdditionalPropertiesClassToJSON(value?: AdditionalPropertiesClas } return { - 'map_property': value.mapProperty, - 'map_of_map_property': value.mapOfMapProperty, + 'map_property': value['mapProperty'], + 'map_of_map_property': value['mapOfMapProperty'], }; } 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 5141e93860bd..5fc70179d079 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 @@ -71,8 +71,8 @@ export function AllOfWithSingleRefToJSON(value?: AllOfWithSingleRef | null): any } return { - 'username': value.username, - 'SingleRefType': SingleRefTypeToJSON(value.singleRefType), + 'username': value['username'], + 'SingleRefType': SingleRefTypeToJSON(value['singleRefType']), }; } 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 3280f1674d55..30313f92a07b 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 @@ -78,8 +78,8 @@ export function AnimalToJSON(value?: Animal | null): any { } return { - 'class_name': value.className, - 'color': value.color, + 'class_name': value['className'], + 'color': value['color'], }; } 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 6a78fd045016..6aca52358716 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 @@ -57,7 +57,7 @@ export function ArrayOfArrayOfNumberOnlyToJSON(value?: ArrayOfArrayOfNumberOnly } return { - 'ArrayArrayNumber': value.arrayArrayNumber, + '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 a0387227bb7e..b39a628ed121 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 @@ -57,7 +57,7 @@ export function ArrayOfNumberOnlyToJSON(value?: ArrayOfNumberOnly | null): any { } return { - 'ArrayNumber': value.arrayNumber, + '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 1ce94b762fcb..2396708971fa 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 @@ -78,9 +78,9 @@ export function ArrayTestToJSON(value?: ArrayTest | null): any { } return { - 'array_of_string': value.arrayOfString, - 'array_array_of_integer': value.arrayArrayOfInteger, - 'array_array_of_model': value.arrayArrayOfModel, + 'array_of_string': value['arrayOfString'], + 'array_array_of_integer': value['arrayArrayOfInteger'], + 'array_array_of_model': value['arrayArrayOfModel'], }; } 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 0b29fa564ea5..30a6a48dfde4 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 @@ -93,12 +93,12 @@ export function CapitalizationToJSON(value?: Capitalization | null): any { } return { - 'smallCamel': value.smallCamel, - 'CapitalCamel': value.capitalCamel, - 'small_Snake': value.smallSnake, - 'Capital_Snake': value.capitalSnake, - 'SCA_ETH_Flow_Points': value.sCAETHFlowPoints, - 'ATT_NAME': value.aTTNAME, + 'smallCamel': value['smallCamel'], + 'CapitalCamel': value['capitalCamel'], + 'small_Snake': value['smallSnake'], + 'Capital_Snake': value['capitalSnake'], + 'SCA_ETH_Flow_Points': value['sCAETHFlowPoints'], + 'ATT_NAME': value['aTTNAME'], }; } 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 73d368191f2b..94507ba96b1f 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 @@ -64,7 +64,7 @@ export function CatToJSON(value?: Cat | null): any { } return { ...AnimalToJSON(value), - 'declawed': value.declawed, + '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 87cea65fe6f5..3b4d927fb025 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 @@ -65,8 +65,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 7292e552629a..6309f0dfce81 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 @@ -57,7 +57,7 @@ export function ClassModelToJSON(value?: ClassModel | null): any { } return { - '_class': value._class, + '_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 80790e10b9db..96e2993ca963 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 @@ -57,7 +57,7 @@ export function ClientToJSON(value?: Client | null): any { } return { - 'client': value.client, + '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 d5557822fbe1..c8113b4c9a39 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 @@ -57,7 +57,7 @@ export function DeprecatedObjectToJSON(value?: DeprecatedObject | null): any { } return { - 'name': value.name, + '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 71c7d929582f..fec18e3e484c 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 @@ -64,7 +64,7 @@ export function DogToJSON(value?: Dog | null): any { } return { ...AnimalToJSON(value), - 'breed': value.breed, + '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 1b10872b3afb..0c93a179655a 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 @@ -84,8 +84,8 @@ export function EnumArraysToJSON(value?: EnumArrays | null): any { } return { - 'just_symbol': value.justSymbol, - 'array_enum': value.arrayEnum, + 'just_symbol': value['justSymbol'], + 'array_enum': value['arrayEnum'], }; } 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 633bb0999d1f..9a8b5051c321 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 @@ -172,14 +172,14 @@ export function EnumTestToJSON(value?: EnumTest | null): any { } return { - 'enum_string': value.enumString, - 'enum_string_required': value.enumStringRequired, - 'enum_integer': value.enumInteger, - 'enum_number': value.enumNumber, - 'outerEnum': OuterEnumToJSON(value.outerEnum), - 'outerEnumInteger': OuterEnumIntegerToJSON(value.outerEnumInteger), - 'outerEnumDefaultValue': OuterEnumDefaultValueToJSON(value.outerEnumDefaultValue), - 'outerEnumIntegerDefaultValue': OuterEnumIntegerDefaultValueToJSON(value.outerEnumIntegerDefaultValue), + 'enum_string': value['enumString'], + 'enum_string_required': value['enumStringRequired'], + 'enum_integer': value['enumInteger'], + 'enum_number': value['enumNumber'], + 'outerEnum': OuterEnumToJSON(value['outerEnum']), + 'outerEnumInteger': OuterEnumIntegerToJSON(value['outerEnumInteger']), + 'outerEnumDefaultValue': OuterEnumDefaultValueToJSON(value['outerEnumDefaultValue']), + 'outerEnumIntegerDefaultValue': OuterEnumIntegerDefaultValueToJSON(value['outerEnumIntegerDefaultValue']), }; } 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 e9dd2f055ab6..bf4371a93c1e 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 @@ -64,8 +64,8 @@ export function FakeBigDecimalMap200ResponseToJSON(value?: FakeBigDecimalMap200R } return { - 'someId': value.someId, - 'someMap': value.someMap, + 'someId': value['someId'], + 'someMap': value['someMap'], }; } 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 cb459d89a200..10e7e77f8f87 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 @@ -64,8 +64,8 @@ export function FileSchemaTestClassToJSON(value?: FileSchemaTestClass | null): a } return { - 'file': value.file, - 'files': value.files, + 'file': value['file'], + 'files': value['files'], }; } 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 eb4a11882665..ec179ce581b5 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 @@ -57,7 +57,7 @@ export function FooToJSON(value?: Foo | null): any { } return { - 'bar': value.bar, + '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 4ade37d0c4c5..ffd3e185c760 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 @@ -64,7 +64,7 @@ export function FooGetDefaultResponseToJSON(value?: FooGetDefaultResponse | null } return { - 'string': FooToJSON(value.string), + '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 97b1af1c9d67..b509f3575a2f 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 @@ -173,22 +173,22 @@ export function FormatTestToJSON(value?: FormatTest | null): any { } return { - 'integer': value.integer, - 'int32': value.int32, - 'int64': value.int64, - 'number': value.number, - 'float': value._float, - 'double': value._double, - 'decimal': DecimalToJSON(value.decimal), - 'string': value.string, - 'byte': value._byte, - 'binary': value.binary, - 'date': ((value.date).toISOString().substring(0,10)), - 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), - 'uuid': value.uuid, - 'password': value.password, - 'pattern_with_digits': value.patternWithDigits, - 'pattern_with_digits_and_delimiter': value.patternWithDigitsAndDelimiter, + 'integer': value['integer'], + 'int32': value['int32'], + 'int64': value['int64'], + 'number': value['number'], + 'float': value['_float'], + 'double': value['_double'], + 'decimal': DecimalToJSON(value['decimal']), + 'string': value['string'], + 'byte': value['_byte'], + 'binary': value['binary'], + 'date': ((value['date']).toISOString().substring(0,10)), + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value['dateTime']).toISOString()), + 'uuid': value['uuid'], + 'password': value['password'], + 'pattern_with_digits': value['patternWithDigits'], + 'pattern_with_digits_and_delimiter': value['patternWithDigitsAndDelimiter'], }; } 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 ce90c996a4a8..6d58f178cdcb 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 @@ -57,7 +57,7 @@ export function HealthCheckResultToJSON(value?: HealthCheckResult | null): any { } return { - 'NullableMessage': value.nullableMessage, + '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 61735bf041dd..c4afb61a4de4 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 @@ -57,7 +57,7 @@ export function ListToJSON(value?: List | null): any { } return { - '123-list': value._123list, + '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 fd75eee91460..b36dfda98d88 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 @@ -89,10 +89,10 @@ export function MapTestToJSON(value?: MapTest | null): any { } return { - 'map_map_of_string': value.mapMapOfString, - 'map_of_enum_string': value.mapOfEnumString, - 'direct_map': value.directMap, - 'indirect_map': value.indirectMap, + 'map_map_of_string': value['mapMapOfString'], + 'map_of_enum_string': value['mapOfEnumString'], + 'direct_map': value['directMap'], + 'indirect_map': value['indirectMap'], }; } 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 4097913c88f5..f22b2b72a221 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 @@ -78,9 +78,9 @@ export function MixedPropertiesAndAdditionalPropertiesClassToJSON(value?: MixedP } return { - 'uuid': value.uuid, - 'dateTime': !exists(value, 'dateTime') ? undefined : ((value.dateTime).toISOString()), - 'map': !exists(value, 'map') ? undefined : (mapValues(value.map, AnimalToJSON)), + 'uuid': value['uuid'], + 'dateTime': !exists(value, 'dateTime') ? undefined : ((value['dateTime']).toISOString()), + 'map': !exists(value, 'map') ? undefined : (mapValues(value['map'], AnimalToJSON)), }; } 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 5a702847aacc..8cabcd2d4b3e 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 @@ -64,8 +64,8 @@ export function Model200ResponseToJSON(value?: Model200Response | null): any { } return { - 'name': value.name, - 'class': value._class, + 'name': value['name'], + 'class': value['_class'], }; } 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 1e94140a1edb..b3685aea30ad 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 09b9e2a02cf2..0611bad737d6 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 @@ -57,7 +57,7 @@ export function ModelFileToJSON(value?: ModelFile | null): any { } return { - 'sourceURI': value.sourceURI, + '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 be9875602c28..4ba736c85a45 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 @@ -79,8 +79,8 @@ export function NameToJSON(value?: Name | null): any { } return { - 'name': value.name, - 'property': value.property, + 'name': value['name'], + 'property': value['property'], }; } 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 4c6ba1adf742..de25ab3382a4 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 @@ -137,18 +137,18 @@ export function NullableClassToJSON(value?: NullableClass | null): any { return { ...value, - 'integer_prop': value.integerProp, - 'number_prop': value.numberProp, - 'boolean_prop': value.booleanProp, - 'string_prop': value.stringProp, - 'date_prop': !exists(value, 'dateProp') ? undefined : ((value.dateProp as any).toISOString().substring(0,10)), - 'datetime_prop': !exists(value, 'datetimeProp') ? undefined : ((value.datetimeProp as any).toISOString()), - 'array_nullable_prop': value.arrayNullableProp, - 'array_and_items_nullable_prop': value.arrayAndItemsNullableProp, - 'array_items_nullable': value.arrayItemsNullable, - 'object_nullable_prop': value.objectNullableProp, - 'object_and_items_nullable_prop': value.objectAndItemsNullableProp, - 'object_items_nullable': value.objectItemsNullable, + 'integer_prop': value['integerProp'], + 'number_prop': value['numberProp'], + 'boolean_prop': value['booleanProp'], + 'string_prop': value['stringProp'], + 'date_prop': !exists(value, 'dateProp') ? undefined : ((value['dateProp'] as any).toISOString().substring(0,10)), + 'datetime_prop': !exists(value, 'datetimeProp') ? undefined : ((value['datetimeProp'] as any).toISOString()), + 'array_nullable_prop': value['arrayNullableProp'], + 'array_and_items_nullable_prop': value['arrayAndItemsNullableProp'], + 'array_items_nullable': value['arrayItemsNullable'], + 'object_nullable_prop': value['objectNullableProp'], + 'object_and_items_nullable_prop': value['objectAndItemsNullableProp'], + 'object_items_nullable': value['objectItemsNullable'], }; } 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 144e5363127c..7a25240d3537 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 @@ -57,7 +57,7 @@ export function NumberOnlyToJSON(value?: NumberOnly | null): any { } return { - 'JustNumber': value.justNumber, + '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 518d87ecfe9e..4a921582669f 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 @@ -88,10 +88,10 @@ export function ObjectWithDeprecatedFieldsToJSON(value?: ObjectWithDeprecatedFie } return { - 'uuid': value.uuid, - 'id': value.id, - 'deprecatedRef': DeprecatedObjectToJSON(value.deprecatedRef), - 'bars': value.bars, + 'uuid': value['uuid'], + 'id': value['id'], + 'deprecatedRef': DeprecatedObjectToJSON(value['deprecatedRef']), + 'bars': value['bars'], }; } 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 815c7531b1f2..6f2b79b5c85b 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 07771ec7202e..14b4e4542fab 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 @@ -71,9 +71,9 @@ export function OuterCompositeToJSON(value?: OuterComposite | null): any { } return { - 'my_number': value.myNumber, - 'my_string': value.myString, - 'my_boolean': value.myBoolean, + 'my_number': value['myNumber'], + 'my_string': value['myString'], + 'my_boolean': value['myBoolean'], }; } 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 4e746368a7d9..1182b747df28 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 @@ -65,7 +65,7 @@ export function OuterObjectWithEnumPropertyToJSON(value?: OuterObjectWithEnumPro } return { - 'value': OuterEnumIntegerToJSON(value.value), + '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 4c79710cd38b..e53a44fc33f5 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 @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': Array.from(value.photoUrls as Set), - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': Array.from(value['photoUrls'] as Set), + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 9269c0f7b44e..97c192be7826 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 @@ -64,7 +64,7 @@ export function ReadOnlyFirstToJSON(value?: ReadOnlyFirst | null): any { } return { - 'baz': value.baz, + '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 cd481d2e842d..9d2a3787c26d 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 @@ -57,7 +57,7 @@ export function ReturnToJSON(value?: Return | null): any { } return { - 'return': value._return, + 'return': value['_return'], }; } 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 7b9780125d22..414fcb168909 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 @@ -57,7 +57,7 @@ export function SpecialModelNameToJSON(value?: SpecialModelName | null): any { } return { - '$special[property.name]': value.$specialPropertyName, + '$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 4b8840070b42..446a1d0da769 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 7bdc391dd43c..ed2c73a101e7 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 @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } 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 4ea5eba7fe7d..001bc135bb96 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 @@ -64,8 +64,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 69fee6449c2c..a7fc63d81f1b 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 3246795cb314..9e12fc242793 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 f9dda35da96a..8906602f6f4b 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 @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': value.photoUrls, - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': value['photoUrls'], + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 3f159accd658..24a25f383dba 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 fcd03bd8bf7f..00ab35b80563 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 @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } 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 4ea5eba7fe7d..001bc135bb96 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 @@ -64,8 +64,8 @@ export function CategoryToJSON(value?: Category | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 69fee6449c2c..a7fc63d81f1b 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 @@ -71,9 +71,9 @@ export function ModelApiResponseToJSON(value?: ModelApiResponse | null): any { } return { - 'code': value.code, - 'type': value.type, - 'message': value.message, + 'code': value['code'], + 'type': value['type'], + 'message': value['message'], }; } 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 3246795cb314..9e12fc242793 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 @@ -104,12 +104,12 @@ export function OrderToJSON(value?: Order | null): any { } return { - 'id': value.id, - 'petId': value.petId, - 'quantity': value.quantity, - 'shipDate': !exists(value, 'shipDate') ? undefined : ((value.shipDate).toISOString()), - 'status': value.status, - 'complete': value.complete, + 'id': value['id'], + 'petId': value['petId'], + 'quantity': value['quantity'], + 'shipDate': !exists(value, 'shipDate') ? undefined : ((value['shipDate']).toISOString()), + 'status': value['status'], + 'complete': value['complete'], }; } 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 f9dda35da96a..8906602f6f4b 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 @@ -119,12 +119,12 @@ export function PetToJSON(value?: Pet | null): any { } return { - 'id': value.id, - 'category': CategoryToJSON(value.category), - 'name': value.name, - 'photoUrls': value.photoUrls, - 'tags': !exists(value, 'tags') ? undefined : ((value.tags as Array).map(TagToJSON)), - 'status': value.status, + 'id': value['id'], + 'category': CategoryToJSON(value['category']), + 'name': value['name'], + 'photoUrls': value['photoUrls'], + 'tags': !exists(value, 'tags') ? undefined : ((value['tags'] as Array).map(TagToJSON)), + 'status': value['status'], }; } 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 3f159accd658..24a25f383dba 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 @@ -64,8 +64,8 @@ export function TagToJSON(value?: Tag | null): any { } return { - 'id': value.id, - 'name': value.name, + 'id': value['id'], + 'name': value['name'], }; } 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 fcd03bd8bf7f..00ab35b80563 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 @@ -106,14 +106,14 @@ export function UserToJSON(value?: User | null): any { } return { - 'id': value.id, - 'username': value.username, - 'firstName': value.firstName, - 'lastName': value.lastName, - 'email': value.email, - 'password': value.password, - 'phone': value.phone, - 'userStatus': value.userStatus, + 'id': value['id'], + 'username': value['username'], + 'firstName': value['firstName'], + 'lastName': value['lastName'], + 'email': value['email'], + 'password': value['password'], + 'phone': value['phone'], + 'userStatus': value['userStatus'], }; } 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 f217c10419df..38d190ba0f39 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 @@ -91,10 +91,10 @@ export function EnumPatternObjectToJSON(value?: EnumPatternObject | null): any { } return { - 'string-enum': StringEnumToJSON(value.stringEnum), - 'nullable-string-enum': StringEnumToJSON(value.nullableStringEnum), - 'number-enum': NumberEnumToJSON(value.numberEnum), - 'nullable-number-enum': NumberEnumToJSON(value.nullableNumberEnum), + 'string-enum': StringEnumToJSON(value['stringEnum']), + 'nullable-string-enum': StringEnumToJSON(value['nullableStringEnum']), + 'number-enum': NumberEnumToJSON(value['numberEnum']), + 'nullable-number-enum': NumberEnumToJSON(value['nullableNumberEnum']), }; } 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 134ed1afca9a..cdacb3338c5c 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 @@ -116,10 +116,10 @@ export function FakeEnumRequestGetInline200ResponseToJSON(value?: FakeEnumReques } return { - 'string-enum': value.stringEnum, - 'nullable-string-enum': value.nullableStringEnum, - 'number-enum': value.numberEnum, - 'nullable-number-enum': value.nullableNumberEnum, + 'string-enum': value['stringEnum'], + 'nullable-string-enum': value['nullableStringEnum'], + 'number-enum': value['numberEnum'], + 'nullable-number-enum': value['nullableNumberEnum'], }; }