2016-07-12 00:33:55 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2016-12-29 12:09:26 +01:00
|
|
|
* This file is part of the NelmioApiDocBundle package.
|
2016-07-12 00:33:55 +02:00
|
|
|
*
|
2016-12-29 12:09:26 +01:00
|
|
|
* (c) Nelmio
|
2016-07-12 00:33:55 +02:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2016-12-29 12:09:26 +01:00
|
|
|
namespace Nelmio\ApiDocBundle\Tests\Functional\Controller;
|
2016-07-12 00:33:55 +02:00
|
|
|
|
2016-11-30 16:21:03 +01:00
|
|
|
use FOS\RestBundle\Controller\Annotations\QueryParam;
|
|
|
|
use FOS\RestBundle\Controller\Annotations\RequestParam;
|
2017-01-14 17:36:56 +01:00
|
|
|
use Nelmio\ApiDocBundle\Annotation\Model;
|
2017-03-16 19:35:04 +01:00
|
|
|
use Nelmio\ApiDocBundle\Annotation\Operation;
|
2017-01-14 17:36:56 +01:00
|
|
|
use Nelmio\ApiDocBundle\Tests\Functional\Entity\User;
|
2016-07-12 00:33:55 +02:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
2016-12-30 13:37:02 +01:00
|
|
|
use Swagger\Annotations as SWG;
|
2016-07-12 00:33:55 +02:00
|
|
|
|
2016-11-30 14:08:10 +01:00
|
|
|
/**
|
|
|
|
* @Route("/api")
|
|
|
|
*/
|
2016-07-12 00:33:55 +02:00
|
|
|
class ApiController
|
|
|
|
{
|
2016-12-30 13:37:02 +01:00
|
|
|
/**
|
|
|
|
* @Route("/swagger", methods={"GET"})
|
|
|
|
* @Route("/swagger2", methods={"GET"})
|
2017-03-16 19:35:04 +01:00
|
|
|
* @Operation(
|
2016-12-30 13:37:02 +01:00
|
|
|
* @SWG\Response(response="201", description="An example resource")
|
|
|
|
* )
|
|
|
|
*/
|
|
|
|
public function swaggerAction()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Route("/swagger/implicit", methods={"GET", "POST"})
|
2017-01-14 17:36:56 +01:00
|
|
|
* @SWG\Response(
|
|
|
|
* response="201",
|
|
|
|
* description="Operation automatically detected",
|
2017-01-23 19:46:38 +01:00
|
|
|
* @Model(type=User::class)
|
2017-01-14 17:36:56 +01:00
|
|
|
* )
|
2016-12-30 13:37:02 +01:00
|
|
|
* @SWG\Parameter(
|
|
|
|
* name="foo",
|
2017-01-14 17:36:56 +01:00
|
|
|
* in="body",
|
|
|
|
* description="This is a parameter",
|
|
|
|
* @SWG\Schema(
|
|
|
|
* type="array",
|
2017-01-23 19:46:38 +01:00
|
|
|
* @Model(type=User::class)
|
2017-01-14 17:36:56 +01:00
|
|
|
* )
|
2016-12-30 13:37:02 +01:00
|
|
|
* )
|
|
|
|
*/
|
|
|
|
public function implicitSwaggerAction()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-07-12 00:33:55 +02:00
|
|
|
/**
|
|
|
|
* @Route("/test/{user}", methods={"GET"}, schemes={"https"}, requirements={"user"="/foo/"})
|
|
|
|
*/
|
|
|
|
public function userAction()
|
|
|
|
{
|
|
|
|
}
|
2016-07-13 23:05:14 +02:00
|
|
|
|
2016-11-30 16:21:03 +01:00
|
|
|
/**
|
2016-11-30 16:52:13 +01:00
|
|
|
* @Route("/fosrest.{_format}", methods={"POST"})
|
2016-11-30 16:21:03 +01:00
|
|
|
* @QueryParam(name="foo")
|
|
|
|
* @RequestParam(name="bar")
|
|
|
|
*/
|
|
|
|
public function fosrestAction()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-07-13 23:05:14 +02:00
|
|
|
/**
|
|
|
|
* This action is deprecated.
|
|
|
|
*
|
|
|
|
* Please do not use this action.
|
|
|
|
*
|
|
|
|
* @Route("/deprecated", methods={"GET"})
|
2016-07-14 23:52:01 +02:00
|
|
|
*
|
2016-07-13 23:05:14 +02:00
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
public function deprecatedAction()
|
|
|
|
{
|
|
|
|
}
|
2016-11-30 14:08:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This action is not documented. It is excluded by the config.
|
|
|
|
*
|
|
|
|
* @Route("/admin", methods={"GET"})
|
|
|
|
*/
|
|
|
|
public function adminAction()
|
|
|
|
{
|
|
|
|
}
|
2017-03-16 19:35:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @SWG\Get(
|
|
|
|
* path="/filtered",
|
|
|
|
* @SWG\Response(response="201", description="")
|
|
|
|
* )
|
|
|
|
*/
|
|
|
|
public function filteredAction()
|
|
|
|
{
|
|
|
|
}
|
2016-07-12 00:33:55 +02:00
|
|
|
}
|