2016-11-15 30 views
0

我使用Swagger UI创建API文档。我有很多错误说“不是有效的参数定义”,我不知道为什么。任何人都可以说出发生了什么或为什么?我包括一段代码和一个带有行号和错误描述的图片。Swagger投掷“不是有效的参数定义”

招摇例如

#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: bodyenter image description here

回答

2

,该规范预计一schema元素,如:

name: user 
in: body 
schema: 
    type: object 
    properties: 
    userId: 
     type: string 

如果你不是使用身体参数,您应该使用原始值,如type: string