API蓝图渲染器Aglio不允许将请求正文中的参数包括在端点规范的参数部分中。它将按以下方式抛出警告:
parameter '<some_parameter>' not specified in '<some_description>' its '<some_URI_template>' URI template (warning code 8)
复制此警告的示例标记如下:
## 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>",
}呈现的不喜欢‘目标值’作为参数,因为它不在URI模板中。
我的问题是,这是该工具的一个缺点,还是一个API蓝图的细节?另外,这是否是REST端点的定义不符合标准?
发布于 2015-05-06 20:03:02
指定消息体属性的正确方法是使用新的MSON属性语法,该语法用于呈现JSON和JSON (从Aglio2.0开始)。
### 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将为这些属性提供额外的信息。
https://stackoverflow.com/questions/30082903
复制相似问题