首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在起草API蓝图文档时,我如何对响应进行注释?

在起草API蓝图文档时,我如何对响应进行注释?
EN

Stack Overflow用户
提问于 2013-12-24 21:34:48
回答 1查看 880关注 0票数 3

我想注释一些错误响应,如下所示:

代码语言:javascript
运行
复制
* Response 412
If the Etag supplied in `If-Match` didn’t match.

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

但是解析器(雪崩)似乎将注释解释为响应体。

我怎样才能注释这些反应,让雪崩明白它们是注释呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-24 21:38:55

我想明白了:我需要在响应中添加一个空的Body部分,如下所示:

代码语言:javascript
运行
复制
* 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

然后根据需要对其进行分析:

代码语言:javascript
运行
复制
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:
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20766980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档