私はSwagger-phpを使用しています。クエリ文字列にあるパラメータを定義すると、配列になります。しかし、私は見ることができるものから、それはクエリ文字列のこの種類をサポートしていません:swagger-phpはクエリ文字列で配列を使用できますか?
https://api.domain.tld/v1/objects?q[]=1&q[]=5&q[]=12
私は、可能な場合、これはin the collectionFormat
fieldを設定すると考えています。現在はpipes
を使用していますが、上記の形式を使用してSwagger-UIにこれも反映させたいと思います。しかし、私はthis github issueを読んでいますが、実際にこれが可能かどうか疑問に思っています。
私威張っ-PHPの定義の例:以下のJSONになり
/**
* @SWG\Parameter(
* name="ids",
* in="query",
* description="A list of IDs (separated by pipes) to filter the Returns",
* required=false,
* type="array",
* @SWG\Items(
* type="integer",
* format="int32"
* ),
* collectionFormat="pipes"
* )
*/
:
"parameters": {
"ids": {
"name": "ids",
"in": "query",
"description": "A list of IDs (separated by pipes) to filter the Returns",
"required": false,
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"collectionFormat": "pipes"
}
}
に似何かになります。私は 'マルチ'と考えましたが、PHPを使うと残念なことに最後の価値が得られます。結局、 'パイプ'を使うことに決めました。ちょっといいチュートリアル:) – LeonardChallis
これは可能です。私の答えを見てください:http://stackoverflow.com/a/43465801/345721 – Ima