mirror of
https://github.com/wallabag/wallabag.git
synced 2024-05-31 23:48:06 +00:00
470a8575c0
Convert ApiDoc to Swagger
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Wallabag\ApiBundle\Controller;
|
|
|
|
use JMS\Serializer\SerializationContext;
|
|
use JMS\Serializer\SerializerInterface;
|
|
use Nelmio\ApiDocBundle\Annotation\Operation;
|
|
use Swagger\Annotations as SWG;
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
|
|
class ConfigRestController extends WallabagRestController
|
|
{
|
|
/**
|
|
* Retrieve configuration for current user.
|
|
*
|
|
* @Operation(
|
|
* tags={"Config"},
|
|
* summary="Retrieve configuration for current user.",
|
|
* @SWG\Response(
|
|
* response="200",
|
|
* description="Returned when successful"
|
|
* )
|
|
* )
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function getConfigAction()
|
|
{
|
|
$this->validateAuthentication();
|
|
|
|
$json = $this->get(SerializerInterface::class)->serialize(
|
|
$this->getUser()->getConfig(),
|
|
'json',
|
|
SerializationContext::create()->setGroups(['config_api'])
|
|
);
|
|
|
|
return (new JsonResponse())
|
|
->setJson($json)
|
|
->setStatusCode(JsonResponse::HTTP_OK);
|
|
}
|
|
}
|