[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.isMap = cp.isMap;
this.isFile = cp.isFile; this.isFile = cp.isFile;
this.isEnum = cp.isEnum; this.isEnum = cp.isEnum;
this.isEnumRef = cp.isEnumRef;
this._enum = cp._enum; this._enum = cp._enum;
this.allowableValues = cp.allowableValues; this.allowableValues = cp.allowableValues;
this.items = cp.items; this.items = cp.items;
@ -1280,6 +1281,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.isArray = cp.isArray; this.isArray = cp.isArray;
this.isMap = cp.isMap; this.isMap = cp.isMap;
this.isEnum = cp.isEnum; this.isEnum = cp.isEnum;
this.isEnumRef = cp.isEnumRef;
this.isReadOnly = cp.isReadOnly; this.isReadOnly = cp.isReadOnly;
this.isWriteOnly = cp.isWriteOnly; this.isWriteOnly = cp.isWriteOnly;
this.isNullable = cp.isNullable; this.isNullable = cp.isNullable;

View File

@ -260,11 +260,16 @@ export class {{classname}} extends runtime.BaseAPI {
formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any); formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any);
{{/isPrimitiveType}} {{/isPrimitiveType}}
{{^isPrimitiveType}} {{^isPrimitiveType}}
{{#isEnumRef}}
formParams.append('{{baseName}}', requestParameters['{{paramName}}'] as any);
{{/isEnumRef}}
{{^isEnumRef}}
{{^withoutRuntimeChecks}} {{^withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", })); formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
{{/withoutRuntimeChecks}}{{#withoutRuntimeChecks}} {{/withoutRuntimeChecks}}{{#withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", })); formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", }));
{{/withoutRuntimeChecks}} {{/withoutRuntimeChecks}}
{{/isEnumRef}}
{{/isPrimitiveType}} {{/isPrimitiveType}}
{{/isDateTimeType}} {{/isDateTimeType}}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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