From 4f9c7a92a1baefaf2cc0eae4df5f05762f835178 Mon Sep 17 00:00:00 2001 From: Casper Meijn Date: Fri, 23 Dec 2022 14:40:42 +0100 Subject: [PATCH] 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). --- app/config/config.yml | 13 +- .../Controller/AnnotationRestController.php | 94 +++-- .../Controller/ConfigRestController.php | 4 +- .../Controller/EntryRestController.php | 384 +++++++++--------- .../Controller/SearchRestController.php | 22 +- .../Controller/TagRestController.php | 36 +- .../Controller/TaggingRuleRestController.php | 4 +- .../Controller/UserRestController.php | 58 ++- .../Controller/WallabagRestController.php | 6 +- 9 files changed, 329 insertions(+), 292 deletions(-) diff --git a/app/config/config.yml b/app/config/config.yml index 00bcbfc0e..c038ae4cc 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -128,12 +128,13 @@ nelmio_api_doc: title: wallabag API documentation description: This is the API documentation of wallabag version: 2.x - securityDefinitions: - Bearer: - type: apiKey - description: 'Value: Bearer {jwt}' - name: Authorization - in: header + components: + securitySchemes: + Bearer: + type: apiKey + description: 'Value: Bearer {jwt}' + name: Authorization + in: header security: - Bearer: [] diff --git a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php index 7eb7a787a..07af53cfb 100644 --- a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php +++ b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php @@ -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" * ) diff --git a/src/Wallabag/ApiBundle/Controller/ConfigRestController.php b/src/Wallabag/ApiBundle/Controller/ConfigRestController.php index a73d6b93e..6539291ff 100644 --- a/src/Wallabag/ApiBundle/Controller/ConfigRestController.php +++ b/src/Wallabag/ApiBundle/Controller/ConfigRestController.php @@ -5,7 +5,7 @@ namespace Wallabag\ApiBundle\Controller; use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerInterface; use Nelmio\ApiDocBundle\Annotation\Operation; -use Swagger\Annotations as SWG; +use OpenApi\Annotations as OA; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Annotation\Route; @@ -17,7 +17,7 @@ class ConfigRestController extends WallabagRestController * @Operation( * tags={"Config"}, * summary="Retrieve configuration for current user.", - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index ef91d7fb8..748e5b0cc 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -5,9 +5,9 @@ namespace Wallabag\ApiBundle\Controller; use Hateoas\Configuration\Route as HateoasRoute; use Hateoas\Representation\Factory\PagerfantaFactory; use Nelmio\ApiDocBundle\Annotation\Operation; +use OpenApi\Annotations as OA; use Pagerfanta\Pagerfanta; use Psr\Log\LoggerInterface; -use Swagger\Annotations as SWG; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -38,46 +38,46 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Check if an entry exist by url.", - * @SWG\Parameter( + * @OA\Parameter( * name="return_id", - * in="body", + * in="query", * description="Set 1 if you want to retrieve ID in case entry(ies) exists, 0 by default", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="url", - * in="body", + * in="query", * description="DEPRECATED, use hashed_url instead. An url", * required=true, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="urls", - * in="body", + * in="query", * description="DEPRECATED, use hashed_urls instead. An array of urls (?urls[]=http...&urls[]=http...)", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="hashed_url", - * in="body", + * in="query", * description="Hashed url using SHA1 to check if it exists. A hashed url", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="hashed_urls", - * in="body", + * in="query", * description="An array of hashed urls using SHA1 to check if they exist. An array of hashed urls (?hashed_urls[]=xxx...&hashed_urls[]=xxx...)", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -153,124 +153,123 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Retrieve all entries. It could be filtered by many options.", - * @SWG\Parameter( + * @OA\Parameter( * name="archive", - * in="body", + * in="query", * description="filter by archived status. all entries by default.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="starred", - * in="body", + * in="query", * description="filter by starred status. all entries by default", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="sort", - * in="body", + * in="query", * description="sort entries by date.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * enum={"created", "updated", "archived"}, * default="created" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="order", - * in="body", + * in="query", * description="order of sort.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * enum={"asc", "desc"}, * default="desc" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="page", - * in="body", + * in="query", * description="what page you want.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * default=1 * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="perPage", - * in="body", + * in="query", * description="results per page.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * default=30 * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="tags", - * in="body", - * description="a list of tags url encoded. Will returns entries that matches ALL tags.", + * in="query", + * description="a comma-seperated list of tags url encoded. Will returns entries that matches ALL tags.", * required=false, - * format="comma-seperated", - * @SWG\Schema( + * @OA\Schema( * type="string", * example="api,rest" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="since", - * in="body", + * in="query", * description="The timestamp since when you want entries updated.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * default=0 * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="public", - * in="body", + * in="query", * description="filter by entries with a public link. all entries by default", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="detail", - * in="body", + * in="query", * description="include content field if 'full'. 'full' by default for backward compatibility.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * enum={"metadata", "full"}, * default="full" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="domain_name", - * in="body", + * in="query", * description="filter entries with the given domain name", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="example.com", * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -347,15 +346,17 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Retrieve a single 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" * ) @@ -379,23 +380,27 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Retrieve a single entry as a predefined format.", - * @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\Parameter( + * @OA\Parameter( * name="_format", * in="path", * description="", * required=true, - * type="string", - * enum={"xml", "json", "txt", "csv", "pdf", "epub", "mobi"}, + * @OA\Schema( + * type="string", + * enum={"xml", "json", "txt", "csv", "pdf", "epub", "mobi"}, + * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -423,14 +428,14 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Handles an entries list and delete URL.", - * @SWG\Parameter( + * @OA\Parameter( * name="urls", - * in="body", + * in="query", * description="Urls (as an array) to delete. A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", * required=true, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -481,14 +486,14 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Handles an entries list and create URL.", - * @SWG\Parameter( + * @OA\Parameter( * name="urls", - * in="formData", + * in="query", * description="Urls (as an array) to create. A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", * required=true, - * type="string" + * @OA\Schema(type="string") * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -553,126 +558,127 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Create an entry.", - * @SWG\Parameter( + * @OA\Parameter( * name="url", - * in="body", + * in="query", * description="Url for the entry.", * required=true, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="http://www.test.com/article.html" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="title", - * in="body", + * in="query", * description="Optional, we'll get the title from the page.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="tags", - * in="body", + * in="query", * description="a comma-separated list of tags.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="tag1,tag2,tag3" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="archive", - * in="body", + * in="query", * description="entry already archived", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="starred", - * in="body", + * in="query", * description="entry already starred", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="content", - * in="body", + * in="query", * description="Content of the entry", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="language", - * in="body", + * in="query", * description="Language of the entry", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="preview_picture", - * in="body", + * in="query", * description="Preview picture of the entry", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="published_at", - * in="body", + * in="query", * description="Published date of the entry", * required=false, - * format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp (integer)", - * @SWG\Schema( + * + * @OA\Schema( * type="string", + * format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp (integer)", * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="authors", - * in="body", + * in="query", * description="Authors of the entry", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="Name Firstname,author2,author3" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="public", - * in="body", + * in="query", * description="will generate a public link for the entry", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="origin_url", - * in="body", + * in="query", * description="Origin url for the entry (from where you found it).", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="http://www.test.com/article.html" * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -769,114 +775,118 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Change several properties of 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\Parameter( + * @OA\Parameter( * name="title", - * in="body", + * in="query", * description="", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="tags", - * in="body", + * in="query", * description="a comma-separated list of tags.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="tag1,tag2,tag3", * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="archive", - * in="body", + * in="query", * description="archived the entry.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="starred", - * in="body", + * in="query", * description="starred the entry.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="content", - * in="body", + * in="query", * description="Content of the entry", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="language", - * in="body", + * in="query", * description="Language of the entry", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="preview_picture", - * in="body", + * in="query", * description="Preview picture of the entry", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="published_at", - * in="body", + * in="query", * description="Published date of the entry", * required=false, - * format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", - * @SWG\Schema(type="datetime|integer") + * @OA\Schema( + * type="datetime|integer", + * format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", + * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="authors", - * in="body", + * in="query", * description="Authors of the entry", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="Name Firstname,author2,author3", * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="public", - * in="body", + * in="query", * description="will generate a public link for the entry", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * enum={"1", "0"}, * default="0" * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="origin_url", - * in="body", + * in="query", * description="Origin url for the entry (from where you found it).", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="http://www.test.com/article.html", * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -983,15 +993,17 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Reload 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" * ) @@ -1037,18 +1049,18 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Delete permanently an entry.", - * @SWG\Parameter( + * @OA\Parameter( * name="expect", - * in="body", + * in="query", * description="Only returns the id instead of the deleted entry's full entity if 'id' is specified.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * enum={"id", "entry"}, * default="entry" * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -1091,15 +1103,17 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Retrieve all tags 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" * ) @@ -1123,25 +1137,27 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Add one or more tags to 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\Parameter( + * @OA\Parameter( * name="tags", - * in="body", + * in="query", * description="a comma-separated list of tags.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="tag1,tag2,tag3", * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -1173,23 +1189,27 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Permanently remove one tag 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\Parameter( + * @OA\Parameter( * name="tag", * in="path", * description="The tag ID", * required=true, - * pattern="\w+", - * type="integer" + * @OA\Schema( + * type="integer", + * pattern="\w+", + * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -1218,14 +1238,14 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Handles an entries list delete tags from them.", - * @SWG\Parameter( + * @OA\Parameter( * name="list", - * in="body", + * in="query", * description="Urls (as an array) to handle. A JSON array of urls [{'url': 'http://...','tags': 'tag1, tag2'}, {'url': 'http://...','tags': 'tag1, tag2'}]", * required=true, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -1285,14 +1305,14 @@ class EntryRestController extends WallabagRestController * @Operation( * tags={"Entries"}, * summary="Handles an entries list and add tags to them.", - * @SWG\Parameter( + * @OA\Parameter( * name="list", - * in="formData", + * in="query", * description="Urls (as an array) to handle. A JSON array of urls [{'url': 'http://...','tags': 'tag1, tag2'}, {'url': 'http://...','tags': 'tag1, tag2'}]", * required=true, - * type="string" + * @OA\Schema(type="string") * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) diff --git a/src/Wallabag/ApiBundle/Controller/SearchRestController.php b/src/Wallabag/ApiBundle/Controller/SearchRestController.php index ad914c6d0..cd71c83f1 100644 --- a/src/Wallabag/ApiBundle/Controller/SearchRestController.php +++ b/src/Wallabag/ApiBundle/Controller/SearchRestController.php @@ -5,9 +5,9 @@ namespace Wallabag\ApiBundle\Controller; use Hateoas\Configuration\Route as HateoasRoute; use Hateoas\Representation\Factory\PagerfantaFactory; use Nelmio\ApiDocBundle\Annotation\Operation; +use OpenApi\Annotations as OA; use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter; use Pagerfanta\Pagerfanta; -use Swagger\Annotations as SWG; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; @@ -21,34 +21,34 @@ class SearchRestController extends WallabagRestController * @Operation( * tags={"Search"}, * summary="Search all entries by term.", - * @SWG\Parameter( + * @OA\Parameter( * name="term", - * in="body", + * in="query", * description="Any query term", * required=false, - * @SWG\Schema(type="string") + * @OA\Schema(type="string") * ), - * @SWG\Parameter( + * @OA\Parameter( * name="page", - * in="body", + * in="query", * description="what page you want.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * default=1 * ) * ), - * @SWG\Parameter( + * @OA\Parameter( * name="perPage", - * in="body", + * in="query", * description="results per page.", * required=false, - * @SWG\Schema( + * @OA\Schema( * type="integer", * default=30 * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) diff --git a/src/Wallabag/ApiBundle/Controller/TagRestController.php b/src/Wallabag/ApiBundle/Controller/TagRestController.php index e50928b7d..03bf8bef9 100644 --- a/src/Wallabag/ApiBundle/Controller/TagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/TagRestController.php @@ -3,7 +3,7 @@ namespace Wallabag\ApiBundle\Controller; use Nelmio\ApiDocBundle\Annotation\Operation; -use Swagger\Annotations as SWG; +use OpenApi\Annotations as OA; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; @@ -20,7 +20,7 @@ class TagRestController extends WallabagRestController * @Operation( * tags={"Tags"}, * summary="Retrieve all tags.", - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -47,15 +47,17 @@ class TagRestController extends WallabagRestController * @Operation( * tags={"Tags"}, * summary="Permanently remove one tag from every entry by passing the Tag label.", - * @SWG\Parameter( + * @OA\Parameter( * name="tag", - * in="body", + * in="query", * description="Tag as a string", * required=true, - * pattern="\w+", - * @SWG\Schema(type="string") + * @OA\Schema( + * type="string", + * pattern="\w+", + * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -93,17 +95,17 @@ class TagRestController extends WallabagRestController * @Operation( * tags={"Tags"}, * summary="Permanently remove some tags from every entry.", - * @SWG\Parameter( + * @OA\Parameter( * name="tags", - * in="body", + * in="query", * description="Tags as strings (comma splitted)", * required=true, - * @SWG\Schema( + * @OA\Schema( * type="string", * example="tag1,tag2", * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -140,15 +142,17 @@ class TagRestController extends WallabagRestController * @Operation( * tags={"Tags"}, * summary="Permanently remove one tag from every entry by passing the Tag ID.", - * @SWG\Parameter( + * @OA\Parameter( * name="tag", - * in="body", + * in="path", * description="The tag", * required=true, - * pattern="\w+", - * @SWG\Schema(type="integer") + * @OA\Schema( + * type="integer", + * pattern="\w+", + * ) * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) diff --git a/src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php b/src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php index d7bf347d1..d20cfb19c 100644 --- a/src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php +++ b/src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php @@ -5,7 +5,7 @@ namespace Wallabag\ApiBundle\Controller; use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerBuilder; use Nelmio\ApiDocBundle\Annotation\Operation; -use Swagger\Annotations as SWG; +use OpenApi\Annotations as OA; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -17,7 +17,7 @@ class TaggingRuleRestController extends WallabagRestController * @Operation( * tags={"TaggingRule"}, * summary="Export all tagging rules as a json file.", - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) diff --git a/src/Wallabag/ApiBundle/Controller/UserRestController.php b/src/Wallabag/ApiBundle/Controller/UserRestController.php index 8f9bf7e3f..64888b33d 100644 --- a/src/Wallabag/ApiBundle/Controller/UserRestController.php +++ b/src/Wallabag/ApiBundle/Controller/UserRestController.php @@ -9,7 +9,7 @@ use FOS\UserBundle\FOSUserEvents; use FOS\UserBundle\Model\UserManagerInterface; use JMS\Serializer\SerializationContext; use Nelmio\ApiDocBundle\Annotation\Operation; -use Swagger\Annotations as SWG; +use OpenApi\Annotations as OA; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -26,7 +26,7 @@ class UserRestController extends WallabagRestController * @Operation( * tags={"User"}, * summary="Retrieve current logged in user informations.", - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -49,35 +49,33 @@ class UserRestController extends WallabagRestController * @Operation( * tags={"User"}, * summary="Register an user and create a client.", - * @SWG\Parameter( - * name="username", - * in="body", - * description="The user's username", - * required=true, - * @SWG\Schema(type="string") + * @OA\RequestBody( + * @OA\JsonContent( + * type="object", + * required={"username", "password", "email", "client_name"}, + * @OA\Property( + * property="username", + * description="The user's username", + * @OA\Schema(type="string") + * ), + * @OA\Property( + * property="password", + * description="The user's password", + * @OA\Schema(type="string") + * ), + * @OA\Property( + * property="email", + * description="The user's email", + * @OA\Schema(type="string") + * ), + * @OA\Property( + * property="client_name", + * description="The client name (to be used by your app)", + * @OA\Schema(type="string") + * ), + * ) * ), - * @SWG\Parameter( - * name="password", - * in="body", - * description="The user's password", - * required=true, - * @SWG\Schema(type="string") - * ), - * @SWG\Parameter( - * name="email", - * in="body", - * description="The user's email", - * required=true, - * @SWG\Schema(type="string") - * ), - * @SWG\Parameter( - * name="client_name", - * in="body", - * description="The client name (to be used by your app)", - * required=true, - * @SWG\Schema(type="string") - * ), - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 43394bd3c..f1b6f83b4 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -7,7 +7,7 @@ use FOS\RestBundle\Controller\AbstractFOSRestController; use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerInterface; use Nelmio\ApiDocBundle\Annotation\Operation; -use Swagger\Annotations as SWG; +use OpenApi\Annotations as OA; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -39,7 +39,7 @@ class WallabagRestController extends AbstractFOSRestController * @Operation( * tags={"Informations"}, * summary="Retrieve version number.", - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * ) @@ -65,7 +65,7 @@ class WallabagRestController extends AbstractFOSRestController * @Operation( * tags={"Informations"}, * summary="Retrieve information about the wallabag instance.", - * @SWG\Response( + * @OA\Response( * response="200", * description="Returned when successful" * )