diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index ca8e83e56582..28b7d136d16a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -1120,6 +1120,7 @@ public ExtendedCodegenParameter(CodegenParameter cp) { this.isMap = cp.isMap; this.isFile = cp.isFile; this.isEnum = cp.isEnum; + this.isEnumRef = cp.isEnumRef; this._enum = cp._enum; this.allowableValues = cp.allowableValues; this.items = cp.items; @@ -1280,6 +1281,7 @@ public ExtendedCodegenProperty(CodegenProperty cp) { this.isArray = cp.isArray; this.isMap = cp.isMap; this.isEnum = cp.isEnum; + this.isEnumRef = cp.isEnumRef; this.isReadOnly = cp.isReadOnly; this.isWriteOnly = cp.isWriteOnly; this.isNullable = cp.isNullable; 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 fef5aff07b0f..53276d5bf061 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -260,11 +260,16 @@ export class {{classname}} extends runtime.BaseAPI { formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any); {{/isPrimitiveType}} {{^isPrimitiveType}} + {{#isEnumRef}} + formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any); + {{/isEnumRef}} + {{^isEnumRef}} {{^withoutRuntimeChecks}} 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", })); {{/withoutRuntimeChecks}} + {{/isEnumRef}} {{/isPrimitiveType}} {{/isDateTimeType}} } 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 2b247b983ffb..4d81b3f96989 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,8 @@ export interface AllOfWithSingleRef { singleRefType?: SingleRefType; } + + /** * Check if a given object implements the AllOfWithSingleRef interface. */ 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 c8ca1734039f..47e184b3414a 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,8 @@ export interface OuterObjectWithEnumProperty { value: OuterEnumInteger; } + + /** * Check if a given object implements the OuterObjectWithEnumProperty interface. */ 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 fc2c493f04cb..576b5fde62da 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,8 @@ export interface EnumPatternObject { nullableNumberEnum?: NumberEnum | null; } + + /** * Check if a given object implements the EnumPatternObject interface. */ 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 5de27f58461d..f3d8f640f8bd 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,8 @@ export interface GetBehaviorTypeResponse { data?: BehaviorType; } + + /** * Check if a given object implements the GetBehaviorTypeResponse interface. */ 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 16ec39476732..5e2f514633cf 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,8 @@ export interface GetPetPartTypeResponse { data?: PetPartType; } + + /** * Check if a given object implements the GetPetPartTypeResponse interface. */ 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 2b247b983ffb..4d81b3f96989 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 @@ -40,6 +40,8 @@ export interface AllOfWithSingleRef { singleRefType?: SingleRefType; } + + /** * Check if a given object implements the AllOfWithSingleRef interface. */ 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 c8ca1734039f..47e184b3414a 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 @@ -34,6 +34,8 @@ export interface OuterObjectWithEnumProperty { value: OuterEnumInteger; } + + /** * Check if a given object implements the OuterObjectWithEnumProperty interface. */ 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 fc2c493f04cb..576b5fde62da 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,8 @@ export interface EnumPatternObject { nullableNumberEnum?: NumberEnum | null; } + + /** * Check if a given object implements the EnumPatternObject interface. */