Swagger没有为"参数"生成参考链接。

时间:2016-12-07 15:06:28

标签: swagger swagger-ui

在YAML文件中我有:

      parameters:
        - name: body
          in: body
          required: true
          description: Body of the request.
          schema:
            $ref: '#/definitions/MinimalProgresstrailEntry'

并将其呈现给:

enter image description here

它不会渲染身体的参考。它适用于responses,但不适用于parameters

参考定义:

MinimalProgresstrailEntry:
type: object
properties:
  memoText:
    type: string
  type:
    type: string
    enum:
      - memo
      - attachment
      - link

1 个答案:

答案 0 :(得分:0)

以下swagger文件适用于swagger-editor

swagger: '2.0'
info:
  version: "0.0.0"
  title: title
paths:
  /persons:
    get:
      description: test
      parameters:
        - name: body
          in: body
          required: true
          description: Body of the request.
          schema:
            $ref: '#/definitions/MinimalProgresstrailEntry'
      responses:
        200:
          description: Successful response
          schema:
            $ref: '#/definitions/MinimalProgresstrailEntry'
definitions:
  MinimalProgresstrailEntry:
   type: object
   properties:
    memoText:
      type: string
    type:
      type: string
      enum:
        - memo
        - attachment
        - link