所以我明白,如果我们想要身体参数,我们必须有一个模式,我就是这样做的。问题是无论我如何尝试定义我的架构,它都不允许我拥有多个正文参数。这是我尝试过的方法之一的示例。任何帮助都会很棒!
swagger: '2.0'
# This is your document metadata
info:
version: "0.0.1"
title: Todo App
schema: {
}
host: localhost:3000
schemes:
- http
- https
consumes:
- application/json
produces:
- application/x-www-form-urlencoded
basePath: /
paths:
# This is a path endpoint. Change it.
/tasks:
post:
description: |
Add 'Task' object.
parameters:
# An example parameter that is in query and is required
-
name: name
in: query
description: unique object task name
required: true
schema:
type: string
- name: description
in: query
description: task description
required: true
schema:
type: string
responses:
# Response code
200:
description: Successful response
# A schema describing your response object.
# Use JSON Schema format
schema:
title: Return String
type: string
example: "Task added succesfully"
500:
description: Error
schema:
type: string
example: "Could not add Task"