简体   繁体   中英

Swagger throwing “Not a valid parameter definition”

I am creating API documentation utilizing Swagger UI. 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:

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM