2015-05-06 48 views
1

API Blueprint呈現器Aglio不允許將請求正文中的參數包含在Endpoint規範的參數部分中。它拋出解析警告如下: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藍圖specificaton?另外,也許,這不是每個標準的REST端點的定義?

回答

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會爲屬性提供額外的信息。

+1

謝謝@Daniel,感謝快速回復。期待修復。 – GreenDroid

+0

對此有何更新? 沒有這個是一個很大的缺點。自第一時間起,請求主體屬性應該是「可描述的」。 – Aichholzer

+1

我的不好;它已經在V.2中了 - 我被困在了V1.8中。謝謝你,保持它。 – Aichholzer