Update annotations to OpenApi 3

Most of the API annotations are directly converted. The changes in meaning are:
- Parameters "in body" is not supported anymore. These are changed to "in query" or to a request body (depending on the code).
This commit is contained in:
Casper Meijn
2022-12-23 14:40:42 +01:00
parent 045f2ffdcc
commit 4f9c7a92a1
9 changed files with 329 additions and 292 deletions

View File

@ -3,8 +3,8 @@
namespace Wallabag\ApiBundle\Controller;
use Nelmio\ApiDocBundle\Annotation\Operation;
use OpenApi\Annotations as OA;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Swagger\Annotations as SWG;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
@ -19,15 +19,17 @@ class AnnotationRestController extends WallabagRestController
* @Operation(
* tags={"Annotations"},
* summary="Retrieve annotations for an entry.",
* @SWG\Parameter(
* @OA\Parameter(
* name="entry",
* in="path",
* description="The entry ID",
* required=true,
* pattern="\w+",
* type="integer"
* @OA\Schema(
* type="integer",
* pattern="\w+",
* )
* ),
* @SWG\Response(
* @OA\Response(
* response="200",
* description="Returned when successful"
* )
@ -52,40 +54,48 @@ class AnnotationRestController extends WallabagRestController
* @Operation(
* tags={"Annotations"},
* summary="Creates a new annotation.",
* @SWG\Parameter(
* @OA\Parameter(
* name="entry",
* in="path",
* description="The entry ID",
* required=true,
* pattern="\w+",
* type="integer"
* ),
* @SWG\Parameter(
* name="ranges",
* in="body",
* description="The range array for the annotation",
* required=false,
* pattern="\w+",
* @SWG\Schema(
* type="array",
* @SWG\Items(type="string")
* @OA\Schema(
* type="integer",
* pattern="\w+",
* )
* ),
* @SWG\Parameter(
* name="quote",
* in="body",
* description="The annotated text",
* required=false,
* @SWG\Schema(type="string")
* @OA\RequestBody(
* @OA\JsonContent(
* type="object",
* required={"text"},
* @OA\Property(
* property="ranges",
* type="array",
* description="The range array for the annotation",
* @OA\Items(
* type="string",
* pattern="\w+",
* )
* ),
* @OA\Property(
* property="quote",
* type="array",
* description="The annotated text",
* @OA\Items(
* type="string",
* )
* ),
* @OA\Property(
* property="text",
* type="array",
* description="Content of annotation",
* @OA\Items(
* type="string",
* )
* ),
* )
* ),
* @SWG\Parameter(
* name="text",
* in="body",
* description="Content of annotation",
* required=true,
* @SWG\Schema(type="string")
* ),
* @SWG\Response(
* @OA\Response(
* response="200",
* description="Returned when successful"
* )
@ -111,15 +121,17 @@ class AnnotationRestController extends WallabagRestController
* @Operation(
* tags={"Annotations"},
* summary="Updates an annotation.",
* @SWG\Parameter(
* @OA\Parameter(
* name="annotation",
* in="path",
* description="The annotation ID",
* required=true,
* pattern="\w+",
* type="string"
* @OA\Schema(
* type="string",
* pattern="\w+",
* )
* ),
* @SWG\Response(
* @OA\Response(
* response="200",
* description="Returned when successful"
* )
@ -146,15 +158,17 @@ class AnnotationRestController extends WallabagRestController
* @Operation(
* tags={"Annotations"},
* summary="Removes an annotation.",
* @SWG\Parameter(
* @OA\Parameter(
* name="annotation",
* in="path",
* description="The annotation ID",
* required=true,
* pattern="\w+",
* type="string"
* @OA\Schema(
* type="string",
* pattern="\w+",
* )
* ),
* @SWG\Response(
* @OA\Response(
* response="200",
* description="Returned when successful"
* )