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

@ -128,7 +128,8 @@ nelmio_api_doc:
title: wallabag API documentation title: wallabag API documentation
description: This is the API documentation of wallabag description: This is the API documentation of wallabag
version: 2.x version: 2.x
securityDefinitions: components:
securitySchemes:
Bearer: Bearer:
type: apiKey type: apiKey
description: 'Value: Bearer {jwt}' description: 'Value: Bearer {jwt}'

View file

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

View file

@ -5,7 +5,7 @@ namespace Wallabag\ApiBundle\Controller;
use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializationContext;
use JMS\Serializer\SerializerInterface; use JMS\Serializer\SerializerInterface;
use Nelmio\ApiDocBundle\Annotation\Operation; use Nelmio\ApiDocBundle\Annotation\Operation;
use Swagger\Annotations as SWG; use OpenApi\Annotations as OA;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
@ -17,7 +17,7 @@ class ConfigRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Config"}, * tags={"Config"},
* summary="Retrieve configuration for current user.", * summary="Retrieve configuration for current user.",
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )

View file

@ -5,9 +5,9 @@ namespace Wallabag\ApiBundle\Controller;
use Hateoas\Configuration\Route as HateoasRoute; use Hateoas\Configuration\Route as HateoasRoute;
use Hateoas\Representation\Factory\PagerfantaFactory; use Hateoas\Representation\Factory\PagerfantaFactory;
use Nelmio\ApiDocBundle\Annotation\Operation; use Nelmio\ApiDocBundle\Annotation\Operation;
use OpenApi\Annotations as OA;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Swagger\Annotations as SWG;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -38,46 +38,46 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Check if an entry exist by url.", * summary="Check if an entry exist by url.",
* @SWG\Parameter( * @OA\Parameter(
* name="return_id", * name="return_id",
* in="body", * in="query",
* description="Set 1 if you want to retrieve ID in case entry(ies) exists, 0 by default", * description="Set 1 if you want to retrieve ID in case entry(ies) exists, 0 by default",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="url", * name="url",
* in="body", * in="query",
* description="DEPRECATED, use hashed_url instead. An url", * description="DEPRECATED, use hashed_url instead. An url",
* required=true, * required=true,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="urls", * name="urls",
* in="body", * in="query",
* description="DEPRECATED, use hashed_urls instead. An array of urls (?urls[]=http...&urls[]=http...)", * description="DEPRECATED, use hashed_urls instead. An array of urls (?urls[]=http...&urls[]=http...)",
* required=false, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="hashed_url", * name="hashed_url",
* in="body", * in="query",
* description="Hashed url using SHA1 to check if it exists. A hashed url", * description="Hashed url using SHA1 to check if it exists. A hashed url",
* required=false, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="hashed_urls", * 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...)", * 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, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -153,124 +153,123 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Retrieve all entries. It could be filtered by many options.", * summary="Retrieve all entries. It could be filtered by many options.",
* @SWG\Parameter( * @OA\Parameter(
* name="archive", * name="archive",
* in="body", * in="query",
* description="filter by archived status. all entries by default.", * description="filter by archived status. all entries by default.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="starred", * name="starred",
* in="body", * in="query",
* description="filter by starred status. all entries by default", * description="filter by starred status. all entries by default",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="sort", * name="sort",
* in="body", * in="query",
* description="sort entries by date.", * description="sort entries by date.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* enum={"created", "updated", "archived"}, * enum={"created", "updated", "archived"},
* default="created" * default="created"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="order", * name="order",
* in="body", * in="query",
* description="order of sort.", * description="order of sort.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* enum={"asc", "desc"}, * enum={"asc", "desc"},
* default="desc" * default="desc"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="page", * name="page",
* in="body", * in="query",
* description="what page you want.", * description="what page you want.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* default=1 * default=1
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="perPage", * name="perPage",
* in="body", * in="query",
* description="results per page.", * description="results per page.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* default=30 * default=30
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="tags", * name="tags",
* in="body", * in="query",
* description="a list of tags url encoded. Will returns entries that matches ALL tags.", * description="a comma-seperated list of tags url encoded. Will returns entries that matches ALL tags.",
* required=false, * required=false,
* format="comma-seperated", * @OA\Schema(
* @SWG\Schema(
* type="string", * type="string",
* example="api,rest" * example="api,rest"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="since", * name="since",
* in="body", * in="query",
* description="The timestamp since when you want entries updated.", * description="The timestamp since when you want entries updated.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* default=0 * default=0
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="public", * name="public",
* in="body", * in="query",
* description="filter by entries with a public link. all entries by default", * description="filter by entries with a public link. all entries by default",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="detail", * name="detail",
* in="body", * in="query",
* description="include content field if 'full'. 'full' by default for backward compatibility.", * description="include content field if 'full'. 'full' by default for backward compatibility.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* enum={"metadata", "full"}, * enum={"metadata", "full"},
* default="full" * default="full"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="domain_name", * name="domain_name",
* in="body", * in="query",
* description="filter entries with the given domain name", * description="filter entries with the given domain name",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="example.com", * example="example.com",
* ) * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -347,15 +346,17 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Retrieve a single entry.", * summary="Retrieve a single entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="entry", * name="entry",
* in="path", * in="path",
* description="The entry ID", * description="The entry ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -379,23 +380,27 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Retrieve a single entry as a predefined format.", * summary="Retrieve a single entry as a predefined format.",
* @SWG\Parameter( * @OA\Parameter(
* name="entry", * name="entry",
* in="path", * in="path",
* description="The entry ID", * description="The entry ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="_format", * name="_format",
* in="path", * in="path",
* description="", * description="",
* required=true, * required=true,
* @OA\Schema(
* type="string", * type="string",
* enum={"xml", "json", "txt", "csv", "pdf", "epub", "mobi"}, * enum={"xml", "json", "txt", "csv", "pdf", "epub", "mobi"},
* )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -423,14 +428,14 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Handles an entries list and delete URL.", * summary="Handles an entries list and delete URL.",
* @SWG\Parameter( * @OA\Parameter(
* name="urls", * name="urls",
* in="body", * in="query",
* description="Urls (as an array) to delete. A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", * description="Urls (as an array) to delete. A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]",
* required=true, * required=true,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -481,14 +486,14 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Handles an entries list and create URL.", * summary="Handles an entries list and create URL.",
* @SWG\Parameter( * @OA\Parameter(
* name="urls", * name="urls",
* in="formData", * in="query",
* description="Urls (as an array) to create. A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]", * description="Urls (as an array) to create. A JSON array of urls [{'url': 'http://...'}, {'url': 'http://...'}]",
* required=true, * required=true,
* type="string" * @OA\Schema(type="string")
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -553,126 +558,127 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Create an entry.", * summary="Create an entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="url", * name="url",
* in="body", * in="query",
* description="Url for the entry.", * description="Url for the entry.",
* required=true, * required=true,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="http://www.test.com/article.html" * example="http://www.test.com/article.html"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="title", * name="title",
* in="body", * in="query",
* description="Optional, we'll get the title from the page.", * description="Optional, we'll get the title from the page.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="tags", * name="tags",
* in="body", * in="query",
* description="a comma-separated list of tags.", * description="a comma-separated list of tags.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="tag1,tag2,tag3" * example="tag1,tag2,tag3"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="archive", * name="archive",
* in="body", * in="query",
* description="entry already archived", * description="entry already archived",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="starred", * name="starred",
* in="body", * in="query",
* description="entry already starred", * description="entry already starred",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="content", * name="content",
* in="body", * in="query",
* description="Content of the entry", * description="Content of the entry",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string" * type="string"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="language", * name="language",
* in="body", * in="query",
* description="Language of the entry", * description="Language of the entry",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string" * type="string"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="preview_picture", * name="preview_picture",
* in="body", * in="query",
* description="Preview picture of the entry", * description="Preview picture of the entry",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string" * type="string"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="published_at", * name="published_at",
* in="body", * in="query",
* description="Published date of the entry", * description="Published date of the entry",
* required=false, * required=false,
* format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp (integer)", *
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp (integer)",
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="authors", * name="authors",
* in="body", * in="query",
* description="Authors of the entry", * description="Authors of the entry",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="Name Firstname,author2,author3" * example="Name Firstname,author2,author3"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="public", * name="public",
* in="body", * in="query",
* description="will generate a public link for the entry", * description="will generate a public link for the entry",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="origin_url", * name="origin_url",
* in="body", * in="query",
* description="Origin url for the entry (from where you found it).", * description="Origin url for the entry (from where you found it).",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="http://www.test.com/article.html" * example="http://www.test.com/article.html"
* ) * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -769,114 +775,118 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Change several properties of an entry.", * summary="Change several properties of an entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="entry", * name="entry",
* in="path", * in="path",
* description="The entry ID", * description="The entry ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="title", * name="title",
* in="body", * in="query",
* description="", * description="",
* required=false, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="tags", * name="tags",
* in="body", * in="query",
* description="a comma-separated list of tags.", * description="a comma-separated list of tags.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="tag1,tag2,tag3", * example="tag1,tag2,tag3",
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="archive", * name="archive",
* in="body", * in="query",
* description="archived the entry.", * description="archived the entry.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="starred", * name="starred",
* in="body", * in="query",
* description="starred the entry.", * description="starred the entry.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="content", * name="content",
* in="body", * in="query",
* description="Content of the entry", * description="Content of the entry",
* required=false, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="language", * name="language",
* in="body", * in="query",
* description="Language of the entry", * description="Language of the entry",
* required=false, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="preview_picture", * name="preview_picture",
* in="body", * in="query",
* description="Preview picture of the entry", * description="Preview picture of the entry",
* required=false, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="published_at", * name="published_at",
* in="body", * in="query",
* description="Published date of the entry", * description="Published date of the entry",
* required=false, * required=false,
* @OA\Schema(
* type="datetime|integer",
* format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", * format="YYYY-MM-DDTHH:II:SS+TZ or a timestamp",
* @SWG\Schema(type="datetime|integer") * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="authors", * name="authors",
* in="body", * in="query",
* description="Authors of the entry", * description="Authors of the entry",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="Name Firstname,author2,author3", * example="Name Firstname,author2,author3",
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="public", * name="public",
* in="body", * in="query",
* description="will generate a public link for the entry", * description="will generate a public link for the entry",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* enum={"1", "0"}, * enum={"1", "0"},
* default="0" * default="0"
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="origin_url", * name="origin_url",
* in="body", * in="query",
* description="Origin url for the entry (from where you found it).", * description="Origin url for the entry (from where you found it).",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="http://www.test.com/article.html", * example="http://www.test.com/article.html",
* ) * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -983,15 +993,17 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Reload an entry.", * summary="Reload an entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="entry", * name="entry",
* in="path", * in="path",
* description="The entry ID", * description="The entry ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -1037,18 +1049,18 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Delete permanently an entry.", * summary="Delete permanently an entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="expect", * name="expect",
* in="body", * in="query",
* description="Only returns the id instead of the deleted entry's full entity if 'id' is specified.", * description="Only returns the id instead of the deleted entry's full entity if 'id' is specified.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* enum={"id", "entry"}, * enum={"id", "entry"},
* default="entry" * default="entry"
* ) * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -1091,15 +1103,17 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Retrieve all tags for an entry.", * summary="Retrieve all tags for an entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="entry", * name="entry",
* in="path", * in="path",
* description="The entry ID", * description="The entry ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -1123,25 +1137,27 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Add one or more tags to an entry.", * summary="Add one or more tags to an entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="entry", * name="entry",
* in="path", * in="path",
* description="The entry ID", * description="The entry ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="tags", * name="tags",
* in="body", * in="query",
* description="a comma-separated list of tags.", * description="a comma-separated list of tags.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="tag1,tag2,tag3", * example="tag1,tag2,tag3",
* ) * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -1173,23 +1189,27 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Permanently remove one tag for an entry.", * summary="Permanently remove one tag for an entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="entry", * name="entry",
* in="path", * in="path",
* description="The entry ID", * description="The entry ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="tag", * name="tag",
* in="path", * in="path",
* description="The tag ID", * description="The tag ID",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* type="integer" * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -1218,14 +1238,14 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Handles an entries list delete tags from them.", * summary="Handles an entries list delete tags from them.",
* @SWG\Parameter( * @OA\Parameter(
* name="list", * 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'}]", * description="Urls (as an array) to handle. A JSON array of urls [{'url': 'http://...','tags': 'tag1, tag2'}, {'url': 'http://...','tags': 'tag1, tag2'}]",
* required=true, * required=true,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -1285,14 +1305,14 @@ class EntryRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Entries"}, * tags={"Entries"},
* summary="Handles an entries list and add tags to them.", * summary="Handles an entries list and add tags to them.",
* @SWG\Parameter( * @OA\Parameter(
* name="list", * 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'}]", * description="Urls (as an array) to handle. A JSON array of urls [{'url': 'http://...','tags': 'tag1, tag2'}, {'url': 'http://...','tags': 'tag1, tag2'}]",
* required=true, * required=true,
* type="string" * @OA\Schema(type="string")
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )

View file

@ -5,9 +5,9 @@ namespace Wallabag\ApiBundle\Controller;
use Hateoas\Configuration\Route as HateoasRoute; use Hateoas\Configuration\Route as HateoasRoute;
use Hateoas\Representation\Factory\PagerfantaFactory; use Hateoas\Representation\Factory\PagerfantaFactory;
use Nelmio\ApiDocBundle\Annotation\Operation; use Nelmio\ApiDocBundle\Annotation\Operation;
use OpenApi\Annotations as OA;
use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter; use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
use Swagger\Annotations as SWG;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
@ -21,34 +21,34 @@ class SearchRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Search"}, * tags={"Search"},
* summary="Search all entries by term.", * summary="Search all entries by term.",
* @SWG\Parameter( * @OA\Parameter(
* name="term", * name="term",
* in="body", * in="query",
* description="Any query term", * description="Any query term",
* required=false, * required=false,
* @SWG\Schema(type="string") * @OA\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="page", * name="page",
* in="body", * in="query",
* description="what page you want.", * description="what page you want.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* default=1 * default=1
* ) * )
* ), * ),
* @SWG\Parameter( * @OA\Parameter(
* name="perPage", * name="perPage",
* in="body", * in="query",
* description="results per page.", * description="results per page.",
* required=false, * required=false,
* @SWG\Schema( * @OA\Schema(
* type="integer", * type="integer",
* default=30 * default=30
* ) * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )

View file

@ -3,7 +3,7 @@
namespace Wallabag\ApiBundle\Controller; namespace Wallabag\ApiBundle\Controller;
use Nelmio\ApiDocBundle\Annotation\Operation; use Nelmio\ApiDocBundle\Annotation\Operation;
use Swagger\Annotations as SWG; use OpenApi\Annotations as OA;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
@ -20,7 +20,7 @@ class TagRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Tags"}, * tags={"Tags"},
* summary="Retrieve all tags.", * summary="Retrieve all tags.",
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -47,15 +47,17 @@ class TagRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Tags"}, * tags={"Tags"},
* summary="Permanently remove one tag from every entry by passing the Tag label.", * summary="Permanently remove one tag from every entry by passing the Tag label.",
* @SWG\Parameter( * @OA\Parameter(
* name="tag", * name="tag",
* in="body", * in="query",
* description="Tag as a string", * description="Tag as a string",
* required=true, * required=true,
* @OA\Schema(
* type="string",
* pattern="\w+", * pattern="\w+",
* @SWG\Schema(type="string") * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -93,17 +95,17 @@ class TagRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Tags"}, * tags={"Tags"},
* summary="Permanently remove some tags from every entry.", * summary="Permanently remove some tags from every entry.",
* @SWG\Parameter( * @OA\Parameter(
* name="tags", * name="tags",
* in="body", * in="query",
* description="Tags as strings (comma splitted)", * description="Tags as strings (comma splitted)",
* required=true, * required=true,
* @SWG\Schema( * @OA\Schema(
* type="string", * type="string",
* example="tag1,tag2", * example="tag1,tag2",
* ) * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -140,15 +142,17 @@ class TagRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"Tags"}, * tags={"Tags"},
* summary="Permanently remove one tag from every entry by passing the Tag ID.", * summary="Permanently remove one tag from every entry by passing the Tag ID.",
* @SWG\Parameter( * @OA\Parameter(
* name="tag", * name="tag",
* in="body", * in="path",
* description="The tag", * description="The tag",
* required=true, * required=true,
* @OA\Schema(
* type="integer",
* pattern="\w+", * pattern="\w+",
* @SWG\Schema(type="integer") * )
* ), * ),
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )

View file

@ -5,7 +5,7 @@ namespace Wallabag\ApiBundle\Controller;
use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializationContext;
use JMS\Serializer\SerializerBuilder; use JMS\Serializer\SerializerBuilder;
use Nelmio\ApiDocBundle\Annotation\Operation; use Nelmio\ApiDocBundle\Annotation\Operation;
use Swagger\Annotations as SWG; use OpenApi\Annotations as OA;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
@ -17,7 +17,7 @@ class TaggingRuleRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"TaggingRule"}, * tags={"TaggingRule"},
* summary="Export all tagging rules as a json file.", * summary="Export all tagging rules as a json file.",
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )

View file

@ -9,7 +9,7 @@ use FOS\UserBundle\FOSUserEvents;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializationContext;
use Nelmio\ApiDocBundle\Annotation\Operation; use Nelmio\ApiDocBundle\Annotation\Operation;
use Swagger\Annotations as SWG; use OpenApi\Annotations as OA;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -26,7 +26,7 @@ class UserRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"User"}, * tags={"User"},
* summary="Retrieve current logged in user informations.", * summary="Retrieve current logged in user informations.",
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -49,35 +49,33 @@ class UserRestController extends WallabagRestController
* @Operation( * @Operation(
* tags={"User"}, * tags={"User"},
* summary="Register an user and create a client.", * summary="Register an user and create a client.",
* @SWG\Parameter( * @OA\RequestBody(
* name="username", * @OA\JsonContent(
* in="body", * type="object",
* required={"username", "password", "email", "client_name"},
* @OA\Property(
* property="username",
* description="The user's username", * description="The user's username",
* required=true, * @OA\Schema(type="string")
* @SWG\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Property(
* name="password", * property="password",
* in="body",
* description="The user's password", * description="The user's password",
* required=true, * @OA\Schema(type="string")
* @SWG\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Property(
* name="email", * property="email",
* in="body",
* description="The user's email", * description="The user's email",
* required=true, * @OA\Schema(type="string")
* @SWG\Schema(type="string")
* ), * ),
* @SWG\Parameter( * @OA\Property(
* name="client_name", * property="client_name",
* in="body",
* description="The client name (to be used by your app)", * description="The client name (to be used by your app)",
* required=true, * @OA\Schema(type="string")
* @SWG\Schema(type="string")
* ), * ),
* @SWG\Response( * )
* ),
* @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )

View file

@ -7,7 +7,7 @@ use FOS\RestBundle\Controller\AbstractFOSRestController;
use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializationContext;
use JMS\Serializer\SerializerInterface; use JMS\Serializer\SerializerInterface;
use Nelmio\ApiDocBundle\Annotation\Operation; use Nelmio\ApiDocBundle\Annotation\Operation;
use Swagger\Annotations as SWG; use OpenApi\Annotations as OA;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@ -39,7 +39,7 @@ class WallabagRestController extends AbstractFOSRestController
* @Operation( * @Operation(
* tags={"Informations"}, * tags={"Informations"},
* summary="Retrieve version number.", * summary="Retrieve version number.",
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )
@ -65,7 +65,7 @@ class WallabagRestController extends AbstractFOSRestController
* @Operation( * @Operation(
* tags={"Informations"}, * tags={"Informations"},
* summary="Retrieve information about the wallabag instance.", * summary="Retrieve information about the wallabag instance.",
* @SWG\Response( * @OA\Response(
* response="200", * response="200",
* description="Returned when successful" * description="Returned when successful"
* ) * )