@@ -394,7 +394,7 @@ export default class ServiceGenerator {
394394
395395 const tags = hookCustomFileNames ( operationObject , pathKey , method ) ;
396396
397- if ( isEmpty ( includeTags ) || isEmpty ( tags ) ) {
397+ if ( isEmpty ( includeTags ) || ( ! isEmpty ( includeTags ) && isEmpty ( tags ) ) ) {
398398 return ;
399399 }
400400
@@ -453,6 +453,12 @@ export default class ServiceGenerator {
453453
454454 keys ( schemas ) . forEach ( ( schemaKey ) => {
455455 const schema = schemas [ schemaKey ] as ISchemaObject ;
456+
457+ // 判断哪些 schema 需要添加进 type, schemas 渲染数组
458+ if ( ! ( schema as ICustomSchemaObject ) ?. isAllowed ) {
459+ return ;
460+ }
461+
456462 const result = this . resolveObject ( schema ) as Dictionary <
457463 string | boolean | IPropObject [ ] [ ]
458464 > ;
@@ -488,38 +494,32 @@ export default class ServiceGenerator {
488494 } ) ;
489495 }
490496
491- // 判断哪些 schema 需要添加进 type, schemas 渲染数组
492- if (
493- isEmpty ( this . config . includeTags ) ||
494- ( schema as ICustomSchemaObject ) ?. isAllowed
495- ) {
496- const isEnum = result . isEnum as boolean ;
497- const typeName = resolveTypeName ( schemaKey ) ;
498-
499- if ( typeName ) {
500- lastTypes . push ( {
501- typeName,
502- type : getDefinesType ( ) ,
503- props : ( result . props || [ ] ) as IPropObject [ ] [ ] ,
504- isEnum,
505- displayLabelFuncName : isEnum
506- ? camelCase ( `display-${ typeName } -Enum` )
507- : '' ,
508- enumLabelType : isEnum ? ( result . enumLabelType as string ) : '' ,
509- } ) ;
510- }
497+ const isEnum = result . isEnum as boolean ;
498+ const typeName = resolveTypeName ( schemaKey ) ;
499+
500+ if ( typeName ) {
501+ lastTypes . push ( {
502+ typeName,
503+ type : getDefinesType ( ) ,
504+ props : ( result . props || [ ] ) as IPropObject [ ] [ ] ,
505+ isEnum,
506+ displayLabelFuncName : isEnum
507+ ? camelCase ( `display-${ typeName } -Enum` )
508+ : '' ,
509+ enumLabelType : isEnum ? ( result . enumLabelType as string ) : '' ,
510+ } ) ;
511+ }
511512
512- if ( this . config . isGenJsonSchemas ) {
513- this . schemaList . push ( {
514- typeName : `$${ resolveTypeName ( schemaKey ) } ` ,
515- type : JSON . stringify (
516- patchSchema < SchemaObject > (
517- schema ,
518- this . openAPIData . components ?. schemas
519- )
520- ) ,
521- } ) ;
522- }
513+ if ( this . config . isGenJsonSchemas ) {
514+ this . schemaList . push ( {
515+ typeName : `$${ resolveTypeName ( schemaKey ) } ` ,
516+ type : JSON . stringify (
517+ patchSchema < SchemaObject > (
518+ schema ,
519+ this . openAPIData . components ?. schemas
520+ )
521+ ) ,
522+ } ) ;
523523 }
524524 } ) ;
525525
0 commit comments