1- import { isEmpty , map } from 'lodash' ;
1+ import { isEmpty , isObject , isString , map } from 'lodash' ;
22
33import { PriorityRule , ReactQueryMode } from './config' ;
44import type { TypescriptFileType } from './generator/config' ;
@@ -301,7 +301,13 @@ export async function generateService({
301301 }
302302
303303 if ( isTranslateToEnglishTag ) {
304- await translateChineseModuleNodeToEnglish ( openAPI ) ;
304+ const res = await translateChineseModuleNodeToEnglish ( openAPI ) ;
305+
306+ if ( isObject ( res ) && ! isEmpty ( includeTags ) ) {
307+ includeTags = map ( includeTags , ( item ) => {
308+ return isString ( item ) ? res [ item ] || item : item ;
309+ } ) ;
310+ }
305311 }
306312
307313 const requestImportStatement = getImportStatement ( requestLibPath ) ;
@@ -314,28 +320,28 @@ export async function generateService({
314320 priorityRule,
315321 includeTags : includeTags
316322 ? map ( includeTags , ( item ) =>
317- typeof item === 'string' ? item . toLowerCase ( ) : item
323+ isString ( item ) ? item . toLowerCase ( ) : item
318324 )
319325 : priorityRule === PriorityRule . include ||
320326 priorityRule === PriorityRule . both
321327 ? [ / .* / g]
322328 : null ,
323329 includePaths : includePaths
324330 ? map ( includePaths , ( item ) =>
325- typeof item === 'string' ? item . toLowerCase ( ) : item
331+ isString ( item ) ? item . toLowerCase ( ) : item
326332 )
327333 : priorityRule === PriorityRule . include ||
328334 priorityRule === PriorityRule . both
329335 ? [ / .* / g]
330336 : null ,
331337 excludeTags : excludeTags
332338 ? map ( excludeTags , ( item ) =>
333- typeof item === 'string' ? item . toLowerCase ( ) : item
339+ isString ( item ) ? item . toLowerCase ( ) : item
334340 )
335341 : null ,
336342 excludePaths : excludePaths
337343 ? map ( excludePaths , ( item ) =>
338- typeof item === 'string' ? item . toLowerCase ( ) : item
344+ isString ( item ) ? item . toLowerCase ( ) : item
339345 )
340346 : null ,
341347 requestOptionsType : '{[key: string]: unknown}' ,
0 commit comments