【问题标题】:How to document an endpoint with 2 path parameters using sails-hook-actions2-swagger?如何使用sails-hook-actions2-swagger记录具有2个路径参数的端点?
【发布时间】:2020-02-24 16:18:30
【问题描述】:

我正在使用@logisticinfotech/sails-hook-actions2-swagger 来记录我的 REST API。我的端点如下所示:/ user /: uid / company /: cid。 生成文档后,公司在两个ID之间崩溃,导致端点看起来像这样:/ user /: uid /: cid,不能留下。 我不能解雇这家公司以通过 Swagger UI 提交。

我的 swagger.js:

'PUT /user/:uid/company/:cid':{action: 'userCompany/add',
            swagger: {
              summary: 'Add user to company',
              parameters: [{
                in: 'path',
                name: 'uid',
                required: true,
                type: 'string',
                description: 'User account ID'
              },
              {
                in: 'path',
                name: 'cid',
                required: true,
                type: 'string',
                description: 'Company ID'  
              }]
            }
          },

有人知道吗?

【问题讨论】:

  • 你使用什么注释库/框架?
  • @Helen: @logisticinfotech/sails-hook-actions2-swagger

标签: swagger sails.js sails-hook


【解决方案1】:

您的网址设置应定义如下

   'PUT /user/{uid}/company/{cid}'

然后它会正确地渲染招摇

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-05
    • 2019-04-04
    • 1970-01-01
    • 2020-07-26
    • 2022-11-20
    • 2019-05-18
    • 1970-01-01
    相关资源
    最近更新 更多