2015-07-14 8 views
1

Я пытаюсь создать документацию для проекта с использованием почтовых запросов json.
Теперь для получения запросов я могу легко определить параметры uri.определение параметров json post на пасеке

Однако я хочу сделать то же самое для json и других почтовых запросов.
Я пробовал и хотел, чтобы он работал как-то вроде ниже, он отображает параметры в примере, но, похоже, это не так ...
Есть ли способ сделать это правильно?

## Post Inbound [/ws/3/inbound] 
### Post Inbound [POST] 


+ Request 

     { 
      "authentication": 
       { 
        "location":"{location}", 
        "customer_id":{customer_id}, 
        "context":"{context}" 
       }, 
      "date":"", 
      "reference":"", 
      "details": 
      [ 
       { 
        "article_code":"", 
        "qty_expected": 
       }, 
       { 
        "article_code":"", 
        "qty_expected": 
       } 
      ] 
     } 

+ Parameters 
    + location (required, string) - Target url of the wics server 
    + customer_id (required, int) - Customer ID 
    + context (required, string) - Authentication context gotten from login 
    + date (required, date) - Date format as yyyy-mm-dd 
    + reference (required, string) - Reference 
    + article_code (required, string) - Article code 
    + qty_expected (required, int) - Quantity expected. 

ответ

4

Parameters ключевое слово, чтобы указать URI parameters в API Blueprint, в то время как Attributes ключевое слово, чтобы указать атрибуты, такие как те, которые приведены во время запроса или ответа организма.

Это будет выглядеть примерно следующим по вашему запросу:

## Post Inbound [/ws/3/inbound] 
### Post Inbound [POST] 

+ Request (application/json) 

    + Attributes 
     + authentication (required, object) 
      + location (required, string) - Target url of the wics server 
      + customer_id (required, number) - Customer ID 
      + context (required, string) - Authentication context gotten from login 
     + date: `2015-12-30` (required, string) - Date format as yyyy-mm-dd 
     + reference (required, string) - Reference 
     + details (required, array) 
      + (object) 
       + article_code (required, string) - Article code 
       + qty_expected (required, number) - Quantity expected. 

+ Response 204 

И оказанной как таковой в Пасека:

MSON expanded and rendered at Apiary

Полная спецификация для MSON (синтаксис для записи объекта используемый в API Blueprint) можно найти по адресу https://github.com/apiaryio/mson.