我想在POST的swagger文档中指定默认的json值。我收到T_CLOSE_PARENTHESIS错误。我也试过逃避"。
/**
* @SWG\Api(path="/api/users",
* @SWG\Operation(
* method="POST",
* summary="Register a user",
* notes="Send a POST request along with required form parameters to add a new user",
* type="string",
* nickname="post-users",
* authorizations={},
* @SWG\Parameter(
* name="email",
* description="The email",
* required=true,
* type="json",
* paramType="body",
* allowMultiple=false,
* defaultValue = "{
"email":"pradeep****@gmail.com",
"first_name":"Pradeep",
"last_name":"Kumar",
"group":"subscriber",
"password":"password"
}",
* ),
*
* @SWG\ResponseMessage(code=200,message="Success"),
* @SWG\ResponseMessage(code=400,message="Bad Request")
* )
* )
*/
答案 0 :(得分:10)
要转义学说/注释中的"
,请使用""
defaultValue="{""email"":""p****@gmail.com"",""first_name"":""Pradeep""}"
答案 1 :(得分:1)
我猜你应该将defaultValue
转换为单行,并使用正斜杠转义引号。