如何在swagger php文档中指定默认json值?
我想在swagger文档中为POST指定一个默认json值。我发现T_CLOSE_括号错误。我也试着逃离“危险”如何在swagger php文档中指定默认json值?,php,json,swagger,swagger-ui,Php,Json,Swagger,Swagger Ui,我想在swagger文档中为POST指定一个默认json值。我发现T_CLOSE_括号错误。我也试着逃离“危险” 我猜您应该将默认值转换为一行,并用正斜杠转义引号。要转义条令/注释中的“,请使用” Fehguy,我已经试过了,在我的问题中也提到过。我做过这个-defaultValue=“{\”email\”:“pradeep****@gmail.com\”,“first\u name\”:“pradeep\”,“last\u name\”:“Kumar\”,“group\”:“subscribe
我猜您应该将
默认值
转换为一行,并用正斜杠转义引号。要转义条令/注释中的“
,请使用”
Fehguy,我已经试过了,在我的问题中也提到过。我做过这个-defaultValue=“{\”email\”:“pradeep****@gmail.com\”,“first\u name\”:“pradeep\”,“last\u name\”:“Kumar\”,“group\”:“subscriber\”,“password\:“password\”,“Hi,我想你需要在大摇大摆的php存储库中打开一个问题:亲爱的上帝之母。完美,这正是我想要的答案,这应该是公认的答案!
/**
* @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")
* )
* )
*/
defaultValue="{""email"":""p****@gmail.com"",""first_name"":""Pradeep""}"