From ef583c53dd569ab8299e085982f1b35d352b9dfc Mon Sep 17 00:00:00 2001 From: Arne Beer Date: Mon, 13 Jun 2022 17:03:12 +0200 Subject: [PATCH] [typescript-fetch] Fix ToJSON for non-descriminator oneOf constructs (#12513) * [typescript-fetch] Fix ToJSON for non-descriminator oneOf constructs * [typescript-fetch] Update samples for oneOf fix --- .../typescript-fetch/modelGeneric.mustache | 14 +++++++++++ .../typescript-fetch/modelOneOf.mustache | 10 +++++++- .../models/AdditionalPropertiesClass.ts | 9 ++++++++ .../default-v3.0/models/AllOfWithSingleRef.ts | 9 ++++++++ .../builds/default-v3.0/models/Animal.ts | 10 ++++++++ .../models/ArrayOfArrayOfNumberOnly.ts | 9 ++++++++ .../default-v3.0/models/ArrayOfNumberOnly.ts | 9 ++++++++ .../builds/default-v3.0/models/ArrayTest.ts | 9 ++++++++ .../default-v3.0/models/Capitalization.ts | 9 ++++++++ .../builds/default-v3.0/models/Cat.ts | 9 ++++++++ .../builds/default-v3.0/models/CatAllOf.ts | 9 ++++++++ .../builds/default-v3.0/models/Category.ts | 10 ++++++++ .../builds/default-v3.0/models/ClassModel.ts | 9 ++++++++ .../builds/default-v3.0/models/Client.ts | 9 ++++++++ .../default-v3.0/models/DeprecatedObject.ts | 9 ++++++++ .../builds/default-v3.0/models/Dog.ts | 9 ++++++++ .../builds/default-v3.0/models/DogAllOf.ts | 9 ++++++++ .../builds/default-v3.0/models/EnumArrays.ts | 9 ++++++++ .../builds/default-v3.0/models/EnumTest.ts | 10 ++++++++ .../models/FileSchemaTestClass.ts | 9 ++++++++ .../builds/default-v3.0/models/Foo.ts | 9 ++++++++ .../models/FooGetDefaultResponse.ts | 9 ++++++++ .../builds/default-v3.0/models/FormatTest.ts | 13 +++++++++++ .../default-v3.0/models/HasOnlyReadOnly.ts | 9 ++++++++ .../default-v3.0/models/HealthCheckResult.ts | 9 ++++++++ .../builds/default-v3.0/models/List.ts | 9 ++++++++ .../builds/default-v3.0/models/MapTest.ts | 9 ++++++++ ...dPropertiesAndAdditionalPropertiesClass.ts | 9 ++++++++ .../default-v3.0/models/Model200Response.ts | 9 ++++++++ .../default-v3.0/models/ModelApiResponse.ts | 9 ++++++++ .../builds/default-v3.0/models/ModelFile.ts | 9 ++++++++ .../builds/default-v3.0/models/Name.ts | 10 ++++++++ .../default-v3.0/models/NullableClass.ts | 9 ++++++++ .../builds/default-v3.0/models/NumberOnly.ts | 9 ++++++++ .../models/ObjectWithDeprecatedFields.ts | 9 ++++++++ .../builds/default-v3.0/models/Order.ts | 9 ++++++++ .../default-v3.0/models/OuterComposite.ts | 9 ++++++++ .../models/OuterObjectWithEnumProperty.ts | 10 ++++++++ .../builds/default-v3.0/models/Pet.ts | 11 +++++++++ .../default-v3.0/models/ReadOnlyFirst.ts | 9 ++++++++ .../builds/default-v3.0/models/Return.ts | 9 ++++++++ .../default-v3.0/models/SpecialModelName.ts | 9 ++++++++ .../builds/default-v3.0/models/Tag.ts | 9 ++++++++ .../builds/default-v3.0/models/User.ts | 9 ++++++++ .../builds/default/models/Category.ts | 9 ++++++++ .../builds/default/models/ModelApiResponse.ts | 9 ++++++++ .../builds/default/models/Order.ts | 9 ++++++++ .../builds/default/models/Pet.ts | 11 +++++++++ .../builds/default/models/Tag.ts | 9 ++++++++ .../builds/default/models/User.ts | 9 ++++++++ .../builds/enum/models/EnumPatternObject.ts | 9 ++++++++ .../FakeEnumRequestGetInline200Response.ts | 9 ++++++++ .../builds/es6-target/src/models/Category.ts | 9 ++++++++ .../es6-target/src/models/ModelApiResponse.ts | 9 ++++++++ .../builds/es6-target/src/models/Order.ts | 9 ++++++++ .../builds/es6-target/src/models/Pet.ts | 11 +++++++++ .../builds/es6-target/src/models/Tag.ts | 9 ++++++++ .../builds/es6-target/src/models/User.ts | 9 ++++++++ .../multiple-parameters/models/Category.ts | 9 ++++++++ .../models/ModelApiResponse.ts | 9 ++++++++ .../multiple-parameters/models/Order.ts | 9 ++++++++ .../builds/multiple-parameters/models/Pet.ts | 11 +++++++++ .../builds/multiple-parameters/models/Tag.ts | 9 ++++++++ .../builds/multiple-parameters/models/User.ts | 9 ++++++++ .../src/models/Category.ts | 9 ++++++++ .../src/models/ModelApiResponse.ts | 9 ++++++++ .../src/models/Order.ts | 9 ++++++++ .../src/models/Pet.ts | 11 +++++++++ .../src/models/Tag.ts | 9 ++++++++ .../src/models/User.ts | 9 ++++++++ .../sagas-and-records/src/models/Category.ts | 9 ++++++++ .../src/models/DefaultMetaOnlyResponse.ts | 10 ++++++++ .../src/models/FindPetsByStatusResponse.ts | 10 ++++++++ .../src/models/FindPetsByUserResponse.ts | 10 ++++++++ .../models/GetBehaviorPermissionsResponse.ts | 10 ++++++++ .../src/models/GetBehaviorTypeResponse.ts | 10 ++++++++ .../src/models/GetMatchingPartsResponse.ts | 10 ++++++++ .../src/models/GetPetPartTypeResponse.ts | 10 ++++++++ .../sagas-and-records/src/models/ItemId.ts | 11 +++++++++ .../src/models/MatchingParts.ts | 11 +++++++++ .../src/models/ModelApiResponse.ts | 9 ++++++++ .../src/models/ModelError.ts | 10 ++++++++ .../sagas-and-records/src/models/Order.ts | 9 ++++++++ .../sagas-and-records/src/models/Part.ts | 11 +++++++++ .../sagas-and-records/src/models/Pet.ts | 23 +++++++++++++++++++ .../src/models/PetRegionsResponse.ts | 10 ++++++++ .../src/models/ResponseMeta.ts | 10 ++++++++ .../sagas-and-records/src/models/Tag.ts | 9 ++++++++ .../sagas-and-records/src/models/User.ts | 11 +++++++++ .../builds/with-interfaces/models/Category.ts | 9 ++++++++ .../models/ModelApiResponse.ts | 9 ++++++++ .../builds/with-interfaces/models/Order.ts | 9 ++++++++ .../builds/with-interfaces/models/Pet.ts | 11 +++++++++ .../builds/with-interfaces/models/Tag.ts | 9 ++++++++ .../builds/with-interfaces/models/User.ts | 9 ++++++++ .../with-npm-version/src/models/Category.ts | 9 ++++++++ .../src/models/ModelApiResponse.ts | 9 ++++++++ .../with-npm-version/src/models/Order.ts | 9 ++++++++ .../builds/with-npm-version/src/models/Pet.ts | 11 +++++++++ .../builds/with-npm-version/src/models/Tag.ts | 9 ++++++++ .../with-npm-version/src/models/User.ts | 9 ++++++++ .../models/EnumPatternObject.ts | 9 ++++++++ .../FakeEnumRequestGetInline200Response.ts | 9 ++++++++ 103 files changed, 987 insertions(+), 1 deletion(-) 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 b37cfdec9da..32f534af010 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -20,6 +20,20 @@ import { {{/discriminator}} {{>modelGenericInterfaces}} +/** + * 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; + {{/required}} + {{/vars}} + + return isInstance; +} + export function {{classname}}FromJSON(json: any): {{classname}} { return {{classname}}FromJSONTyped(json, false); } 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 7cb97abeba8..4f7e9a3c017 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache @@ -2,6 +2,7 @@ {{#oneOf}} import { {{{.}}}, + instanceOf{{{.}}}, {{{.}}}FromJSON, {{{.}}}FromJSONTyped, {{{.}}}ToJSON, @@ -51,7 +52,14 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any { throw new Error(`No variant of {{classname}} exists with '{{discriminator.propertyName}}=${value['{{discriminator.propertyName}}']}'`); } {{/discriminator}} + {{^discriminator}} - return { {{#oneOf}}...{{{.}}}ToJSON(value){{^-last}}, {{/-last}}{{/oneOf}} }; + {{#oneOf}} + if (instanceOf{{{.}}}(value)) { + return {{{.}}}ToJSON(value as {{{.}}}); + } + {{/oneOf}} + + return {}; {{/discriminator}} } 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 4036c2835bf..ae1161178db 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 @@ -33,6 +33,15 @@ export interface AdditionalPropertiesClass { mapOfMapProperty?: { [key: string]: { [key: string]: string; }; }; } +/** + * Check if a given object implements the AdditionalPropertiesClass interface. + */ +export function instanceOfAdditionalPropertiesClass(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function AdditionalPropertiesClassFromJSON(json: any): AdditionalPropertiesClass { return AdditionalPropertiesClassFromJSONTyped(json, false); } 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 e10f10e7251..a1a0dec5470 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 @@ -40,6 +40,15 @@ export interface AllOfWithSingleRef { singleRefType?: SingleRefType | null; } +/** + * Check if a given object implements the AllOfWithSingleRef interface. + */ +export function instanceOfAllOfWithSingleRef(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function AllOfWithSingleRefFromJSON(json: any): AllOfWithSingleRef { return AllOfWithSingleRefFromJSONTyped(json, false); } 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 d7615f2bef7..7c611d3f08e 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 @@ -38,6 +38,16 @@ export interface Animal { color?: string; } +/** + * 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; +} + export function AnimalFromJSON(json: any): Animal { return AnimalFromJSONTyped(json, false); } 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 d550728ba7c..7ab12458982 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 @@ -27,6 +27,15 @@ export interface ArrayOfArrayOfNumberOnly { arrayArrayNumber?: Array>; } +/** + * Check if a given object implements the ArrayOfArrayOfNumberOnly interface. + */ +export function instanceOfArrayOfArrayOfNumberOnly(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ArrayOfArrayOfNumberOnlyFromJSON(json: any): ArrayOfArrayOfNumberOnly { return ArrayOfArrayOfNumberOnlyFromJSONTyped(json, false); } 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 834ed08cee3..e0bdb81203b 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 @@ -27,6 +27,15 @@ export interface ArrayOfNumberOnly { arrayNumber?: Array; } +/** + * Check if a given object implements the ArrayOfNumberOnly interface. + */ +export function instanceOfArrayOfNumberOnly(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ArrayOfNumberOnlyFromJSON(json: any): ArrayOfNumberOnly { return ArrayOfNumberOnlyFromJSONTyped(json, false); } 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 17144b78281..170096bc497 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 @@ -46,6 +46,15 @@ export interface ArrayTest { arrayArrayOfModel?: Array>; } +/** + * Check if a given object implements the ArrayTest interface. + */ +export function instanceOfArrayTest(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ArrayTestFromJSON(json: any): ArrayTest { return ArrayTestFromJSONTyped(json, false); } 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 8bfd529f1a2..6143a3f3707 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 @@ -57,6 +57,15 @@ export interface Capitalization { aTTNAME?: string; } +/** + * Check if a given object implements the Capitalization interface. + */ +export function instanceOfCapitalization(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CapitalizationFromJSON(json: any): Capitalization { return CapitalizationFromJSONTyped(json, false); } 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 7d6db07958a..853ca978761 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 @@ -40,6 +40,15 @@ export interface Cat extends Animal { declawed?: boolean; } +/** + * Check if a given object implements the Cat interface. + */ +export function instanceOfCat(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CatFromJSON(json: any): Cat { return CatFromJSONTyped(json, false); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/CatAllOf.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/CatAllOf.ts index 1ac10c45164..1256a21fea8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/CatAllOf.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/CatAllOf.ts @@ -27,6 +27,15 @@ export interface CatAllOf { declawed?: boolean; } +/** + * Check if a given object implements the CatAllOf interface. + */ +export function instanceOfCatAllOf(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CatAllOfFromJSON(json: any): CatAllOf { return CatAllOfFromJSONTyped(json, false); } 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 ec6ee21ff39..d1e2e3f8ac8 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 @@ -33,6 +33,16 @@ export interface Category { name: string; } +/** + * 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; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 f149bb68256..0f01d81b15a 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 @@ -27,6 +27,15 @@ export interface ClassModel { _class?: string; } +/** + * Check if a given object implements the ClassModel interface. + */ +export function instanceOfClassModel(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ClassModelFromJSON(json: any): ClassModel { return ClassModelFromJSONTyped(json, false); } 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 44f2c241f24..a9fd27b4f46 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 @@ -27,6 +27,15 @@ export interface Client { client?: string; } +/** + * Check if a given object implements the Client interface. + */ +export function instanceOfClient(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ClientFromJSON(json: any): Client { return ClientFromJSONTyped(json, false); } 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 5c3876e4396..0cec2d09297 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 @@ -27,6 +27,15 @@ export interface DeprecatedObject { name?: string; } +/** + * Check if a given object implements the DeprecatedObject interface. + */ +export function instanceOfDeprecatedObject(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function DeprecatedObjectFromJSON(json: any): DeprecatedObject { return DeprecatedObjectFromJSONTyped(json, false); } 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 f68b8e02510..83bb2b1dbf1 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 @@ -40,6 +40,15 @@ export interface Dog extends Animal { breed?: string; } +/** + * Check if a given object implements the Dog interface. + */ +export function instanceOfDog(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function DogFromJSON(json: any): Dog { return DogFromJSONTyped(json, false); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DogAllOf.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DogAllOf.ts index 12f6f67feb8..35034bbd490 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DogAllOf.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DogAllOf.ts @@ -27,6 +27,15 @@ export interface DogAllOf { breed?: string; } +/** + * Check if a given object implements the DogAllOf interface. + */ +export function instanceOfDogAllOf(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function DogAllOfFromJSON(json: any): DogAllOf { return DogAllOfFromJSONTyped(json, false); } 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 2dbe08d721d..9603be51cd5 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 @@ -53,6 +53,15 @@ export const EnumArraysArrayEnumEnum = { export type EnumArraysArrayEnumEnum = typeof EnumArraysArrayEnumEnum[keyof typeof EnumArraysArrayEnumEnum]; +/** + * Check if a given object implements the EnumArrays interface. + */ +export function instanceOfEnumArrays(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function EnumArraysFromJSON(json: any): EnumArrays { return EnumArraysFromJSONTyped(json, false); } 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 9791000abb7..c3eaad1af1d 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 @@ -134,6 +134,16 @@ export const EnumTestEnumNumberEnum = { export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof EnumTestEnumNumberEnum]; +/** + * 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; +} + export function EnumTestFromJSON(json: any): EnumTest { return EnumTestFromJSONTyped(json, false); } 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 78c4b71733f..71f887cf327 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 @@ -33,6 +33,15 @@ export interface FileSchemaTestClass { files?: Array; } +/** + * Check if a given object implements the FileSchemaTestClass interface. + */ +export function instanceOfFileSchemaTestClass(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function FileSchemaTestClassFromJSON(json: any): FileSchemaTestClass { return FileSchemaTestClassFromJSONTyped(json, false); } 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 90d10f435b0..aa5b331c3b6 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 @@ -27,6 +27,15 @@ export interface Foo { bar?: string; } +/** + * Check if a given object implements the Foo interface. + */ +export function instanceOfFoo(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function FooFromJSON(json: any): Foo { return FooFromJSONTyped(json, false); } 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 f6c439c1a08..dc673bcee43 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 @@ -34,6 +34,15 @@ export interface FooGetDefaultResponse { string?: Foo; } +/** + * Check if a given object implements the FooGetDefaultResponse interface. + */ +export function instanceOfFooGetDefaultResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function FooGetDefaultResponseFromJSON(json: any): FooGetDefaultResponse { return FooGetDefaultResponseFromJSONTyped(json, false); } 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 b60fcb5756a..b36bb3d4022 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 @@ -124,6 +124,19 @@ export interface FormatTest { patternWithDigitsAndDelimiter?: string; } +/** + * 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; +} + export function FormatTestFromJSON(json: any): FormatTest { return FormatTestFromJSONTyped(json, false); } 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 e29e66a5b3e..d3dc4be6767 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 @@ -33,6 +33,15 @@ export interface HasOnlyReadOnly { readonly foo?: string; } +/** + * Check if a given object implements the HasOnlyReadOnly interface. + */ +export function instanceOfHasOnlyReadOnly(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function HasOnlyReadOnlyFromJSON(json: any): HasOnlyReadOnly { return HasOnlyReadOnlyFromJSONTyped(json, false); } 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 f70dfe19150..d62e1f09b82 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 @@ -27,6 +27,15 @@ export interface HealthCheckResult { nullableMessage?: string | null; } +/** + * Check if a given object implements the HealthCheckResult interface. + */ +export function instanceOfHealthCheckResult(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function HealthCheckResultFromJSON(json: any): HealthCheckResult { return HealthCheckResultFromJSONTyped(json, false); } 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 ef025131e76..1334322e823 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 @@ -27,6 +27,15 @@ export interface List { _123list?: string; } +/** + * Check if a given object implements the List interface. + */ +export function instanceOfList(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ListFromJSON(json: any): List { return ListFromJSONTyped(json, false); } 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 c54b2a32f50..2ae39dd903f 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 @@ -56,6 +56,15 @@ export const MapTestMapOfEnumStringEnum = { export type MapTestMapOfEnumStringEnum = typeof MapTestMapOfEnumStringEnum[keyof typeof MapTestMapOfEnumStringEnum]; +/** + * Check if a given object implements the MapTest interface. + */ +export function instanceOfMapTest(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function MapTestFromJSON(json: any): MapTest { return MapTestFromJSONTyped(json, false); } 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 15e830ea39c..5eac69a308e 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 @@ -46,6 +46,15 @@ export interface MixedPropertiesAndAdditionalPropertiesClass { map?: { [key: string]: Animal; }; } +/** + * Check if a given object implements the MixedPropertiesAndAdditionalPropertiesClass interface. + */ +export function instanceOfMixedPropertiesAndAdditionalPropertiesClass(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function MixedPropertiesAndAdditionalPropertiesClassFromJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { return MixedPropertiesAndAdditionalPropertiesClassFromJSONTyped(json, false); } 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 ba25d3451c6..8b32d414747 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 @@ -33,6 +33,15 @@ export interface Model200Response { _class?: string; } +/** + * Check if a given object implements the Model200Response interface. + */ +export function instanceOfModel200Response(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function Model200ResponseFromJSON(json: any): Model200Response { return Model200ResponseFromJSONTyped(json, false); } 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 5ba9e329f48..8001d49c55b 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 @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 822256afd60..9d269ea77a1 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 @@ -27,6 +27,15 @@ export interface ModelFile { sourceURI?: string; } +/** + * Check if a given object implements the ModelFile interface. + */ +export function instanceOfModelFile(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelFileFromJSON(json: any): ModelFile { return ModelFileFromJSONTyped(json, false); } 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 20737db87c2..f58a563b8b5 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 @@ -45,6 +45,16 @@ export interface Name { readonly _123number?: number; } +/** + * 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; +} + export function NameFromJSON(json: any): Name { return NameFromJSONTyped(json, false); } 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 d154f41a032..f600f254c7a 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 @@ -94,6 +94,15 @@ export interface NullableClass { objectItemsNullable?: { [key: string]: object; }; } +/** + * Check if a given object implements the NullableClass interface. + */ +export function instanceOfNullableClass(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function NullableClassFromJSON(json: any): NullableClass { return NullableClassFromJSONTyped(json, false); } 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 06493cb576e..f8d62e3fce5 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 @@ -27,6 +27,15 @@ export interface NumberOnly { justNumber?: number; } +/** + * Check if a given object implements the NumberOnly interface. + */ +export function instanceOfNumberOnly(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function NumberOnlyFromJSON(json: any): NumberOnly { return NumberOnlyFromJSONTyped(json, false); } 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 1ea8d319f11..d64a47ecd87 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 @@ -55,6 +55,15 @@ export interface ObjectWithDeprecatedFields { bars?: Array; } +/** + * Check if a given object implements the ObjectWithDeprecatedFields interface. + */ +export function instanceOfObjectWithDeprecatedFields(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ObjectWithDeprecatedFieldsFromJSON(json: any): ObjectWithDeprecatedFields { return ObjectWithDeprecatedFieldsFromJSONTyped(json, false); } 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 a5d97f21a03..cd72c59ea5c 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 @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 ed383644e55..41434f59f30 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 @@ -39,6 +39,15 @@ export interface OuterComposite { myBoolean?: boolean; } +/** + * Check if a given object implements the OuterComposite interface. + */ +export function instanceOfOuterComposite(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OuterCompositeFromJSON(json: any): OuterComposite { return OuterCompositeFromJSONTyped(json, false); } 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 878aef40cdf..307a79f0532 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 @@ -34,6 +34,16 @@ export interface OuterObjectWithEnumProperty { value: OuterEnumInteger; } +/** + * 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; +} + export function OuterObjectWithEnumPropertyFromJSON(json: any): OuterObjectWithEnumProperty { return OuterObjectWithEnumPropertyFromJSONTyped(json, false); } 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 c513a3faa1c..2a3b126e705 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 @@ -82,6 +82,17 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 96028e653a7..66d83cff784 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 @@ -33,6 +33,15 @@ export interface ReadOnlyFirst { baz?: string; } +/** + * Check if a given object implements the ReadOnlyFirst interface. + */ +export function instanceOfReadOnlyFirst(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ReadOnlyFirstFromJSON(json: any): ReadOnlyFirst { return ReadOnlyFirstFromJSONTyped(json, false); } 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 f24902a02fc..64d125505b1 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 @@ -27,6 +27,15 @@ export interface Return { _return?: number; } +/** + * Check if a given object implements the Return interface. + */ +export function instanceOfReturn(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ReturnFromJSON(json: any): Return { return ReturnFromJSONTyped(json, false); } 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 2c5e3376007..aa9065c4867 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 @@ -27,6 +27,15 @@ export interface SpecialModelName { $specialPropertyName?: number; } +/** + * Check if a given object implements the SpecialModelName interface. + */ +export function instanceOfSpecialModelName(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function SpecialModelNameFromJSON(json: any): SpecialModelName { return SpecialModelNameFromJSONTyped(json, false); } 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 54254fc47ff..b52383c07ea 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 @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 05c0ec7b638..daa30cd6783 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 @@ -69,6 +69,15 @@ export interface User { userStatus?: number; } +/** + * Check if a given object implements the User interface. + */ +export function instanceOfUser(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 fe0e21ffb8b..88256738720 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts @@ -33,6 +33,15 @@ export interface Category { name?: string; } +/** + * Check if a given object implements the Category interface. + */ +export function instanceOfCategory(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 6812901c377..bf50981fc2e 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 2e4f44f6469..0d69755d488 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 1866bcb149e..9d8c7c9d496 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts @@ -82,6 +82,17 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 0c26039df46..e4902aa53cf 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 89a7de983b0..f22da928907 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts @@ -69,6 +69,15 @@ export interface User { userStatus?: number; } +/** + * Check if a given object implements the User interface. + */ +export function instanceOfUser(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 463eadb6d55..2725f3c2b89 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts @@ -58,6 +58,15 @@ export interface EnumPatternObject { nullableNumberEnum?: NumberEnum | null; } +/** + * Check if a given object implements the EnumPatternObject interface. + */ +export function instanceOfEnumPatternObject(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function EnumPatternObjectFromJSON(json: any): EnumPatternObject { return EnumPatternObjectFromJSONTyped(json, false); } 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 34cbe964c28..35bc8a8a8aa 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -87,6 +87,15 @@ export const FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum = { export type FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum = typeof FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum[keyof typeof FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum]; +/** + * Check if a given object implements the FakeEnumRequestGetInline200Response interface. + */ +export function instanceOfFakeEnumRequestGetInline200Response(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnumRequestGetInline200Response { return FakeEnumRequestGetInline200ResponseFromJSONTyped(json, false); } 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 fe0e21ffb8b..88256738720 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 @@ -33,6 +33,15 @@ export interface Category { name?: string; } +/** + * Check if a given object implements the Category interface. + */ +export function instanceOfCategory(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 6812901c377..bf50981fc2e 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 @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 2e4f44f6469..0d69755d488 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 @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 1866bcb149e..9d8c7c9d496 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 @@ -82,6 +82,17 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 0c26039df46..e4902aa53cf 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 @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 89a7de983b0..f22da928907 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 @@ -69,6 +69,15 @@ export interface User { userStatus?: number; } +/** + * Check if a given object implements the User interface. + */ +export function instanceOfUser(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 fe0e21ffb8b..88256738720 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 @@ -33,6 +33,15 @@ export interface Category { name?: string; } +/** + * Check if a given object implements the Category interface. + */ +export function instanceOfCategory(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 6812901c377..bf50981fc2e 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 @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 2e4f44f6469..0d69755d488 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 @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 1866bcb149e..9d8c7c9d496 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 @@ -82,6 +82,17 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 0c26039df46..e4902aa53cf 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 @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 89a7de983b0..f22da928907 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 @@ -69,6 +69,15 @@ export interface User { userStatus?: number; } +/** + * Check if a given object implements the User interface. + */ +export function instanceOfUser(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 fe0e21ffb8b..88256738720 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 @@ -33,6 +33,15 @@ export interface Category { name?: string; } +/** + * Check if a given object implements the Category interface. + */ +export function instanceOfCategory(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 6812901c377..bf50981fc2e 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 @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 2e4f44f6469..0d69755d488 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 @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 1866bcb149e..9d8c7c9d496 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 @@ -82,6 +82,17 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 0c26039df46..e4902aa53cf 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 @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 89a7de983b0..f22da928907 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 @@ -69,6 +69,15 @@ export interface User { userStatus?: number; } +/** + * Check if a given object implements the User interface. + */ +export function instanceOfUser(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 fe0e21ffb8b..88256738720 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 @@ -33,6 +33,15 @@ export interface Category { name?: string; } +/** + * Check if a given object implements the Category interface. + */ +export function instanceOfCategory(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 5b4dc83e5fe..15dc30c8ab1 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 @@ -34,6 +34,16 @@ export interface DefaultMetaOnlyResponse { meta: ResponseMeta; } +/** + * 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; +} + export function DefaultMetaOnlyResponseFromJSON(json: any): DefaultMetaOnlyResponse { return DefaultMetaOnlyResponseFromJSONTyped(json, false); } 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 28dd4020cd8..e973c4234ab 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 @@ -46,6 +46,16 @@ export interface FindPetsByStatusResponse { data?: Array; } +/** + * 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; +} + export function FindPetsByStatusResponseFromJSON(json: any): FindPetsByStatusResponse { return FindPetsByStatusResponseFromJSONTyped(json, false); } 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 4b767465168..c447d2177eb 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 @@ -46,6 +46,16 @@ export interface FindPetsByUserResponse { data?: Array; } +/** + * 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; +} + export function FindPetsByUserResponseFromJSON(json: any): FindPetsByUserResponse { return FindPetsByUserResponseFromJSONTyped(json, false); } 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 a53838a7464..a014973f3c1 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 @@ -40,6 +40,16 @@ export interface GetBehaviorPermissionsResponse { data?: { [key: string]: boolean; }; } +/** + * 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; +} + export function GetBehaviorPermissionsResponseFromJSON(json: any): GetBehaviorPermissionsResponse { return GetBehaviorPermissionsResponseFromJSONTyped(json, false); } 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 c770b29beb7..cc0e16870a3 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 @@ -46,6 +46,16 @@ export interface GetBehaviorTypeResponse { data?: BehaviorType; } +/** + * 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; +} + export function GetBehaviorTypeResponseFromJSON(json: any): GetBehaviorTypeResponse { return GetBehaviorTypeResponseFromJSONTyped(json, false); } 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 3690c3954f1..366d024067a 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 @@ -46,6 +46,16 @@ export interface GetMatchingPartsResponse { data?: MatchingParts; } +/** + * 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; +} + export function GetMatchingPartsResponseFromJSON(json: any): GetMatchingPartsResponse { return GetMatchingPartsResponseFromJSONTyped(json, false); } 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 9a70cdc1a69..b6209dfe4ab 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 @@ -46,6 +46,16 @@ export interface GetPetPartTypeResponse { data?: PetPartType; } +/** + * 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; +} + export function GetPetPartTypeResponseFromJSON(json: any): GetPetPartTypeResponse { return GetPetPartTypeResponseFromJSONTyped(json, false); } 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 53a7096ca28..d1ab620bef6 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 @@ -33,6 +33,17 @@ export interface ItemId { type: string; } +/** + * 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; +} + export function ItemIdFromJSON(json: any): ItemId { return ItemIdFromJSONTyped(json, false); } 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 70177cf458c..1621a559283 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 @@ -40,6 +40,17 @@ export interface MatchingParts { related: Array; } +/** + * 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; +} + export function MatchingPartsFromJSON(json: any): MatchingParts { return MatchingPartsFromJSONTyped(json, false); } 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 6812901c377..bf50981fc2e 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 @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 7a4c5b62d03..ceaaa3c9a48 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 @@ -52,6 +52,16 @@ export interface ModelError { exception?: string; } +/** + * 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; +} + export function ModelErrorFromJSON(json: any): ModelError { return ModelErrorFromJSONTyped(json, false); } 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 2e4f44f6469..0d69755d488 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 @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 13e324d63cd..bf4efc34277 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 @@ -33,6 +33,17 @@ export interface Part { name: string; } +/** + * 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; +} + export function PartFromJSON(json: any): Part { return PartFromJSONTyped(json, false); } 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 e1631e2599d..0a39eeb9227 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 @@ -184,6 +184,29 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 2a2c7fb6a51..2fde1f07af7 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 @@ -40,6 +40,16 @@ export interface PetRegionsResponse { data?: Array>; } +/** + * 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; +} + export function PetRegionsResponseFromJSON(json: any): PetRegionsResponse { return PetRegionsResponseFromJSONTyped(json, false); } 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 4a32a911488..a2dd4343a44 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 @@ -96,6 +96,16 @@ export const ResponseMetaCodeEnum = { export type ResponseMetaCodeEnum = typeof ResponseMetaCodeEnum[keyof typeof ResponseMetaCodeEnum]; +/** + * 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; +} + export function ResponseMetaFromJSON(json: any): ResponseMeta { return ResponseMetaFromJSONTyped(json, false); } 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 0c26039df46..e4902aa53cf 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 @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 5567e888fe0..ceeea254071 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 @@ -81,6 +81,17 @@ export interface User { subUser2: 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; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 fe0e21ffb8b..88256738720 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 @@ -33,6 +33,15 @@ export interface Category { name?: string; } +/** + * Check if a given object implements the Category interface. + */ +export function instanceOfCategory(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 6812901c377..bf50981fc2e 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 @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 2e4f44f6469..0d69755d488 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 @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 1866bcb149e..9d8c7c9d496 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 @@ -82,6 +82,17 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 0c26039df46..e4902aa53cf 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 @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 89a7de983b0..f22da928907 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 @@ -69,6 +69,15 @@ export interface User { userStatus?: number; } +/** + * Check if a given object implements the User interface. + */ +export function instanceOfUser(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 fe0e21ffb8b..88256738720 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 @@ -33,6 +33,15 @@ export interface Category { name?: string; } +/** + * Check if a given object implements the Category interface. + */ +export function instanceOfCategory(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function CategoryFromJSON(json: any): Category { return CategoryFromJSONTyped(json, false); } 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 6812901c377..bf50981fc2e 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 @@ -39,6 +39,15 @@ export interface ModelApiResponse { message?: string; } +/** + * Check if a given object implements the ModelApiResponse interface. + */ +export function instanceOfModelApiResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function ModelApiResponseFromJSON(json: any): ModelApiResponse { return ModelApiResponseFromJSONTyped(json, false); } 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 2e4f44f6469..0d69755d488 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 @@ -69,6 +69,15 @@ export const OrderStatusEnum = { export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnum]; +/** + * Check if a given object implements the Order interface. + */ +export function instanceOfOrder(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function OrderFromJSON(json: any): Order { return OrderFromJSONTyped(json, false); } 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 1866bcb149e..9d8c7c9d496 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 @@ -82,6 +82,17 @@ export const PetStatusEnum = { 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; +} + export function PetFromJSON(json: any): Pet { return PetFromJSONTyped(json, false); } 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 0c26039df46..e4902aa53cf 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 @@ -33,6 +33,15 @@ export interface Tag { name?: string; } +/** + * Check if a given object implements the Tag interface. + */ +export function instanceOfTag(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function TagFromJSON(json: any): Tag { return TagFromJSONTyped(json, false); } 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 89a7de983b0..f22da928907 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 @@ -69,6 +69,15 @@ export interface User { userStatus?: number; } +/** + * Check if a given object implements the User interface. + */ +export function instanceOfUser(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function UserFromJSON(json: any): User { return UserFromJSONTyped(json, false); } 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 463eadb6d55..2725f3c2b89 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 @@ -58,6 +58,15 @@ export interface EnumPatternObject { nullableNumberEnum?: NumberEnum | null; } +/** + * Check if a given object implements the EnumPatternObject interface. + */ +export function instanceOfEnumPatternObject(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function EnumPatternObjectFromJSON(json: any): EnumPatternObject { return EnumPatternObjectFromJSONTyped(json, false); } 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 7f67ccd698c..103f45f57d9 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 @@ -83,6 +83,15 @@ export enum FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum { } +/** + * Check if a given object implements the FakeEnumRequestGetInline200Response interface. + */ +export function instanceOfFakeEnumRequestGetInline200Response(value: object): boolean { + let isInstance = true; + + return isInstance; +} + export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnumRequestGetInline200Response { return FakeEnumRequestGetInline200ResponseFromJSONTyped(json, false); }