REST API 歧义和 WADL

发布于 2024-08-27 13:43:11 字数 711 浏览 8 评论 0原文

我有一个不明确的 REST api,类似于(这不是具体问题,只是给出了不明确的想法):

/toplevel/${customer_number}/some_command/more stuff
/toplevel/${customer_number}/${some_product_name_anything_goes}/more stuff

我们已经摆脱了它,因为我们的 .htaccess 文件之前列出了更具体的“命令”形式一般 ${product_name} 版本,第一个匹配获胜。不过现在,我们正在编写 WADL,并且正如您所料,我们在使用所选工具使用 WADL 时遇到了麻烦,因为 API 不明确。我的问题是:

a) WADL 规范是否说明它们是否可以有效地表示不明确的 API?

b) 工具支持 - 根据您的经验,工具是否会因为不明确的 WADL 而陷入困境? (如果允许 ambi.WADL,那么这些都是较弱的工具,但是,您希望安全起见)

c) 任何使用不明确的 REST api 的经验,尤其是关于 WADL 的经验,真的。

对于好奇的人,这是最新规范

据我所知,它并没有专门解决这个问题,我想这实际上取决于工具如何处理它。

I have a REST api that's ambiguous, something like (this isn't the specific problem, just gives an idea of the ambiguity):

/toplevel/${customer_number}/some_command/more stuff
/toplevel/${customer_number}/${some_product_name_anything_goes}/more stuff

We've been getting away with it because our .htaccess file lists the more specific 'command' form before the general ${product_name} version, and the first match wins. Now though, we're writing a WADL, and, as you might expect, we're having trouble with our chosen tool consuming the WADL, because the API is ambiguous. My questions are:

a) Does the WADL spec speak to whether they can validly represent ambiguous APIs?

b) Tool support - in your experience, do tools choke on ambiguous WADLs? (if ambi. WADLs are allowed then those are weak tools but, you'd want to be on the safe side)

c) Just any experience with ambiguous REST apis, most especially wrt WADLs, really.

For the curious, here's the latest spec:

As far as I can tell it doesn't specifically address this, I guess it really comes down to how tools handle it.

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

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

发布评论

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

评论(1

绻影浮沉 2024-09-03 13:43:11

根据我的经验,大多数在 REST 中进行大量工作的人更喜欢使用超媒体进行运行时发现,而不是针对元数据文档使用工具和代码生成。

可能正是由于这个原因,您没有就您的问题获得太多意见。

It is my experience that most people who are doing any serious amount of work in REST would prefer to use hypermedia for runtime discovery than using tooling and code gen against a metadata document.

It may be for this reason that you are not getting much input on your issue.

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