招摇投掷 "Not a valid parameter definition"
Swagger throwing "Not a valid parameter definition"
我正在使用 Swagger UI 创建 API 文档。我有很多错误显示 "Not a valid parameter definition",但我不知道为什么。任何人都可以说出这是什么或为什么会这样吗?我包括了一段代码和一张带有行号和错误描述的图片。
招摇的例子
#sys_application
/api/application/add:
post:
description: Adds specified application(s).
parameters:
- name: name
in: body
description: name of the application
required: true
type: string
- name: appId
in: body
description: application id
required: true
type: string
- name: icon
in: body
description: application icon
required: true
type: string
- name: state
in: body
description: current state of the application
required: true
type: string
- name: profileRoute
in: body
description: embedded profile route that is displayed within the map app
required: true
type: string
- name: type
in: body
description: type of the application
required: true
type: string
- name: permissions
in: body
description: user permissions for application
required: false
type: string
- name: subscriptions
in: body
description: application subscriptions
required: false
type: string
招摇错误
当您使用 in: body
时,规范需要一个 schema
元素,例如:
name: user
in: body
schema:
type: object
properties:
userId:
type: string
如果您没有使用正文参数,您应该使用原始值,例如type: string
。
我正在使用 Swagger UI 创建 API 文档。我有很多错误显示 "Not a valid parameter definition",但我不知道为什么。任何人都可以说出这是什么或为什么会这样吗?我包括了一段代码和一张带有行号和错误描述的图片。
招摇的例子
#sys_application
/api/application/add:
post:
description: Adds specified application(s).
parameters:
- name: name
in: body
description: name of the application
required: true
type: string
- name: appId
in: body
description: application id
required: true
type: string
- name: icon
in: body
description: application icon
required: true
type: string
- name: state
in: body
description: current state of the application
required: true
type: string
- name: profileRoute
in: body
description: embedded profile route that is displayed within the map app
required: true
type: string
- name: type
in: body
description: type of the application
required: true
type: string
- name: permissions
in: body
description: user permissions for application
required: false
type: string
- name: subscriptions
in: body
description: application subscriptions
required: false
type: string
招摇错误
当您使用 in: body
时,规范需要一个 schema
元素,例如:
name: user
in: body
schema:
type: object
properties:
userId:
type: string
如果您没有使用正文参数,您应该使用原始值,例如type: string
。