【发布时间】:2013-01-22 14:15:51
【问题描述】:
我使用的是最新版本的 Restler v3(提交 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;
}
【问题讨论】: