Merged
refactor(java-sdk): 对齐公开 API 并完善文档与示例 #386
refactor(java-sdk): 对齐公开 API 并完善文档与示例 #386
Merged
machuanAdd on 17 days ago
machuan
machuanCollaborators
17 days ago

Paired: GitHub #190 ↔ GitCode !386

What type of PR is this?

/kind refactor

Self-checklist:(请自检,在[ ]内打上x,我们将检视你的完成情况,否则会导致pr无法合入)

  • 将 A4pIntentCodec 从接口改为提供标准实现的具体类,整合原 CanonicalIntentCodec,收敛 CanonicalJson 的可见性
  • 补充编解码一致性检查及测试,调整生命周期和编解码测试以适配 API
  • 将 RSA3072 签名与验签适配器及测试迁移到独立 examples 模块,校验规范的无填充 Base64URL 签名编码
  • 为 SDK API、模型及相关实现补充英文 Javadoc,配置 Maven 生成 HTML 文档并在打包时附带 Javadoc JAR,新增 build.sh docs 模式
  • 新增中英文公开 API 与使用约束文档,以序列化与签名规则文档替换原 canonical-json-spec,说明 JCS 规范化、各层签名范围及验签流程
  • 同步中英文 README,更新构建、文档生成、示例运行和 API 使用说明
likedislike
Pull Request has been successfully merged by openJiuwen-bot.
(Thank you for machuan's contribution.)
atomgit-bot
atomgit-bot
17 days ago Comments:

变更摘要

本 PR 主要围绕 Java SDK 的公开 API 对齐与文档完善展开:将 A4pIntentCodec 由接口收敛为可直接实例化的具体类并删除内部实现 CanonicalIntentCodec,收紧部分工具类的可见性,为 A4p、Models、A4pResult、Validation、Accounting 等公开类型补齐 Javadoc,同时通过 Maven 插件与构建脚本新增文档产出能力,并把示例与一致性校验工具从主代码中拆分为独立的 examples 模块。

主要改动

  • 编解码器 API 收敛:A4pIntentCodec 从 interface 改为具体 class,移除 static standard() 工厂方法,原 CanonicalIntentCodec.INSTANCE 的实现与内部 ContextJson、RecordJson 记录整体并入,调用方改为 new A4pIntentCodec()。
  • 公开面与可见性调整:CanonicalJson 由 public final class 改为包级私有的 final class,A4pResult.ok/failure 降为包级私有,同时新增公开构造器 A4pResult(boolean, T, long, String) 并对 status、payload、code 一致性做校验。
  • API 文档与文档构建:为生命周期方法、错误码、模型记录、校验与计账逻辑大量补充 Javadoc(含 @param/@return/@throws),pom.xml 新增 maven-javadoc-plugin(doclint all,-missing、failOnError true、attach-javadocs 绑定到 package),scripts/build.sh 增加 docs 模式生成英文 HTML 文档。
  • 示例拆分与去内部依赖:新增 examples/pom.xml 形成独立示例模块,Rsa3072 迁至 io.openjiuwen.a4p.examples 并移除对 Validation、CanonicalJson 的依赖,改为自实现 Base64URL 规范解码与参数校验,PaymentExample 改用实例化 codec 并做序列化往返校验,另新增 Rsa3072Test。
  • 新增 codec 一致性校验:新增 CodecConformanceCheck 命令行工具与配套 CodecConformanceCheckTest,用既有 L1/L2/L3 与 Context 向量比对自定义 A4pIntentCodec 实现与标准实现的行为是否一致。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
17 days ago Comments:

代码审查

审查结论

  • [建议] A4P-java-sdk/src/main/java/io/openjiuwen/a4p/A4pIntentCodec.java:18 fix: 将 A4pIntentCodec 由 interface 改为 public class 后未同步 docs 与一致性检查说明
类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论

likedislike
Incorrect?
OopenJiuwen-botCollaborators
17 days ago Set YiyangShao,xinyu-jiuwen as approver
atomgit-bot
atomgit-bot
17 days ago Comments:

AtomGit AI 助手使用指南

在 PR 评论中使用命令即可触发。支持在普通评论和代码行评论中使用。

功能 命令 说明
代码审查 /ai review 检查代码质量、潜在问题、安全风险
PR 摘要 /ai summary 生成 PR 变更内容的结构化摘要
代码解释 /ai explain 解释代码变更的逻辑和意图
自由提问 @atomgit-bot <问题> 询问关于本 PR 的任何问题
帮助 /ai help 显示此帮助信息

免责声明

AI 助手可能存在误判,请结合自身判断。可以对评论点 👍 或 👎 帮助我们改进。

likedislike
Incorrect?
OopenJiuwen-botCollaborators
17 days ago Added label: sig/sig-agent-protocol
60 messages are collapsed here。 See more
OopenJiuwen-botCollaborators
15 days ago Added label: approvedlgtm-mingo007
openJiuwen-botCollaborators
15 days ago Comments:

Review Code Feedback

  • The label lgtm-mingo007, approved was added to this pull request. It means that mingo007 reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄
likedislike
OopenJiuwen-botCollaborators
15 days ago Merged pull request
OopenJiuwen-botCollaborators
15 days ago Removed label: ci-successful
machuanmachuanCollaborators
14 days ago Associated issue: [Feature]: A4P 协议提供 java 版本 SDK