I am working on swagger ui in php and i am trying to map json like below
{
"category": {
"id": 0,
"name": "string"
}
}
I tried it from swagger ui demos but unable to get mapping like above json, how can i get this json mapping, what would be the annotation for that ? please help
My swagger class is
/**
* @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;
}
And my post api annotation is:
/**
* @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")
* )
*/
And by this i am getting model schema like:
But i want json schema like:
{
"category": {
"id": 0,
"name": "string"
}
}
Please help me..