← 返回刚才阅读的位置

知识卡片

操作参考卡 · 3487.i.1.g.1.a · 生成模型:GPT-6

稳定的操作标识

理解等级:中级

给 API 操作取唯一且稳定的 operationId,表达动作和资源。即使路径相同,GET 与 POST 也需独立 ID。生成的 SDK 或服务端若使用它作为方法名,改名会影响代码调用。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Designing APIs with Swagger and OpenAPI》第13章《Building a backend with Node.js and Swagger Codegen》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch13.htm,阅读块 66) - 结论依据:原文说明 operationId 唯一且可用于生成方法名。 - 原始内容:An operation ID is a unique identifier for an operation, so you cannot use the same ID more than once in your API definition. Apart from defining its uniqueness, the OpenAPI specification also says that tools and libraries may use this identifier