Swagger-YAML错误映射条目

See*_*uD1 4 rest yaml swagger

我尝试使用Swagger和YAML生成REST API定义,但$ref: '#/definitions/Token'出现错误

映射条目缩进错误

      parameters:
        - name: environmentID
          in: query
          description: id from the gamificationenvironment
          required: true
          type: integer
          format: int32
        - name: authorizationToken
          in: query
          description: Authorization token to create a new environment
          required: true
              schema:
                type: object
    --> Error   $ref: '#/definitions/Token'
      responses:
        201:
          description: GamificationID for the Admin
          schema:
            type: object
            items:
              $ref: '#/definitions/Environment'
        default:
          description: Unexpected error
          schema:
              $ref: '#/definitions/Error'

definitions:
  Token:
    required:
      - authentificationKey
      - user
    properties:
      authentificationKey:
        type: string
      senderID:
        type: integer
        format: int32
      user:
        type: string
        type: integer
        format: int64
  Error:
    type: object
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string
      fields:
        type: string
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

我的问题是: 为什么“映射与” $ref在响应时起作用,在参数出现错误?

fly*_*lyx 5

这部分在语法上是不正确的:

         required: true
             schema:
               type: object
               $ref: '#/definitions/Token'
Run Code Online (Sandbox Code Playgroud)

schema:应该与处于同一级别required: