带有多个参数的摇摇欲坠

时间:2018-08-27 19:58:50

标签: json swagger swagger-ui swagger-2.0 openapi

让我们说我的身体参数如下:

 "parameters": [
   {
     "in": "body",
     "name": "body",
     "description": "Pet object that needs to be added to the store",
     "required": true,
     "schema": {
       "$ref": "#/definitions/Pet"
     }
   }
  ],

和#/ definitions / Pet定义为以下模型:

 "Pet": {
    "type" : "object",
    "required": [
     "name",
     "photoFile"
   ],
   "properties": {
     "id": {
       "type": "integer",
       "format": "int64"
     },
     "name": {
       "type": "string",
       "example": "doggie"
     },
    "photoFile": {
       "type": "file",
       "example": "dog.png"
     }
   }
 }

问题

除了将一个主体作为参数外,用户还可以通过任何方式为每个属性(id,name和photoFile)键入值作为参数吗?

例如,为用户提供了三个要使用的参数,分别是id,name和photoFile。用户将输入id和name的值。此外,用户可以上传照片文件。最终结果应给出与上述示例相同的输出。以下是我正在谈论的参数示例:

 "parameters": [
   {
     "in": "?",
     "name": "ID",
     "description": "Enter ID",
     "required": true,
   },{
     "in": "?",
     "name": "NAME",
     "description": "Enter NAME",
     "required": true,
   },{
     "in": "?",
     "name": "photoFile",
     "description": "Upload photo File",
     "required": true,
   }
  ],

任何帮助将不胜感激!

0 个答案:

没有答案