1
在以下Swagger定義中,我需要參數labelValue
的類型爲LabelValueObject
,以便驗證它並進行正確的反序列化。但是,我無法弄清楚語法!如何做到這一點?Swagger參數和複雜類型
swagger: "2.0"
paths:
/competition:
post:
parameters:
- name: labelValue
in: formData
type: array
items:
type: string ### this has to be a LabelValueObject ###
responses:
default:
description: Error
schema:
$ref: "#/definitions/AnyResponse"
definitions:
AnyResponse:
properties:
any:
type: string
LabelValueObject:
properties:
label:
type: string
value:
type: string
required:
- label
- value
這個參數是否需要位於formData? –
你是對的。我可以將它設置爲body並使用架構$ ref我想......我是Swagger的新手,所以我錯過了這一點。如果這是你的問題,請發表一個答案。 – Merott