Setting dateLibrary=java11 fails to map "java.time" types
还没有人认领这个 Issue。
评估
调研方向
阅读 AbstractJavaCodegen.java 第 488–515 行附近的内容,然后检查 processOpts() 和现有的 dateLibrary 分支。查看 java11 选项的描述方式,以及相关日期库的日期映射和 imports 配置方式。完成标准是:选择 dateLibrary=java11 后,无需单独设置 java11=true 选项,即可配置预期的 java.time 映射和 imports。
由索引模型根据 Issue 内容生成。
描述
In the above source code of AbstractJavaCodegen, the dateLibrary enum registers "java11" in the CLI options list. However, the processOpts() method only checks for "threetenbp", "joda", dateLibrary.startsWith("java8"), and "legacy":
• Missing if branch. Because there is no else if ("java11".equals(dateLibrary)) block in AbstractJavaCodegen.processOpts(), the generator skips setting up java.time type mappings and imports.
• Fallback to java.util.Date. By default, AbstractJavaCodegen initializes typeMapping.put("date", "Date"), which resolves to java.util.Date when no dateLibrary branch overrides it.
• Flag discrepancy. Although the CLI description claims "java11" automatically sets java11=true, the code only reads java11 if you explicitly pass true in your configuration.
This leads to the required strange combination of configuration options:
<configOptions>
<!-- don't use "java11" - a bug in swagger lets this fall back to "legacy" -->
<dateLibrary>java8</dateLibrary>
<java11>true</java11>
<jakarta>true</jakarta>
</configOptions>
- 主要语言
- Mustache
- 星标
- 299
- 派生
- 439
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
swagger-api/swagger-codegen-generators 的其他 Issue
-
[Bug]: Python/pythonFlaskConnexion generators validate map keys instead of values for additionalProperties.enum可能已有人在做 @pvillard31 于 208 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
[Bug]: Bean validation doesn't work for numbers larger than Integer.MAX_VALUE可能已有人在做 @apupier 于 296 天前认领。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 68/100
swagger-api/swagger-codegen-generators#1370 · 3 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 64/100
-
难度 1/5 1-3 小时 新手友好度 72/100
查看 swagger-api/swagger-codegen-generators 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
ROCm/rocm-libraries#15665 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
shadps4-emu/shadPS4#5705 ·
维护者通常 1 天内回复
-
bug multiple issues priority: high
难度 2/5 1-3 小时 新手友好度 78/100
storytold/gridcraft#3928 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
Qiskit/qiskit-aer#2533 ·
维护者通常 1 天内回复