养蜂场:是否有可能记录JSON响应字段是什么?
-
21-12-2019 - |
题
我想记录实际的JSON字段本身代表什么。
我已经记录了get语句和参数,但这没有完整的文档给用户提供。
所以,在下面的例子中,我如何添加关于“其他场所”的评论。这是否支持?或者我需要在其他地方制作伴侣文件。
## View Applications [/cat{?sort}{&order}{&page}]
### List all Applications
### Get List of Applications [GET]
+ Parameters
+ sort (optional, string) ... `sort` parameter is used to specify which criteria to use for sorting. One of the following strings may be used:
`"NAME",
"RATING", "QUALITY" ,
"RISKLEVEL", `
+ order (optional, string) ... `order` parameter is used to specify which order to use if sorting is used. One of the following strings may be used:
`"ASC",
"DESC"`
+ page (optional, int ) ... `page` parameter is used to request subsequent catalog pages.
+ Response 200 (application/json)
{
"Catalog" : {
"Page" : 0,
"Count" : 6,
"Applications" : [{
"UID" : "6882e96a-5da1-11e3-1111-3f24f45df3ad"
"OtherFields: ""
}]
}}
. 解决方案
更新:我们刚刚推出了使用 MSON语法的测试版描述的测试版描述。
然后可以将原始有效载荷描述为
### Get List of Applications [GET]
+ Response 200 (application/json)
+ Attributes
+ Catalog (object)
+ Page: 0 (number) - Number of the page
+ Count: 6 (number) - Count of *Lorem Ipsum*
+ Applications (array) - Some array of something
+ (object)
+ UID: `6882e96a-5da1-11e3-1111-3f24f45df3ad`
+ OtherFields
+ Body
{
"Catalog" : {
"Page" : 0,
"Count" : 6,
"Applications" : [{
"UID" : "6882e96a-5da1-11e3-1111-3f24f45df3ad"
"OtherFields": ""
}]
}
}
.
注意身体中的显式json是冗余的,您可以完全跳过它。请参阅API蓝图规范 - 属性其他详细信息
其他提示
我不认为它尚未得到支持。
我通过将表格放在Get请求行上方的描述中,在项目中解决了这个问题。在您的情况下,它看起来像:
### List all Applications
| Field | Description |
|----------------------------------|---------------------------|
| Catalog.Applications.OtherFields | Documentation goes here.. |
### Get List of Applications [GET]
.
要帮助您在Markdown语法中创建表,您可以使用 markdown表生成器。
请注意,表生成器允许您将表定义保存到文件,以便下次需要编辑您可以从关闭的位置编辑表。
不隶属于 StackOverflow