Modelleri şey değildir ama değişkenleri ve özelliklere sahip java daki POJO sınıfları gibi. Modeller bölümünde kendi özel sınıfınızı tanımlayabilir ve veri türü olarak başvurabilirsiniz.
{
"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"
}
}
}
}}
aşağıda modellerinde tanımlanır var Burada parametre bölümünde
{
"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"
}
]
}
altında görürseniz modeller, daha fazla bilgi için bkz. Swagger PetStore example
S o modeller sınıftan başka bir şey değildir.