Skip to content

Commit

Permalink
[typescript-fetch] Fix API-generation of referenced enums for multipa…
Browse files Browse the repository at this point in the history
…rt/form-data (#19016)

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

* [typescript-fetch] re-generate samples
  • Loading branch information
Masamas authored Jul 2, 2024
1 parent daa4886 commit 5d61f71
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export interface AllOfWithSingleRef {
singleRefType?: SingleRefType;
}



/**
* Check if a given object implements the AllOfWithSingleRef interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export interface OuterObjectWithEnumProperty {
value: OuterEnumInteger;
}



/**
* Check if a given object implements the OuterObjectWithEnumProperty interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export interface EnumPatternObject {
nullableNumberEnum?: NumberEnum | null;
}



/**
* Check if a given object implements the EnumPatternObject interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export interface GetBehaviorTypeResponse {
data?: BehaviorType;
}



/**
* Check if a given object implements the GetBehaviorTypeResponse interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export interface GetPetPartTypeResponse {
data?: PetPartType;
}



/**
* Check if a given object implements the GetPetPartTypeResponse interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export interface AllOfWithSingleRef {
singleRefType?: SingleRefType;
}



/**
* Check if a given object implements the AllOfWithSingleRef interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export interface OuterObjectWithEnumProperty {
value: OuterEnumInteger;
}



/**
* Check if a given object implements the OuterObjectWithEnumProperty interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export interface EnumPatternObject {
nullableNumberEnum?: NumberEnum | null;
}



/**
* Check if a given object implements the EnumPatternObject interface.
*/
Expand Down

0 comments on commit 5d61f71

Please sign in to comment.