我使用的是最新版本的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;
}
答案 0 :(得分:0)
如果您的课程已版本化,例如在命名空间v1 \ Actions中,您还必须在命名空间中注释返回类型,例如@return v1 \ ActionList