生成时出现 SWAGGER-PHP 错误。json 我无法从我的模型中加载值
SWAGGER-PHP error when generating .json I can not load the values from my model
大家好,我试图消除生成 swagger.json 时仍然存在的错误,错误显示:
[WARN] [Syntax Error] Expected Value, got '@' in
\App\Http\Controllers... and in my code, OHH iM WORKING WITH LUMEN.
/**
* @SWG\Put(
* path="/v1/resource/{id1}/rsc/{id2}",
* summary="Update ...",
* operationId="update",
* tags={"Update"},
*
*
* @SWG\Response(response=200, description="Json [client] "),
* @SWG\Response(response=404, description="Recurso no encontrado"),
* @SWG\Response(response=500, description="[error] Error interno del servidor"),
* @SWG\Parameter(
* name="id1",
* in="path",
* description="Id1.",
* required=true,
* type="integer"
* ),
* @SWG\Parameter(
* name="id2",
* in="path",
* description="Id2",
* required=true,
* type="integer"
* ),
* @SWG\Parameter(
* name="JSON update body",
* in="body",
* description="Request.",
* required=true,
* @SWG\Schema(type="array",@Model(type=vendor\LibModel\DAO\src\Model\Hospital))
* )
* )
*/
public function update($id1,$id2, Request $request){...}
当我检查 json 不生成定义时 -> "definitions": {}。
我的模型按以下方式定义它,我不知道问题是否出在我的模型在不同的命名空间下,因为它被定义为供应商或我缺少的声明:
/**
* Class Hospital
*
*
* @SWG\Definition(
* definition="Hospital"
* )
*
*/
class Hospital extends Model
{
/**
* @SWG\Property(format="string")
* @var string
*/
protected $name;
/**
* @SWG\Property(format="string")
* @var string
*/
protected $email;
..在我看来swagger m出现ERROR ...我认为是因为它没有加载模型的值,感谢谁能帮助我
学说解析器抱怨 @Model
是 不是 swagger-php.
的一部分
swagger-php 表示法是:
* @SWG\Parameter(
* name="JSON update body",
* in="body",
* description="Request.",
* required=true,
* @SWG\Schema(
* type="array",
* @SWG\Items(ref="#/definitions/Hospital")
* )
* )
我不想使用 NelmioApiDocBundle(它使用 @Model
注释)查看他们的指南以了解如何设置它。
大家好,我试图消除生成 swagger.json 时仍然存在的错误,错误显示:
[WARN] [Syntax Error] Expected Value, got '@' in \App\Http\Controllers... and in my code, OHH iM WORKING WITH LUMEN.
/**
* @SWG\Put(
* path="/v1/resource/{id1}/rsc/{id2}",
* summary="Update ...",
* operationId="update",
* tags={"Update"},
*
*
* @SWG\Response(response=200, description="Json [client] "),
* @SWG\Response(response=404, description="Recurso no encontrado"),
* @SWG\Response(response=500, description="[error] Error interno del servidor"),
* @SWG\Parameter(
* name="id1",
* in="path",
* description="Id1.",
* required=true,
* type="integer"
* ),
* @SWG\Parameter(
* name="id2",
* in="path",
* description="Id2",
* required=true,
* type="integer"
* ),
* @SWG\Parameter(
* name="JSON update body",
* in="body",
* description="Request.",
* required=true,
* @SWG\Schema(type="array",@Model(type=vendor\LibModel\DAO\src\Model\Hospital))
* )
* )
*/
public function update($id1,$id2, Request $request){...}
当我检查 json 不生成定义时 -> "definitions": {}。 我的模型按以下方式定义它,我不知道问题是否出在我的模型在不同的命名空间下,因为它被定义为供应商或我缺少的声明:
/**
* Class Hospital
*
*
* @SWG\Definition(
* definition="Hospital"
* )
*
*/
class Hospital extends Model
{
/**
* @SWG\Property(format="string")
* @var string
*/
protected $name;
/**
* @SWG\Property(format="string")
* @var string
*/
protected $email;
..在我看来swagger m出现ERROR ...我认为是因为它没有加载模型的值,感谢谁能帮助我
学说解析器抱怨 @Model
是 不是 swagger-php.
swagger-php 表示法是:
* @SWG\Parameter(
* name="JSON update body",
* in="body",
* description="Request.",
* required=true,
* @SWG\Schema(
* type="array",
* @SWG\Items(ref="#/definitions/Hospital")
* )
* )
我不想使用 NelmioApiDocBundle(它使用 @Model
注释)查看他们的指南以了解如何设置它。