Swagger how to write a model which is array format -
the json this
[{xx:xx,xx1:xx1},{},...]
here model of request, return array directly, not formal json, how write model?
/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'
here model:
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
there 2 livelistmodel, can't parse it.
your spec correct.
swagger editor , ui render array models this:
arraymodelname [ itemmodelname <item schema> ]
or if items objects:
arraymodelname [ itemmodelname { properties }]
the duplicate model names on image display bug in swagger editor/ui. it's supposed fixed in upcoming release later week (september 15-16?).
in example, item model inline , has no name/title
, should rendered nameless.
Comments
Post a Comment