Swagger PHP,模型不起作用
Swagger PHP, model doesn't work
我无法让它与我的模型一起工作; "comment" 方式和代码方式。
谁能帮帮我?操作注释上的 "type" 字段不生效。
$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",
]),
)
])
)
]);
我知道了..
$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]) : []),
....
我无法让它与我的模型一起工作; "comment" 方式和代码方式。
谁能帮帮我?操作注释上的 "type" 字段不生效。
$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",
]),
)
])
)
]);
我知道了..
$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]) : []),
....