【问题标题】:processing inner object values that submitted from testing side to service side处理从测试端提交到服务端的内部对象值
【发布时间】:2013-12-18 11:53:34
【问题描述】:

嗨 Restler/Swagger 的朋友们, 尝试将具有内部对象值的对象值提交到服务端时遇到问题。 对象值提交但内部对象值没有提交到服务端或提交但没有在服务端处理是怎么回事.....

如何提交内部对象值或允许服务端获取这些内部对象? 我需要在服务端更新 php 吗? 如果是,我应该在哪里更新? 请指导我

我的测试类如下:

    /**
     * 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';

}

当我使用 json 默认值填充值时:

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

然后点击试打印

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

这意味着json被提交但内部对象值没有被处理并且没有返回到测试端。

【问题讨论】:

    标签: php api rest restler


    【解决方案1】:

    我们刚刚在 V3 分支中发布了修复此问题的更新。看看吧

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-23
      • 1970-01-01
      • 2010-09-18
      • 1970-01-01
      • 1970-01-01
      • 2019-12-12
      • 1970-01-01
      • 2019-04-30
      相关资源
      最近更新 更多