遇到了完全相同的问题,今天解决了!
这是为了招摇2.0
以下是我用来实现嵌套参数的注释嵌套。
/**
* @SWG\Post(
* path="/getCustomerByEmail.php",
* summary="List the details of customer by the email.",
* consumes={"string"},
* produces={"application/json"},
* @SWG\Parameter(
* name="email",
* in="body",
* description="Customer email to ge the data",
* required=true,
* @SWG\Schema(
* @SWG\Property(
* property="id",
* type="object",
* @SWG\Property(
* property="abc",
* type="object",
* @SWG\Property(
* property="inner abc",
* type="number",
* default=1,
* example=123
* )
* ),
* @SWG\Property(
* property="xyz",
* type="string",
* default="xyz default value",
* example="xyz example value",
* )
* )
* )
* ),
* @SWG\Response(
* response=200,
* description="Details of the customer"
* ),
* @SWG\Response(
* response=400,
* description="Email required"
* ),
* @SWG\Response(
* response=404,
* description="Customer does not exist"
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
/**
输出如下
Note:我正在开发一个需要原始 PHP 的项目,但仍然
想使用 Swagger。所以我没有创建模型,而是使用了这个
制作嵌套参数的技术。
编辑 1:我不知道问题是什么,UI 符合预期,但在发出请求时,帖子或有效负载中没有数据。
编辑2:将Get 转换为Post。
可以很好地配合file_get_contents("php://input")