api-contract-change-end-to-end
Use this when changing REST endpoints so Rust DTOs, UI DTOs, OpenAPI, and docs stay in sync.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Goal
Make API changes once, but keep all consumers consistent (CLI/server, UI, docs).
Checklist
- Locate the endpoint
- Routing/handlers:
src/routes.rs,src/api_server.rs,src/web_server.rs
- Update Rust contract types
- DTOs:
src/api_types.rs - If you adjust validation/errors, keep behavior consistent with existing API error shapes (
src/errors.rs).
- Update UI types + API client
- DTOs:
view/api/types.ts(explicit note at top: aligned withsrc/api_types.rs) - Calls:
view/api/client.ts
- Update OpenAPI + help docs
- REST schema:
docs/openapi.json - If it’s user-visible, update relevant guides under
docs/help/*(oftendocs/help/api-quick-reference.md, plus the feature-specific page).
- Add/adjust tests
- Rust behavior:
tests/*.rs(integration-heavy, many useassert_cmd). - UI behavior:
npm run test:ui(Vitest). - Cross-cutting behavior: consider adding/updating smoke coverage under
smoke/tests/.
- Verify locally (CI parity)
-
npm run lint -
npm test -
npm run smoke
Notes
- Treat this repo as “contract-synchronized”: changing just one of Rust/UI/OpenAPI will likely break users or tests.
- Prefer incremental changes that preserve backwards compatibility for existing clients when practical.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!