node.js - swaggerhub 和 REST API
问题描述
我使用 swaggerHub 来编写我的新应用程序节点的文档,但我有一个 api 的问题。
我的 API 需要两个参数。示例:发布http://cloud.amazingwebsite.com/:service/:action
好的,如果你想使用这个API,你必须给两个值。我的问题是 swaggerHub 的文档只提出了带有一个参数的示例。
请问,你有两个参数的例子吗?可能吗 ?谢谢
解决方案
如果你这样做:
"/{service}/{action}":
x-swagger-router-controller: serviceController
post:
summary: To perform an action
operationId: serviceAction
parameters:
- name: service
in: path
required: true
type: string
description: Request Path Param for service
- name: action
in: path
required: true
type: string
description: Request Path Param for Action
responses:
'200':
description: Success
schema:
"$ref": "#/definitions/SuccessResponse"
default:
description: Error
schema:
"$ref": "#/definitions/ErrorResponse"
definitions:
SuccessResponse:
type: object
ErrorResponse:
required:
- error
properties:
error:
type: string
推荐阅读
- logging - 在 Blazor WASM 中记录到文件
- css - 图像应在剩余位置(Vue/Tailwind/Flex)
- azure - 无法在 CIS 强化的 Azure Ubuntu 18.04 VM 映像上更改用户名和主机名
- sql - SQL Server 问题 - 列结果中的子查询带有连接?
- javascript - 上传已存在的文件导致页面刷新
- javascript - Angular:由于异步数据,随机“找不到具有名称的控件”错误
- python - 有没有办法在 Python 中以数字方式集成两个函数的乘积?
- python - 交互式注释仅显示在 matplotlib 中的一个数据集
- javascript - reCAPTCHA 表单在第二次提交时提交两次
- android - 如何在 React Native android 应用程序中使用 Axios 将图像上传到 Azure 存储容器?我保存的图像无法打开保存的图像