1

我已经从 swagger-UI 导入了一个 API,并且能够创建一个 api 和产品,但是当我尝试发布时,我收到了这个错误。不能有多个具有相同 operationId 的操作:clearCache 不能有多个具有相同 operationId 的操作:getConfigurationJSON 任何帮助将不胜感激。

4

2 回答 2

3

如错误消息中所述,每个 operationId 在所有操作中必须是唯一的。以下 Swagger-API 问题和规范对此进行了进一步解释:

https://github.com/swagger-api/swagger-editor/issues/1146

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#fixed-fields-5

operationId:用于标识操作的唯一字符串。在 API 中描述的所有操作中,id 必须是唯一的。工具和库可以使用 operationId 来唯一标识一个操作,因此,建议遵循常见的编程命名约定。

于 2017-05-16T14:08:58.900 回答
0

如果添加 --skip-validation 标志,则只会生成 getByID 操作之一 https://github.com/swagger-api/swagger-editor/issues/1146#issuecomment-270006562

于 2020-02-14T07:15:48.227 回答