OpenAPI重复路径

发布于 2025-01-23 02:31:36 字数 169 浏览 3 评论 0原文

OAS 3.0规范中有两条路径。从技术上讲,这两者似乎都是相同的,我需要确认两者是否相同。 如果是,为什么没有任何工具验证这些类型的路径重复。

/foo/{whatever}

/{whatever}/foo

There are two paths in an OAS 3.0 specification. Technically both seem to be identical, I need to confirm if indeed both are identical.
If yes, why none of the tools out there validates these types of paths duplication.

/foo/{whatever}

and

/{whatever}/foo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

骑趴 2025-01-30 02:31:36

OpenAPI规范只有这样说:
https://spec.openapis.org/oas/v3。 0.1.html#路径 - 检测匹配

以下可能导致模棱两可的分辨率:

 /{entity}/me
/books/{id}
 

也就是说,这些路径不是相同的,而是导致工具中模棱两可的路径匹配,尤其是在两种路径支持相同的HTTP方法的情况下。但是,如果模棱两可的路径支持不同的HTTP方法(例如,一种是仅仅是后期的,而另一种是仅后的),则这将消除歧义。

OpenAPI Specification only has this to say:
https://spec.openapis.org/oas/v3.0.1.html#path-templating-matching

The following may lead to ambiguous resolution:

/{entity}/me
/books/{id}

That is, these paths are not considered identical, but can result in ambiguous path matching in tooling, especially if both paths support the same HTTP methods. However, if the ambiguous paths support different HTTP methods (e.g. one is GET-only, whereas the other one is POST-only), this would eliminate the ambiguity.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文