2014-12-27 13 views
5

Desidero specificare un valore json predefinito nei documenti swagger per POST. Sto ottenendo l'errore T_CLOSE_PARENTHESIS. Ho anche cercato di sfuggire al".Come specificare il valore json predefinito nella documentazione di swagger 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") 
    * ) 
    *) 
    */ 
+4

dolce madre di Dio – Jimbo

risposta

10

per sfuggire a una " in una dottrina/uso di annotazione ""

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

Perfetto, solo la risposta che stavo cercando, questa dovrebbe essere la risposta accettata! – Matthijs

1

Sto indovinando si dovrebbe convertire il defaultValue in un'unica riga, e fuggire le quotazioni con una barra.

+0

Fehguy, ho provato e anche citato nella mia interrogazione – prady00

+0

ho fatto -.. defaultValue = "{\" email \ ": \" pradeep **** @ gmail.com \ ", \" first_name \ ": \" Pradeep \ ", \" last_name \ ": \" Kumar \ ", \ "group \": \ "subscriber \", \ "password \": \ "password \"} " – prady00

+0

Ciao, penso che dovrai aprire un problema nel repository swagger-php: https: // github. com/zircote/swagger-php – fehguy

Problemi correlati