Question

Hi Restler/Swagger friends, I have a problem when trying to submit values of object that have inner object values to service side.. what happened that object values submitted but inner object values didn't submitted to the service side or submitted but not processed at service side.....

How can i submit the inner object values or allow service side to take theses inner objects? Do i need to update php at service side? if yes where should i update? please guide me

My test classes as follow:

    /**
     * POST
     * post Author
     *
     * @param {@type Author} $a
     *
     * @return Author
     */
    function postAuthor(Author $a) {
        return $a->p->fname." ".$a->name;
    }

//models
//inner object
class Person {

    /**
     * @var string {@from body} 
     * name of the Person {@required true}
     */
    public $fname = 'First name';

    /**
     * @var string {@from body}
     * last name of the Person {@required true}
     */
    public $lname = 'Last name';

    /**
     *  @var array $arr {@type array} array of IDs
     * {@required true}
     */
    public $arr = array();

}

//outer object
class Author {

    /** define person as inner object
     * @var Person $p {@type Person} {@from body} person of author 
     * 
     */
    public $p ;

    /**
     * @var string {@from body} 
     * name of the Author {@required true}
     */
    public $name = 'Name';

    /**
     * @var string {@type email} {@from body}
     * email id of the Author
     */
    public $email = 'name@domain.com';

}

when i fill the values using json default value as follow:

{
    "p":{
    "fname": "aa",
    "lname": "bb",
   },
    "name":"aa",
    "email":"aa@hotmail.com"
}

then click Try it prints

{
  "p": {
    "fname": "First name",
    "lname": "Last name",
    "arr": []
  },
  "name": "aa",
  "email": "aa@hotmail.com"
}

this means that json is submitted but inner object values not processed and not returned to test side.

Was it helpful?

Solution

We just released an update in V3 branch that fixes this. Check it out

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top