[typescript-fetch] Fix API-generation of referenced enums for multipart/form-data (#19016)

* [typescript-fetch] Fix API-generation of referenced enums

* [typescript-fetch] re-generate samples
This commit is contained in:
Aron Wachter 2024-07-02 15:07:33 +02:00 committed by GitHub
parent daa4886865
commit 5d61f71cdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 23 additions and 0 deletions

View File

@ -1120,6 +1120,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
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 class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
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;

View File

@ -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}}
}

View File

@ -40,6 +40,8 @@ export interface AllOfWithSingleRef {
singleRefType?: SingleRefType;
}
/**
* Check if a given object implements the AllOfWithSingleRef interface.
*/

View File

@ -34,6 +34,8 @@ export interface OuterObjectWithEnumProperty {
value: OuterEnumInteger;
}
/**
* Check if a given object implements the OuterObjectWithEnumProperty interface.
*/

View File

@ -58,6 +58,8 @@ export interface EnumPatternObject {
nullableNumberEnum?: NumberEnum | null;
}
/**
* Check if a given object implements the EnumPatternObject interface.
*/

View File

@ -46,6 +46,8 @@ export interface GetBehaviorTypeResponse {
data?: BehaviorType;
}
/**
* Check if a given object implements the GetBehaviorTypeResponse interface.
*/

View File

@ -46,6 +46,8 @@ export interface GetPetPartTypeResponse {
data?: PetPartType;
}
/**
* Check if a given object implements the GetPetPartTypeResponse interface.
*/

View File

@ -40,6 +40,8 @@ export interface AllOfWithSingleRef {
singleRefType?: SingleRefType;
}
/**
* Check if a given object implements the AllOfWithSingleRef interface.
*/

View File

@ -34,6 +34,8 @@ export interface OuterObjectWithEnumProperty {
value: OuterEnumInteger;
}
/**
* Check if a given object implements the OuterObjectWithEnumProperty interface.
*/

View File

@ -58,6 +58,8 @@ export interface EnumPatternObject {
nullableNumberEnum?: NumberEnum | null;
}
/**
* Check if a given object implements the EnumPatternObject interface.
*/