Aglio不允许将身体中的参数定义为参数

时间:2015-05-06 16:51:11

标签: rest markdown apiblueprint aglio

API Blueprint渲染器Aglio不允许将请求正文中的参数包含在Endpoint规范的参数部分中。它抛出解析警告如下:

parameter '<some_parameter>' not specified in '<some_description>' its '<some_URI_template>' URI template (warning code 8)

可以复制此警告的Markdown示例如下:

## Journey creation [/v1/journeys/{origin}]

### Create journey [POST]
Create a new journey

+ Parameters
    + origin (required) ... origin location of journey
    + destination (required) ... destination location of journey

+ Request
    + Headers

                Accept: application/json
                Authorization: Basic <BASIC_AUTH_TOKEN>

    + Body

                {
                     "destination" : "some_other_place"
                }


+ Response 200 (application/json)

    + Body

            {
            "origin" : "some_place",
            "destination" : "some_other_place",
            "journey_state" : "Not_Started",
            "timestamp" : "<dateuuid>",
            }

渲染不喜欢&#39;目的地&#39;作为参数,因为它不在URI模板中。

我的问题是,这是该工具的缺点,还是API蓝图规范?另外,也许,这个REST端点的定义不符合标准吗?

1 个答案:

答案 0 :(得分:2)

指定消息体属性的正确方法是使用新的MSON属性语法,该语法用于从Aglio 2.0开始呈现JSON和JSON模式。

### Create journey [POST]
Create a new journey

+ Parameters
    + origin (required) - origin location of journey

+ Attributes
    + destination: some_other_place (required) - destination location of journey

+ Request
    + Headers

                Accept: application/json
                Authorization: Basic 

在不久的将来,Aglio将为这些属性提供额外的信息。