Max
cae78c5fe7
fix: place @JsonSerializable on factory constructor for Freezed compatibility
2025-12-12 12:30:22 +08:00
Max
1231af9f0b
feat: support json_serializable configuration (checked, explicit_to_json) in generated models
2025-12-12 11:25:57 +08:00
Max
0b20ad6ab5
fix: use _getDartTypeForParameter to correctly resolve enum types in parameters
2025-12-12 10:54:51 +08:00
Max
ceb91a0ea3
fix: recursively search for package_config.json to support workspace resolution
2025-12-12 10:49:21 +08:00
Max
3182cf330f
feat: 修正地址问题
2025-12-12 10:30:47 +08:00
Max
2838f00795
refactor: 代码格式优化和测试更新
...
🔧 代码优化
- 优化代码格式,去除多余空行
- 改进枚举映射配置解析逻辑
- 优化字符串处理
📝 配置更新
- example/generator_config.yaml: 添加 v3 swagger URL 配置
✅ 测试更新
- 更新分页包裹测试
- 更新文本清理测试
2025-12-03 17:25:25 +08:00
Max
15463bfc74
fix: template bugs
2025-11-24 13:43:15 +08:00
Max
111375b749
feat: 实现枚举配置文件映射和UNKNOWN枚举值
...
✨ 新功能
- 支持通过 generator_config.yaml 配置枚举键名映射
- 实现三级优先级:配置文件 > x-enum-varnames > 智能生成
- 自动为所有枚举添加 UNKNOWN 值(整数用-9999,字符串用'UNKNOWN')
- fromValue 方法改为返回 UNKNOWN 而不是抛异常,提供更好的容错性
🔧 核心修改
- lib/core/config_repository.dart: 添加 EnumKeyMapping 和 enumKeyMappings 解析
- lib/core/config.dart: 暴露枚举映射配置
- lib/pipeline/generate/impl/model/model_content_builders.dart: 实现三级优先级枚举生成和 UNKNOWN 值
- lib/core/models/api_schema.dart: 支持 x-enum-varnames 和 x-enum-descriptions 扩展字段
- lib/pipeline/generate/impl/retrofit_api/api_return_types.dart: 修复 BasePageResult 包裹逻辑
📚 文档更新
- 新增 ENUM_QUICK_REFERENCE.md: 快速参考指南
- 新增 ENUM_KEY_NAMES_USAGE.md: 详细使用指南
- 新增 ENUM_CONFIG_MAPPING_SUMMARY.md: 功能实现总结
- 新增 ENUM_KEY_NAMES_PROPOSAL.md: 技术提案
- 更新 README.md 和 CHANGELOG.md
- 更新 generator_config.template.yaml 添加配置示例
📦 示例文件
- example/swagger_enum_example.json: Swagger 扩展字段示例
- example/enum_config_mapping_example.yaml: 完整配置示例
✅ 测试验证
- test/pagination_wrapping_test.dart: BasePageResult 包裹测试
- 功能已通过实际生成测试验证
🎯 使用场景
1. 后端支持 OpenAPI 扩展 → 使用 x-enum-varnames
2. 后端不支持扩展 → 使用配置文件映射
3. 需要覆盖 Swagger → 使用配置文件映射
4. 快速原型开发 → 使用智能生成
2025-11-24 10:47:17 +08:00
Max
d6a31d5a24
feat: update
2025-11-23 14:11:16 +08:00
Max
53f89940ed
fix(refactor): correct import paths after pipeline migration
...
- Updated all internal import statements to point to the new 'pipeline' directory structure.
- Resolved all 'uri_does_not_exist' and 'undefined_class' errors caused by the refactoring.
- The project now passes 'dart analyze' with no errors.
2025-11-23 10:04:02 +08:00
Max
7627236650
refactor(pipeline): 迁移generators模块到pipeline结构
...
- 将 base_generator.dart, model_code_generator.dart, retrofit_api_generator.dart 及其 part 文件物理迁移到 lib/pipeline/generate/impl/ 目录。
- 在原 lib/generators/ 目录下保留向后兼容的导出 shim 文件。
- 修复了因文件移动导致的 part of 路径问题和 mixin 引用失效问题。
质量门禁:
- dart analyze: 0 error / 0 warning (info only)
- dart test: all pass
2025-11-22 22:11:12 +08:00
Max
ceab0b6f19
方案 C(激进)Phase 2:物理迁移(首批)
...
- parse:迁移 swagger_fetcher / swagger_data_parser 至 lib/pipeline/parse/impl/*,原位置保留兼容导出
- validate:迁移 schema_validator / enhanced_validator 至 lib/pipeline/validate/impl/*,原位置保留兼容导出
- pipeline 层维持 re-export,确保外部与内部导入路径均可用
质量门禁:
- dart analyze:0 error / 0 warning(仅 info)
- dart test:全部通过(203/203)
后续计划:
- 视风险逐步评估 generate/render/output 的物理迁移(含 part 文件),保持每步可回滚
2025-11-22 21:41:42 +08:00
Max
a9de0e72d9
方案 C(激进)第一步:引入 pipeline 目录的导入别名层
...
- 新增 lib/pipeline/**(parse/validate/generate/render/output)各阶段 re-export 文件
- 不改动现有实现与导入,仅提供流程化导入入口(零行为变更)
- 后续可在别名层稳定的前提下,逐步迁移物理文件(parse/validate/generate/render/output)
质量门禁:
- dart analyze:0 error / 0 warning(仅 info)
- dart test:全部通过(203/203)
2025-11-22 21:10:15 +08:00