我被要求将HATEOAS作为rest的一部分来实现,这就是Swagger规范中如何定义响应的方法。
_links:
[
{
rel:
string
The relationship to the request e.g. self which contains the resource that was requested or {object name}, a link to a resource that is related to the requested resource
action:
[
{
httpVerb:
string
Allowed actions for this link based on the users permissions
Enum:
Array[4]
0:"GET"
1:"POST"
2:"PUT"
3:"DELETE"
}
]
href:
string
A fully qualified URL to the resource.
}
]
rel和href是有意义的,我可以找到这两个方面的许多例子,但我找不到任何行动。这是标准的一部分吗?我真的应该把它送回去吗?
我正在使用库,这肯定不支持操作。任何关于这方面的指导都将是值得赞赏的。
谢谢。
发布于 2017-03-13 08:23:22
有趣的是,_links
(带有下划线)是一件HAL的事情,所以我不期望您得到的规范遵循任何标准。
我知道包括actions
在内的一个标准是警笛,但它们与您的示例中的action
不同。
许多REST API甚至都不是RESTful,更不用说HATEOAS了。因此,遵循某一特定标准(或“标准”)的价值目前仍有争议。
https://stackoverflow.com/questions/42735651
复制相似问题