How to specify default json value in swagger xml documentation?

I want to specify the default json value in swagger docs for POST. I get the error T_CLOSE_PARENTHESIS. I also tried to get away from. "

/** * @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") * ) * ) */ 
+5
source share
2 answers

To avoid a " in doctrine / annotation use ""

 defaultValue="{""email"":""p****@gmail.com"",""first_name"":""Pradeep""}" 
+10
source

I assume that you should convert defaultValue to a single line and avoid quotes with a slash.

+1
source

Source: https://habr.com/ru/post/1209950/


All Articles