File tree Expand file tree Collapse file tree 2 files changed +9
-63
lines changed
test/__snapshots__/common Expand file tree Collapse file tree 2 files changed +9
-63
lines changed Original file line number Diff line number Diff line change 66 entries ,
77 filter ,
88 find ,
9+ findIndex ,
910 forEach ,
1011 isArray ,
1112 isEmpty ,
@@ -652,7 +653,6 @@ export default class ServiceGenerator {
652653 newApi . requestBody as RequestBodyObject
653654 ) ;
654655 const response = this . getResponseTP ( newApi . responses ) ;
655- // console.log(this.resolveObject(newApi.responses))
656656 const file = this . getFileTP (
657657 newApi . requestBody as RequestBodyObject
658658 ) ;
@@ -699,11 +699,8 @@ export default class ServiceGenerator {
699699
700700 // 如果有多个响应类型,生成对应的类型定义
701701 if ( responsesType ) {
702- const responsesTypeName = upperFirst (
703- `${ functionName } Responses`
704- ) ;
705702 this . interfaceTPConfigs . push ( {
706- typeName : responsesTypeName ,
703+ typeName : upperFirst ( ` ${ functionName } Responses` ) ,
707704 type : responsesType ,
708705 isEnum : false ,
709706 props : [ ] ,
@@ -1124,7 +1121,13 @@ export default class ServiceGenerator {
11241121 responses : ResponsesObject = { } ,
11251122 functionName : string
11261123 ) {
1127- if ( isEmpty ( responses ) ) {
1124+ if (
1125+ isEmpty ( responses ) ||
1126+ ~ findIndex (
1127+ this . interfaceTPConfigs ,
1128+ ( item ) => item . typeName === upperFirst ( `${ functionName } Responses` )
1129+ )
1130+ ) {
11281131 return null ;
11291132 }
11301133
Original file line number Diff line number Diff line change @@ -389,63 +389,6 @@ export type PetUsingPutResponses = {
389389 405: unknown ;
390390};
391391
392- export type PetUsingPutResponses2 = {
393- /**
394- * Successful operation
395- */
396- 200: Pet ;
397- /**
398- * Invalid ID supplied
399- */
400- 400: unknown ;
401- /**
402- * Pet not found
403- */
404- 404: unknown ;
405- /**
406- * Validation exception
407- */
408- 405: unknown ;
409- };
410-
411- export type PetUsingPutResponses3 = {
412- /**
413- * Successful operation
414- */
415- 200: Pet ;
416- /**
417- * Invalid ID supplied
418- */
419- 400: unknown ;
420- /**
421- * Pet not found
422- */
423- 404: unknown ;
424- /**
425- * Validation exception
426- */
427- 405: unknown ;
428- };
429-
430- export type PetUsingPutResponses4 = {
431- /**
432- * Successful operation
433- */
434- 200: Pet ;
435- /**
436- * Invalid ID supplied
437- */
438- 400: unknown ;
439- /**
440- * Pet not found
441- */
442- 404: unknown ;
443- /**
444- * Validation exception
445- */
446- 405: unknown ;
447- };
448-
449392export enum StatusEnum {
450393 ' placed' = ' placed' ,
451394 ' approved' = ' approved' ,
You can’t perform that action at this time.
0 commit comments