我想用openAPI3对下面的HTTP请求进行建模:
POST /users HTTP/1.1
Host: 10.65.1.70:3000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Accept: */*
Accept-Language: de-AT,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://10.65.1.70/sites/config-sites/user-config.html
Content-Type: application/json
Authorization: Bearer ...
Origin: http://10.65.1.70
Content-Length: 42
Connection: keep-alive
DNT: 1
{"name":"openAPITest","password":"noPassHere"}
我目前有这个:
/users/:
post:
summary: adds user
parameters:
- name: name
required: true
in: header
schema:
type: string
- name: password
required: true
in: header
schema:
type: string
responses:
"201":
description: OK
"400":
description: Wrong Format
我缺少的是一种正确传递登录信息的方法。
发布于 2019-11-16 20:48:34
下面是我最后是如何做到的:
paths:
/login:
post:
summary: login credentials
requestBody:
required: true
content:
application/json:
schema:
type: string
example:
{"name":"openAPITest","password":"noPassHere"}
请注意,openAPI会自动转义所提供的json中的
https://stackoverflow.com/questions/58885004
复制相似问题