知识卡片
迁移Swagger组件与引用
升级 2.0 到 3.0 时需要同时迁移定义所在位置与引用目标。把 definitions 变成 components.schemas,更新所有 ref,检查 media type 和鉴权声明。只改根版本号会留下不兼容结构。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Appendix A. Swagger 2.0, OpenAPI 3.0, and OpenAPI 3.1 A.2 OpenAPI 2.0 (Swagger 2.0) · 查看原书依据
OAS 3.0 introduced the components keyword, which is a way to reuse different components within the API definition. Before that, OAS 2.0 used several root-level keywords to hold those components: definitions (renamed to schemas), parameters, responses, and securityDefinitions. These were combined in
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》附录 A《Appendix A. Swagger 2.0, OpenAPI 3.0, and OpenAPI 3.1》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/A.htm,阅读块 80)
- 结论依据:附录对照旧 definitions、参数、响应和安全定义在 components 中的位置。
- 原始内容:OAS 3.0 introduced the components keyword, which is a way to reuse different components within the API definition. Before that, OAS 2.0 used several root-level keywords to hold those components: definitions (renamed to schemas), parameters, responses, and securityDefinitions. These were combined in