知识卡片
operationId标识操作
OpenAPI 可为每个路径与 HTTP 方法组成的操作填写 operationId,给操作一个可引用的名称。订单接口里的读取、创建、更新等端点因此能在文档其他位置被明确指向,而不只靠相似路径区分。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 5 章《Documenting REST APIs with OpenAPI》(源文件:_epub-src/OEBPS/Text/05.htm)
- 结论依据:原文在订单端点高层定义中为每个方法加 operationId,并说明目的是在文档其他部分引用它们。
- 原始内容:We declare the URLs and the HTTP implemented by each URL, and we add an operation ID to each endpoint so that we can reference them in other sections of the document. Listing 5.4 High-level definition of the orders API endpoints paths: /orders: ① get: ② operationId: getOrders post: # creates a new order operationId: createOrder