我无法使用我的模型;两者都以“评论”的方式和代码方式。
任何人都可以帮帮我吗?操作注释中的“类型”字段不会产生任何影响。
$swagger = $this->app["swagger"];
$swagger->models["user"] = new \Swagger\Annotations\Model([
"id" => "user",
"properties" => array(
new \Swagger\Annotations\Property([
"name" => "test", "type"=>"string"
])
)
]);
$path="/users";
$name="user";
$serivce = "Users";
$swagger->registry[$path] = new \Swagger\Annotations\Resource([
'resourcePath' => $path,
'basePath'=>"/".$this->app['api.version'],
'apis' => array(
new \Swagger\Annotations\API([
'path' => $path,
'operations' => array(
new \Swagger\Annotations\Operation([
'method' => "GET",
'summary' => "Returns a list of ".ucfirst($service),
'nickname' => "GetAll".ucfirst($service),
'type' => "user",
]),
)
])
)
]);
答案 0 :(得分:0)
$swagger->registry[$path] = new \Swagger\Annotations\Resource([
'resourcePath' => $path,
'basePath'=>"/api/".$this->app['api.version'],
'models' => ($swagger->models[$name]->id ? array($name=>$swagger->models[$name]) : []),
....