モデルは、変数とプロパティを持つJavaのPOJOクラスに他なりません。モデルセクションでは、独自のカスタムクラスを定義し、それをデータ型として参照できます。
以下をご覧ください
{
"path": "/pet.{format}",
"description": "Operations about pets",
"operations": [
{
"httpMethod": "POST",
"summary": "Add a new pet to the store",
"responseClass": "void",
"nickname": "addPet",
"parameters": [
{
"description": "Pet object that needs to be added to the store",
"paramType": "body",
"required": true,
"allowMultiple": false,
"dataType": "Pet"
}
],
"errorResponses": [
{
"code": 405,
"reason": "Invalid input"
}
]
}
ここのパラメーターセクションには、dataTypeがPetであるパラメーターが1つあり、petは以下のようにモデルで定義されています。
{
"models": {
"Pet": {
"id": "Pet",
"properties": {
"id": {
"type": "long"
},
"status": {
"allowableValues": {
"valueType": "LIST",
"values": [
"available",
"pending",
"sold"
]
},
"description": "pet status in the store",
"type": "string"
},
"name": {
"type": "string"
},
"photoUrls": {
"items": {
"type": "string"
},
"type": "Array"
}
}
}
}}
ネストされたモデルを持つことができます。詳細については、SwaggerPetStoreの例を参照してください。
つまり、モデルはクラスのようなものに他なりません。