2013-12-24 3 views
3

Я хотел бы, чтобы комментировать некоторые ошибочные ответы, например, так:При разработке документа API Blueprint, как я могу аннотировать ответ?

* Response 412 
If the Etag supplied in `If-Match` didn’t match. 

* Response 428 
If the request didn’t include the header `If-Match`. 

но анализатор (snowcrash), как представляется, интерпретации аннотаций в качестве органов реагирования.

Как я могу пояснить эти ответы и понять, что они представляют собой аннотации?

ответ

5

Я понял это: мне нужно добавить пустой Body раздел в ответ, например, так:

* Response 204 

    The request succeeded; there’s no need to transfer a representation of the new state of the resource, as the resource no longer exists. 

    * Body 

* Response 412 

    If the Etag supplied in `If-Match` didn’t match. 

    * Body 

Это затем разобран по желанию:

responses: 
- name: 204 
    description: "The request succeeded; there’s no need to transfer a representation of the new state of the resource, as the resource no longer exists.\n" 
    headers: 
    body: 
    schema: 
- name: 412 
    description: "If the Etag supplied in `If-Match` didn’t match.\n" 
    headers: 
    body: 
    schema: 
- name: 428 
    description: "If the request didn’t include the header `If-Match`.\n" 
    headers: 
    body: 
    schema: 
+0

Ваши данные являются правильными. Это неудачный компромисс «сокращенного» синтаксиса. – Zdenek

Смежные вопросы