説明
items は配列の要素を記述します。オブジェクトのフィールドや文字列の内容には適用されません。
想定される影響
生成されたクライアントが別の型を想定したり、制限したい値が検証を通ったりすることがあります。
対処方法
配列には type: array を指定し、要素を items で定義してください。オブジェクトなら items を削除し、フィールドを properties に記述します。
例
この OpenAPI 3.0 の抜粋では info と paths を省略しています。
変更前
json
{
"openapi": "3.0.0",
"components": {
"schemas": {
"GeneralError": {
"type": "object",
"items": {
"type": "string"
}
}
}
}
}
変更後
json
{
"openapi": "3.0.0",
"components": {
"schemas": {
"GeneralError": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
変更後の GeneralError は文字列の配列です。API が文字列の配列を受け取るか返す場合にこの定義を使ってください。