知识卡片
OpenAPI五部分分工
OpenAPI 文档用五部分组织接口契约:openapi 声明规范版本,info 给出 API 信息,servers 列访问地址,paths 描述端点和交互,components 收纳可复用模型等元素。把端点与复用定义分开,有助于读者定位接口和维护共同结构。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 5 章《Documenting REST APIs with OpenAPI》(源文件:_epub-src/OEBPS/Text/05.htm)
- 结论依据:原文逐项列出 OpenAPI 五个顶层部分及职责,并强调 paths 是消费者了解接口的中心,components 用于复用。
- 原始内容:As you can see in figure 5.1, an OpenAPI is structured around five sections: openapi —Indicates the version of OpenAPI that we used to produce the specification. info —Contains general information, such as the title and version of the API. servers —Contains a list of URLs where the API is available. ... paths —Describes the endpoints exposed by the API ... components —Defines reusable elements that are referenced across the specification