我正在用 php 处理 swagger ui,我正在尝试像下面那样映射 json
{
"category": {
"id": 0,
"name": "string"
}
}
我从 swagger ui demos 中尝试过,但无法像上面的 json 那样得到映射,我怎样才能得到这个 json 映射,它的注释是什么?请帮忙
我的招摇班是
/**
* @SWG\Definition(@SWG\Xml(name="MyFl"))
*/
class MyFl
{
/**
* @SWG\Property(format="int64")
* @var int
*/
public $id;
/**
* @SWG\Property(example="doggie")
* @var string
*/
public $name;
/**
* @SWG\Property(type="Category")
*/
public $category;
}
我的post api注释是:
/**
* @SWG\Post(
* path="/docs/fl",
* tags={"MY"},
* summary="Insert fl info",
* operationId="FL",
* produces={"application/xml","application/json"},
* @SWG\Parameter(in="body",name="body",description="Insert fl info",required=true,@SWG\Schema(ref="#/definitions/MyFl")
* ),
* @SWG\Response(response="default", description="successful operation")
* )
*/
通过这个我得到模型模式,如:
但我想要 json 模式,如:
{
"category": {
"id": 0,
"name": "string"
}
}
请帮我..