Laravel Swagger 得到 [语法错误] 预期值,得到“@”
Laravel Swagger getting [Syntax Error] Expected Value, got '@'
我已经为控制器中的函数编写了 Swagger 注释,但在生成 swagger-ui 代码时出现错误。以下是我的注释代码
/*** End of Annotation For deleteNote ***/
/**
* @OA\Delete(
* path="/api/delete-user-note/{note_id}",
* operationId="/api/delete-user-note/{note_id}",
* tags={"Patient Routes"},
* summary= "Delete Note",
* description = "Delete Note",
* @OA\Parameters(
* description="ID note to delete",
* in="path",
* name="note_id",
* required=true,
* @OA\Schema(
* type="integer",
* format="int64"
* )
* ),
当我运行php artisan l5-swagger:generate
我收到错误
[Syntax Error] Expected Value, got '@'
您的注释有误。请使用以下内容更改您的代码。
您需要将 Parameters
替换为 Parameter
。
/*** End of Annotation For deleteNote ***/
/**
* @OA\Delete(
* path="/api/delete-user-note/{note_id}",
* operationId="/api/delete-user-note/{note_id}",
* tags={"Patient Routes"},
* summary= "Delete Note",
* description = "Delete Note",
* @OA\Parameter( //You need to replace Parameters with Parameter
* description="ID note to delete",
* in="path",
* name="note_id",
* required=true,
* @OA\Schema(
* type="integer",
* format="int64"
* )
* ),
我已经为控制器中的函数编写了 Swagger 注释,但在生成 swagger-ui 代码时出现错误。以下是我的注释代码
/*** End of Annotation For deleteNote ***/
/**
* @OA\Delete(
* path="/api/delete-user-note/{note_id}",
* operationId="/api/delete-user-note/{note_id}",
* tags={"Patient Routes"},
* summary= "Delete Note",
* description = "Delete Note",
* @OA\Parameters(
* description="ID note to delete",
* in="path",
* name="note_id",
* required=true,
* @OA\Schema(
* type="integer",
* format="int64"
* )
* ),
当我运行php artisan l5-swagger:generate
我收到错误
[Syntax Error] Expected Value, got '@'
您的注释有误。请使用以下内容更改您的代码。
您需要将 Parameters
替换为 Parameter
。
/*** End of Annotation For deleteNote ***/
/**
* @OA\Delete(
* path="/api/delete-user-note/{note_id}",
* operationId="/api/delete-user-note/{note_id}",
* tags={"Patient Routes"},
* summary= "Delete Note",
* description = "Delete Note",
* @OA\Parameter( //You need to replace Parameters with Parameter
* description="ID note to delete",
* in="path",
* name="note_id",
* required=true,
* @OA\Schema(
* type="integer",
* format="int64"
* )
* ),