Apiary:是否可以记录JSON响应字段?

前端之家收集整理的这篇文章主要介绍了Apiary:是否可以记录JSON响应字段?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想要记录实际的 JSON字段本身所代表的内容.

我已经记录了GET语句和参数,但这并没有提供给用户的完整的文档.

所以,在下面的例子中,如何添加关于“OtherFields”的评论.这是否支持?或者我需要在其他地方做一个配套文件.

## 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 syntax属性描述测试版.

原始有效载荷可以描述为

### 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,"Applications" : [{
                        "UID" : "6882e96a-5da1-11e3-1111-3f24f45df3ad"
                        "OtherFields": ""
                    }]
                }
            }

注意,身体中的显式JSON是多余的,您可以完全跳过它.有关其他详细信息,请参阅API蓝图规范 – Attributes

原文链接:https://www.f2er.com/js/152432.html

猜你在找的JavaScript相关文章