[英]Swagger throwing “Not a valid parameter definition”
I am creating API documentation utilizing Swagger UI. 我正在使用Swagger UI创建API文档。 I have many errors that say "Not a valid parameter definition" and I don't know why.
我有很多错误,说“不是有效的参数定义”,我也不知道为什么。 Can anyone tell what or why this is happening?
谁能说出这是什么原因? I include a section of the code and a picture with the line numbers and the error descriptions.
我包括一段代码和一张图片,其中包含行号和错误描述。
swagger example 招摇的例子
#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
swagger error 大幅度的错误
when you use in: body
, the spec expects a schema
element, such as: 当
in: body
使用时,规范需要一个schema
元素,例如:
name: user
in: body
schema:
type: object
properties:
userId:
type: string
If you're not using a body parameter, you are expected to use a primitive value, such as type: string
. 如果不使用body参数,则应使用基本值,例如
type: string
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.