我想在 Swagger-PHP 中为 POST 请求指定默认的 JSON 正文。我的注释如下所示:
/**
* Setup order
*
* @SWG\Post(
* path="/order/setup",
* operationId="setupOrder",
* tags={"Orders"},
* summary="Setup an order with status draft.",
* description="Setup an order with status draft",
* consumes={"application/json"},
* @SWG\Parameter(
* name="body",
* in="body",
* default="{}",
* description="Json order info body (customer and products info)",
* required=true,
* @SWG\Schema(type="string")
* ),
* @SWG\Response(
* response=200,
* description="successful operation"
* ),
* @SWG\Response(response=400, description="Bad request"),
* security={
* {"api_key_security_example": {}}
* }
* )
*
*/
如您所见,我正在尝试使用default="{}",
但 Swagger UI 忽略此值并将“字符串”作为默认值来实现默认值:
如何将“字符串”部分更改为默认 JSON 对象?