首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用dredd yml的多个请求

使用dredd yml的多个请求
EN

Stack Overflow用户
提问于 2017-11-08 15:45:51
回答 1查看 629关注 0票数 0

对我的API使用节点dredd。我选择使用yml文件,因为这是我的团队熟悉的std。

下面是我们有一个功能正常的代码片段:

代码语言:javascript
复制
  /api/station/{id}:
    get:
      produces:
        - application/json; charset=utf-8
      parameters:
      - name: id
        in: path
        required: true
        type: string
        description: DynamoDB ID of the station to edit
        x-example: 'daf04a00-c3bf-11e7-a913-b76623d265c4'
      responses:
        200:
          description: Returns a single station
          schema:
            $ref: '#/definitions/station'

我想我可以猜出如何定义备用响应对象,我假设只需添加到对象中,例如:

代码语言:javascript
复制
  responses:
    200:
      description: Returns a single station
      schema:
        $ref: '#/definitions/station'
    422:
      description: Failed validation

在dredd文档中:https://dredd.readthedocs.io/en/latest/how-to-guides.html#multiple-requests-and-responses-within-one-api-blueprint-action

有一个例子说明如何向同一个端点发送多个请求。但这是API蓝图格式,而不是yaml格式。

有人知道如何使用yaml格式将多个请求传递给同一个端点吗?我看不见任何关于如何做到这一点的文档。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-11-13 13:05:18

就在你链接的文档的下面,有用Swagger测试非2xx响应

昂首阔步格式允许为单个操作指定多个响应。默认情况下,Dredd测试仅使用2xx状态代码进行响应。其他代码的响应被标记为跳过,可以在钩子中激活-参见用Swagger测试非2xx响应。 默认响应被Dredd忽略。而且,到目前为止,在producesconsumes中只支持produces媒体类型。跳过其他媒体类型。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47183930

复制
相关文章

相似问题

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