0

我正在使用最新版本的 Restler v3 (commit 0d79cd8),但我遇到了一些问题,我的基于 Swagger 的 UI 看起来与示例中的相同。我注意到的两个问题是没有显示变量类型和@return 对象。

在 Restler 网站上,这是这两种工作的一个很好的例子:

例子

相反,在我的Actions课程中,我得到了这个:

在此处输入图像描述

然而,正如您从类的定义中看到的那样,指定了类型信息和响应对象:

class Actions {
    /**
    * LIST action types
    *
    * List all the action-types available
    *
    * @url GET /
    */
    function list_actions() {
        throw new RestException(501);
    }

    /**
     * GET today's Actions
     *
     * Get the set of actions done today
     *
     * @url GET /{user_id}
     * @param integer $user_id The user_id for whom the actions apply; you can insert the text "self" and it will resolve to the current/default user
     * @param string $time_of_day {@from url} Allow's you to optionally set a time-of-day; if set then actions are only returned after that. Time should be in the format of HH:MM:SS
     * @return ActionList
    */
    public function action_today ($user_id, $time_of_day = false )
    {
        throw new RestException(501, "Today's actions for user '{$user_id}' not implemented.");
    }

我对 ActionList 类的定义是:

class ActionList {

    /**
     * Unique identifier of action
     *
     * @var     integer
    */
    public $action_id;
    /**
     * String based unique identifier
     *
     * @var     string
    */
    public $action_slug;

}
4

1 回答 1

0

如果您的类是版本化的,例如在命名空间 v1\Actions 中,您也必须在命名空间中注释返回类型,例如 @return v1\ActionList

于 2013-10-16T02:14:00.757 回答