我不明白如何在其中一条路线中使用swagger和drdd传递自定义标头参数,我想在'X-API-Token'中传递JWT
我跑步
dredd swagger.yaml http://localhost:5001/api
我的swagger.yaml部分如下:
paths:
/users:
get:
tags:
- "User"
summary: "Get user data"
description: "Get user data"
operationId: "userGet"
parameters:
- in: header
name: X-API-Token
schema:
type: string
default: xxx.mykey.xxx
responses:
'200':
description: "Get user data"
content:
application/json; charset=utf-8:
schema:
$ref: "#/components/schemas/UserData"
default:
description: "Unexpected error"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
security:
- ApiTokenAuth: []
components:
securitySchemes:
ApiTokenAuth: # arbitrary name for the security scheme
type: apiKey
in: header # can be "header", "query" or "cookie"
name: X-API-Token