Swagger 如何编写数组格式的模型

Swagger 如何编写数组格式的模型,swagger,swagger-2.0,swagger-editor,Swagger,Swagger 2.0,Swagger Editor,json文件如下所示 [{xx:xx,xx1:xx1},{},...] 这里是一个get请求的模型,它直接返回一个数组,而不是一个正式的json,如何编写一个模型 /hsseventwebapi/v1/walking/events/{eventcd}/livecomments: get: operationId: イベント実況を返す summary: 個人に関連するランキングを返す description: "イベント実況を返す(取得したい実況一覧の開始日時を指定取得できる一覧は最

json文件如下所示

[{xx:xx,xx1:xx1},{},...]
这里是一个get请求的模型,它直接返回一个数组,而不是一个正式的json,如何编写一个模型

/hsseventwebapi/v1/walking/events/{eventcd}/livecomments:
get:
  operationId: イベント実況を返す
  summary: 個人に関連するランキングを返す
  description: "イベント実況を返す(取得したい実況一覧の開始日時を指定取得できる一覧は最大30件"
  tags:
    - Walking
  parameters:
    - name: eventcd
      in: path
      description: eventcd
      required: true
      type: integer
  responses:
    200:
      description: OK
      schema:
        $ref: '#/definitions/LiveListModel'
模型如下:

LiveListModel:
type: array
description: live list
items:
  type: object
  description: live item
  properties:
    eventNo:
      type: string
      description: eventNo
    liveCommentYmdhms:
      type: string
      description: liveCommentYmdhms
    liveComment:
      type: string
      description: liveComment
    liveCommentSeq:
      type: string
      description: liveCommentSeq
    targetAppUserNo:
      type: string
      description: targetAppUserNo
  required:
      - eventNo
      - liveCommentYmdhms
      - liveComment
      - liveCommentSeq
      - targetAppUserNo
这是用户界面

有两个liveListModel,我无法解析它。

您的规范是正确的


Swagger编辑器和UI渲染阵列模型如下:

ArrayModelName   [ ItemModelName  <item schema> ]
图像上重复的模型名称是Swagger Editor/UI中的一个显示错误。它应该在本周晚些时候(9月15-16日?)即将发布的版本中修复

在您的示例中,项目模型是内联的,没有名称/
标题
,因此应该将其呈现为无名。

您的规范是正确的

    /hsseventwebapi/v1/walking/events/{eventcd}/livecomments:
get:
  operationId: イベント実況を返す
  summary: 個人に関連するランキングを返す
  description: "イベント実況を返す(取得したい実況一覧の開始日時を指定取得できる一覧は最大30件"
  tags:
    - Walking
  parameters:
    - name: eventcd
      in: path
      description: eventcd
      required: true
      type: integer
  responses:
    200:
      description: OK
      schema:
        type: array
        items:
          $ref: '#/definitions/LiveListItemModel'





 LiveListItemModel:
    type: object
    description: live item
    properties:
      eventNo:
        type: string
        description: eventNo
      liveCommentYmdhms:
        type: string
        description: liveCommentYmdhms
      liveComment:
        type: string
        description: liveComment
      liveCommentSeq:
        type: string
        description: liveCommentSeq
      targetAppUserNo:
         type: string
         description: targetAppUserNo
      required:
          - eventNo
          - liveCommentYmdhms
          - liveComment
          - liveCommentSeq
          - targetAppUserNo

Swagger编辑器和UI渲染阵列模型如下:

ArrayModelName   [ ItemModelName  <item schema> ]
图像上重复的模型名称是Swagger Editor/UI中的一个显示错误。它应该在本周晚些时候(9月15-16日?)即将发布的版本中修复


在您的示例中,项目模型是内联的,没有名称/
title
,因此应该将其呈现为无名。

好的,谢谢,我已经解决了这个问题。它是这样的:``响应:200:description:OK模式:type:array items:$ref:''#/definitions/LiveListItemModel'LiveListItemModel:type:object属性:xx:``好的,谢谢,我已经解决了这个问题。它是这样的:```响应:200:description:OK模式:类型:数组项:$ref:'#/definitions/LiveListItemModel'LiveListItemModel:类型:对象属性:xx:```
    /hsseventwebapi/v1/walking/events/{eventcd}/livecomments:
get:
  operationId: イベント実況を返す
  summary: 個人に関連するランキングを返す
  description: "イベント実況を返す(取得したい実況一覧の開始日時を指定取得できる一覧は最大30件"
  tags:
    - Walking
  parameters:
    - name: eventcd
      in: path
      description: eventcd
      required: true
      type: integer
  responses:
    200:
      description: OK
      schema:
        type: array
        items:
          $ref: '#/definitions/LiveListItemModel'





 LiveListItemModel:
    type: object
    description: live item
    properties:
      eventNo:
        type: string
        description: eventNo
      liveCommentYmdhms:
        type: string
        description: liveCommentYmdhms
      liveComment:
        type: string
        description: liveComment
      liveCommentSeq:
        type: string
        description: liveCommentSeq
      targetAppUserNo:
         type: string
         description: targetAppUserNo
      required:
          - eventNo
          - liveCommentYmdhms
          - liveComment
          - liveCommentSeq
          - targetAppUserNo