@@ -70,6 +70,7 @@ else if (isNodeProject) {
7070| ` isCamelCase ` | boolean | ` true ` | Use camelCase naming | Consistent naming |
7171| ` isSupportParseEnumDesc ` | boolean | ` false ` | Parse enum descriptions | Labeled enums |
7272| ` supportParseEnumDescByReg ` | ` string \| RegExp ` | - | Custom regex for parsing enum descriptions. If set, replaces default parseDescriptionEnum method. Example: ` /([^\s=<>/&;]+(?:\s+[^\s=<>/&;]+)*)\s*=\s*(\d+)/g ` matches "普通 = 0" or "SampleMaker = 1" | Custom enum description formats |
73+ | ` isSplitTypesByModule ` | boolean | ` false ` | Split types by module, generates {module}.type.ts, common.type.ts, enum.ts, types.ts | Large projects with many types |
7374
7475#### Request Customization
7576
@@ -122,6 +123,7 @@ else if (isNodeProject) {
122123| "自定义枚举解析正则" | ` supportParseEnumDescByReg: /pattern/g ` | Custom enum description parsing |
123124| "生成JSON验证" | ` isGenJsonSchemas: true ` | Schema validation |
124125| "前缀API路径" | ` apiPrefix: "'api'" ` | Add prefix to paths |
126+ | "按模块拆分类型" | ` isSplitTypesByModule: true ` | Large projects, better code organization |
125127
126128## 📋 Common Configuration Scenarios
127129
@@ -277,6 +279,24 @@ else if (isNodeProject) {
277279}
278280```
279281
282+ ### Scenario 11: Large Project with Module-Based Type Splitting
283+
284+ ``` typescript
285+ {
286+ schemaPath : " ./openapi.json" ,
287+ serversPath : " ./src/apis" ,
288+ isSplitTypesByModule : true , // Split types by module
289+ isGenReactQuery : true ,
290+ isDisplayTypeLabel : true ,
291+ isCamelCase : true ,
292+ // Generates:
293+ // - {module}.type.ts (module-specific types)
294+ // - common.type.ts (shared types)
295+ // - enum.ts (all enums)
296+ // - types.ts (unified export)
297+ }
298+ ```
299+
280300## ⚠️ Configuration Conflicts & Rules
281301
282302### ❌ Incompatible Combinations
@@ -304,6 +324,7 @@ else if (isNodeProject) {
304324- ** Development** : ` mockFolder + enableLogging + full: false `
305325- ** International** : ` isTranslateToEnglishTag + isDisplayTypeLabel + isSupportParseEnumDesc `
306326- ** Type-only libraries** : ` isOnlyGenTypeScriptType + isGenJsonSchemas + namespace `
327+ - ** Large projects** : ` isSplitTypesByModule: true + isGenReactQuery + isDisplayTypeLabel `
307328
308329## 🔧 Advanced Customization Hooks
309330
@@ -546,6 +567,8 @@ export const ${api.functionName} = async (${api.params}) => {
546567
547568## 📁 Generated File Structure
548569
570+ ### Default Structure (isSplitTypesByModule: false)
571+
549572```
550573src/apis/
551574├── index.ts # Main entry point with all exports
@@ -560,6 +583,25 @@ src/apis/
560583 └── ...
561584```
562585
586+ ### Module-Based Structure (isSplitTypesByModule: true)
587+
588+ ```
589+ src/apis/
590+ ├── index.ts # Main entry point with all exports
591+ ├── types.ts # Unified type exports
592+ ├── enum.ts # All enum type definitions
593+ ├── common.type.ts # Shared/common types used by multiple modules
594+ ├── [module].type.ts # Module-specific types (e.g., user.type.ts, order.type.ts)
595+ ├── [controller].ts # API functions grouped by tags
596+ ├── displayTypeLabel.ts # Chinese field labels (if enabled)
597+ ├── displayEnumLabel.ts # Enum translations (if enabled)
598+ ├── schema.ts # JSON Schemas (if enabled)
599+ ├── reactquery.ts # React Query hooks (if enabled)
600+ └── mocks/ # Mock data files (if enabled)
601+ ├── [endpoint].mock.ts
602+ └── ...
603+ ```
604+
563605## 🚀 Performance Optimization Tips
564606
565607### For Large APIs (100+ endpoints)
0 commit comments