是否可以为某些请求的每个响应指定说明?假设,我们有一个请求
### Retrieve resource [GET]
+ Headers
If-None-Match: "Version1"
和2个回复
+ Response 200 (application/xml)
+ Headers
ETag: "Version2"
+ Body
<Xml>
<A>
<B />
<C />
</A>
</Xml>
+ Response 304 (application/xml)
我想要的是指定这里的描述(请注意+ Response
行下的注释):
+ Response 200 (application/xml)
In case if the resource hasn't changed
+ Headers
ETag: "Version2"
+ Body
<Xml>
<A>
<B />
<C />
</A>
</Xml>
+ Response 304 (application/xml)
In case if the resource has changed
有可能吗?
答案 0 :(得分:5)
目前,无法在API蓝图中表达这样的逻辑。您可以随时在相应的回复中或在行动本身下“通过嘴”来描述它。例如:
# Resource [/1]
## Action [GET]
Explanation of this action here.
+ Request
...
+ Response 200
Explanation of this response.
+ Headers
...
+ Body
...
+ Response 304
Explanation of this response.
+ Headers
...
请注意,为了支持内容协商,很可能在不久的将来会有一些有限的分支支持。