有没有办法在Apiary中重用响应?我认为Data Structures不是正确的方法,但我找不到其他的方法。
发布于 2016-10-01 17:43:19
数据结构--正如你可能已经注意到的,一开始看起来有点夸大其词,但这正是你正在寻找的答案。如果您对如何在“高级模式”中使用它们更感兴趣,请查看https://github.com/apiaryio/api-blueprint/blob/master/Advanced%20Tutorial.md#data-structures上的教程
另一种选择是使用资源模型:
## My Message [/message]
+ Model (application/vnd.siren+json)
This is the `application/vnd.siren+json` message resource representation.
+ Headers
Location: http://api.acme.com/message
+ Body
{
"class": [ "message" ],
"properties": {
"message": "Hello World!"
},
"links": [
{ "rel": "self" , "href": "/message" }
]
}另一个选项是使用普通属性(https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#resource-attributes-description)
# Blog Post [/posts/{id}]
Resource representing **ACME Blog** posts.
+ Attributes
+ id (number)
+ message (string) - The blog post article
+ author: john@appleseed.com (string) - Author of the blog post及以后的引用^“资产”,如下所示:
+ Attributes (Blog Post)https://stackoverflow.com/questions/39804438
复制相似问题