我想通过我的API从我的数据库中请求一个表。但是,我不知道该表将包含多少列,或者它将包含哪些列。如何在Swagger中指定它?这就是我想做的事情:
paths:
/reports/{id}:
get:
summary: Detailed results
description: filler
parameters:
- name: id
in: path
description: filler
required: true
type: integer
format: int64
responses:
200:
description: OK
schema:
type: array
items:
$ref: '#/definitions/DynamicObject'
definitions:
DynamicObject:
type: object
properties:
**$IDONTKNOWWHATTODO**
关于如何定义没有特定参数的JSON对象的任何想法?
答案 0 :(得分:8)
要描述任意JSON,请使用"type": "object"
。以下是JSON中的示例:
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "object"
}
}
},