Change the vendor to "Nelmio"

This commit is contained in:
Guilhem N 2016-12-29 12:09:26 +01:00
parent c480ff4228
commit c797269bef
No known key found for this signature in database
GPG Key ID: 9E5D2DB67BF054DD
41 changed files with 966 additions and 194 deletions

View File

@ -12,9 +12,9 @@ return PhpCsFixer\Config::create()
'phpdoc_order' => true,
'header_comment' => [
'header' => <<<COMMENT
This file is part of the ApiDocBundle package.
This file is part of the NelmioApiDocBundle package.
(c) EXSyst
(c) Nelmio
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

794
Annotation/ApiDoc.php Normal file
View File

@ -0,0 +1,794 @@
<?php
/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Annotation;
use Symfony\Component\Routing\Route;
/**
* @Annotation
*/
class ApiDoc
{
const DEFAULT_VIEW = 'default';
/**
* Requirements are mandatory parameters in a route.
*
* @var array
*/
private $requirements = array();
/**
* Which views is this route used. Defaults to "Default".
*
* @var array
*/
private $views = array();
/**
* Filters are optional parameters in the query string.
*
* @var array
*/
private $filters = array();
/**
* Parameters are data a client can send.
*
* @var array
*/
private $parameters = array();
/**
* Headers that client can send.
*
* @var array
*/
private $headers = array();
/**
* @var string
*/
private $input = null;
/**
* @var string
*/
private $output = null;
/**
* @var string
*/
private $link = null;
/**
* Most of the time, a single line of text describing the action.
*
* @var string
*/
private $description = null;
/**
* Section to group actions together.
*
* @var string
*/
private $section = null;
/**
* Extended documentation.
*
* @var string
*/
private $documentation = null;
/**
* @var bool
*/
private $resource = false;
/**
* @var string
*/
private $method;
/**
* @var string
*/
private $host;
/**
* @var string
*/
private $uri;
/**
* @var array
*/
private $response = array();
/**
* @var Route
*/
private $route;
/**
* @var bool
*/
private $https = false;
/**
* @var bool
*/
private $authentication = false;
/**
* @var array
*/
private $authenticationRoles = array();
/**
* @var int
*/
private $cache;
/**
* @var bool
*/
private $deprecated = false;
/**
* @var array
*/
private $statusCodes = array();
/**
* @var string|null
*/
private $resourceDescription = null;
/**
* @var array
*/
private $responseMap = array();
/**
* @var array
*/
private $parsedResponseMap = array();
/**
* @var array
*/
private $tags = array();
public function __construct(array $data)
{
$this->resource = !empty($data['resource']) ? $data['resource'] : false;
if (isset($data['description'])) {
$this->description = $data['description'];
}
if (isset($data['input'])) {
$this->input = $data['input'];
}
if (isset($data['filters'])) {
foreach ($data['filters'] as $filter) {
if (!isset($filter['name'])) {
throw new \InvalidArgumentException('A "filter" element has to contain a "name" attribute');
}
$name = $filter['name'];
unset($filter['name']);
$this->addFilter($name, $filter);
}
}
if (isset($data['requirements'])) {
foreach ($data['requirements'] as $requirement) {
if (!isset($requirement['name'])) {
throw new \InvalidArgumentException('A "requirement" element has to contain a "name" attribute');
}
$name = $requirement['name'];
unset($requirement['name']);
$this->addRequirement($name, $requirement);
}
}
if (isset($data['views'])) {
if (!is_array($data['views'])) {
$data['views'] = array($data['views']);
}
foreach ($data['views'] as $view) {
$this->addView($view);
}
}
if (isset($data['parameters'])) {
foreach ($data['parameters'] as $parameter) {
if (!isset($parameter['name'])) {
throw new \InvalidArgumentException('A "parameter" element has to contain a "name" attribute');
}
if (!isset($parameter['dataType'])) {
throw new \InvalidArgumentException(sprintf(
'"%s" parameter element has to contain a "dataType" attribute',
$parameter['name']
));
}
$name = $parameter['name'];
unset($parameter['name']);
$this->addParameter($name, $parameter);
}
}
if (isset($data['headers'])) {
foreach ($data['headers'] as $header) {
if (!isset($header['name'])) {
throw new \InvalidArgumentException('A "header" element has to contain a "name" attribute');
}
$name = $header['name'];
unset($header['name']);
$this->addHeader($name, $header);
}
}
if (isset($data['output'])) {
$this->output = $data['output'];
}
if (isset($data['statusCodes'])) {
foreach ($data['statusCodes'] as $statusCode => $description) {
$this->addStatusCode($statusCode, $description);
}
}
if (isset($data['authentication'])) {
$this->setAuthentication((bool) $data['authentication']);
}
if (isset($data['authenticationRoles'])) {
foreach ($data['authenticationRoles'] as $key => $role) {
$this->authenticationRoles[] = $role;
}
}
if (isset($data['cache'])) {
$this->setCache($data['cache']);
}
if (isset($data['section'])) {
$this->section = $data['section'];
}
if (isset($data['deprecated'])) {
$this->deprecated = $data['deprecated'];
}
if (isset($data['tags'])) {
if (is_array($data['tags'])) {
foreach ($data['tags'] as $tag => $colorCode) {
if (is_numeric($tag)) {
$this->addTag($colorCode);
} else {
$this->addTag($tag, $colorCode);
}
}
} else {
$this->tags[] = $data['tags'];
}
}
if (isset($data['https'])) {
$this->https = $data['https'];
}
if (isset($data['resourceDescription'])) {
$this->resourceDescription = $data['resourceDescription'];
}
if (isset($data['responseMap'])) {
$this->responseMap = $data['responseMap'];
if (isset($this->responseMap[200])) {
$this->output = $this->responseMap[200];
}
}
}
/**
* @param string $name
* @param array $filter
*/
public function addFilter($name, array $filter)
{
$this->filters[$name] = $filter;
}
/**
* @param string $statusCode
* @param mixed $description
*/
public function addStatusCode($statusCode, $description)
{
$this->statusCodes[$statusCode] = !is_array($description) ? array($description) : $description;
}
/**
* @param string $tag
* @param string $colorCode
*/
public function addTag($tag, $colorCode = '#d9534f')
{
$this->tags[$tag] = $colorCode;
}
/**
* @param string $name
* @param array $requirement
*/
public function addRequirement($name, array $requirement)
{
$this->requirements[$name] = $requirement;
}
/**
* @param array $requirements
*/
public function setRequirements(array $requirements)
{
$this->requirements = array_merge($this->requirements, $requirements);
}
/**
* @return string|null
*/
public function getInput()
{
return $this->input;
}
/**
* @return string|null
*/
public function getOutput()
{
return $this->output;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* @param string $link
*/
public function setLink($link)
{
$this->link = $link;
}
/**
* @param string $section
*/
public function setSection($section)
{
$this->section = $section;
}
/**
* @return string
*/
public function getSection()
{
return $this->section;
}
/**
* @return array
*/
public function addView($view)
{
$this->views[] = $view;
}
/**
* @return array
*/
public function getViews()
{
return $this->views;
}
/**
* @param string $documentation
*/
public function setDocumentation($documentation)
{
$this->documentation = $documentation;
}
/**
* @return string
*/
public function getDocumentation()
{
return $this->documentation;
}
/**
* @return bool
*/
public function isResource()
{
return (bool) $this->resource;
}
/**
* @return mixed
*/
public function getResource()
{
return $this->resource && is_string($this->resource) ? $this->resource : false;
}
/**
* @param string $name
* @param array $parameter
*/
public function addParameter($name, array $parameter)
{
$this->parameters[$name] = $parameter;
}
/**
* @param array $parameters
*/
public function setParameters(array $parameters)
{
$this->parameters = $parameters;
}
/**
* @param $name
* @param array $header
*/
public function addHeader($name, array $header)
{
$this->headers[$name] = $header;
}
/**
* Sets the response data as processed by the parsers - same format as parameters.
*
* @param array $response
*/
public function setResponse(array $response)
{
$this->response = $response;
}
/**
* @param Route $route
*/
public function setRoute(Route $route)
{
$this->route = $route;
if (method_exists($route, 'getHost')) {
$this->host = $route->getHost() ?: null;
//replace route placeholders
foreach ($route->getDefaults() as $key => $value) {
if (is_string($value)) {
$this->host = str_replace('{'.$key.'}', $value, $this->host);
}
}
} else {
$this->host = null;
}
$this->uri = $route->getPath();
$this->method = $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY';
}
/**
* @return Route
*/
public function getRoute()
{
return $this->route;
}
/**
* @return string
*/
public function getHost()
{
return $this->host;
}
/**
* @param string $host
*/
public function setHost($host)
{
$this->host = $host;
}
/**
* @return bool
*/
public function getHttps()
{
return $this->https;
}
/**
* @param bool $https
*/
public function setHttps($https)
{
$this->https = $https;
}
/**
* @return bool
*/
public function getAuthentication()
{
return $this->authentication;
}
/**
* @param bool $authentication
*/
public function setAuthentication($authentication)
{
$this->authentication = $authentication;
}
/**
* @return array
*/
public function getAuthenticationRoles()
{
return $this->authenticationRoles;
}
/**
* @param array $authenticationRoles
*/
public function setAuthenticationRoles($authenticationRoles)
{
$this->authenticationRoles = $authenticationRoles;
}
/**
* @return int
*/
public function getCache()
{
return $this->cache;
}
/**
* @param int $cache
*/
public function setCache($cache)
{
$this->cache = (int) $cache;
}
/**
* @return bool
*/
public function getDeprecated()
{
return $this->deprecated;
}
/**
* @return array
*/
public function getFilters()
{
return $this->filters;
}
/**
* @return array
*/
public function getRequirements()
{
return $this->requirements;
}
/**
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
/**
* @return array
*/
public function getHeaders()
{
return $this->headers;
}
/**
* @param bool $deprecated
*
* @return $this
*/
public function setDeprecated($deprecated)
{
$this->deprecated = (bool) $deprecated;
return $this;
}
/**
* @return string
*/
public function getMethod()
{
return $this->method;
}
/**
* @return array
*/
public function toArray()
{
$data = array(
'method' => $this->method,
'uri' => $this->uri,
);
if ($host = $this->host) {
$data['host'] = $host;
}
if ($description = $this->description) {
$data['description'] = $description;
}
if ($link = $this->link) {
$data['link'] = $link;
}
if ($documentation = $this->documentation) {
$data['documentation'] = $documentation;
}
if ($filters = $this->filters) {
$data['filters'] = $filters;
}
if ($parameters = $this->parameters) {
$data['parameters'] = $parameters;
}
if ($headers = $this->headers) {
$data['headers'] = $headers;
}
if ($requirements = $this->requirements) {
$data['requirements'] = $requirements;
}
if ($views = $this->views) {
$data['views'] = $views;
}
if ($response = $this->response) {
$data['response'] = $response;
}
if ($parsedResponseMap = $this->parsedResponseMap) {
$data['parsedResponseMap'] = $parsedResponseMap;
}
if ($statusCodes = $this->statusCodes) {
$data['statusCodes'] = $statusCodes;
}
if ($section = $this->section) {
$data['section'] = $section;
}
if ($cache = $this->cache) {
$data['cache'] = $cache;
}
if ($tags = $this->tags) {
$data['tags'] = $tags;
}
if ($resourceDescription = $this->resourceDescription) {
$data['resourceDescription'] = $resourceDescription;
}
$data['https'] = $this->https;
$data['authentication'] = $this->authentication;
$data['authenticationRoles'] = $this->authenticationRoles;
$data['deprecated'] = $this->deprecated;
return $data;
}
/**
* @return null|string
*/
public function getResourceDescription()
{
return $this->resourceDescription;
}
/**
* @return array
*/
public function getResponseMap()
{
if (!isset($this->responseMap[200]) && null !== $this->output) {
$this->responseMap[200] = $this->output;
}
return $this->responseMap;
}
/**
* @return array
*/
public function getParsedResponseMap()
{
return $this->parsedResponseMap;
}
/**
* @param $model
* @param $type
* @param int $statusCode
*/
public function setResponseForStatusCode($model, $type, $statusCode = 200)
{
$this->parsedResponseMap[$statusCode] = array('type' => $type, 'model' => $model);
if ($statusCode == 200 && $this->response !== $model) {
$this->response = $model;
}
}
}

View File

@ -1,18 +1,18 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle;
namespace Nelmio\ApiDocBundle;
use EXSyst\Bundle\ApiDocBundle\Describer\DescriberInterface;
use EXSyst\Component\Swagger\Swagger;
use Nelmio\ApiDocBundle\Describer\DescriberInterface;
use Psr\Cache\CacheItemPoolInterface;
final class ApiDocGenerator

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\DependencyInjection\Compiler;
namespace Nelmio\ApiDocBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
@ -21,8 +21,8 @@ class AddDescribersPass implements CompilerPassInterface
public function process(ContainerBuilder $container)
{
$describers = $this->findAndSortTaggedServices('exsyst_api_doc.describer', $container);
$describers = $this->findAndSortTaggedServices('nelmio_api_doc.describer', $container);
$container->getDefinition('exsyst_api_doc.generator')->replaceArgument(0, $describers);
$container->getDefinition('nelmio_api_doc.generator')->replaceArgument(0, $describers);
}
}

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\DependencyInjection\Compiler;
namespace Nelmio\ApiDocBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
@ -21,8 +21,8 @@ class AddRouteDescribersPass implements CompilerPassInterface
public function process(ContainerBuilder $container)
{
$routeDescribers = $this->findAndSortTaggedServices('exsyst_api_doc.route_describer', $container);
$routeDescribers = $this->findAndSortTaggedServices('nelmio_api_doc.route_describer', $container);
$container->getDefinition('exsyst_api_doc.describers.route')->replaceArgument(3, $routeDescribers);
$container->getDefinition('nelmio_api_doc.describers.route')->replaceArgument(3, $routeDescribers);
}
}

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\DependencyInjection;
namespace Nelmio\ApiDocBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
@ -20,7 +20,7 @@ final class Configuration implements ConfigurationInterface
{
$treeBuilder = new TreeBuilder();
$treeBuilder
->root('exsyst_api_doc')
->root('nelmio_api_doc')
->children()
->arrayNode('routes')
->info('Filter the routes that are documented')

View File

@ -1,18 +1,17 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\DependencyInjection;
namespace Nelmio\ApiDocBundle\DependencyInjection;
use FOS\RestBundle\Controller\Annotations\ParamInterface;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use phpDocumentor\Reflection\DocBlockFactory;
use Swagger\Annotations\Swagger;
use Symfony\Component\Config\FileLocator;
@ -20,16 +19,8 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
final class EXSystApiDocExtension extends Extension
final class NelmioApiDocExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function getAlias()
{
return 'exsyst_api_doc';
}
/**
* {@inheritdoc}
*/
@ -41,13 +32,11 @@ final class EXSystApiDocExtension extends Extension
$loader->load('services.xml');
// Filter routes
$routeCollectionBuilder = $container->getDefinition('exsyst_api_doc.describers.route.filtered_route_collection_builder');
$routeCollectionBuilder = $container->getDefinition('nelmio_api_doc.describers.route.filtered_route_collection_builder');
$routeCollectionBuilder->replaceArgument(0, $config['routes']['path_patterns']);
// Import services needed for each library
if (class_exists(ApiDoc::class)) {
$loader->load('nelmio_apidoc.xml');
}
$loader->load('nelmio_apidoc.xml');
if (class_exists(DocBlockFactory::class)) {
$loader->load('php_doc.xml');
}

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Describer;
namespace Nelmio\ApiDocBundle\Describer;
use ApiPlatform\Core\Documentation\Documentation;
use ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Describer;
namespace Nelmio\ApiDocBundle\Describer;
use EXSyst\Component\Swagger\Swagger;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Describer;
namespace Nelmio\ApiDocBundle\Describer;
use EXSyst\Component\Swagger\Swagger;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Describer;
namespace Nelmio\ApiDocBundle\Describer;
use EXSyst\Component\Swagger\Swagger;

View File

@ -1,19 +1,19 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Describer;
namespace Nelmio\ApiDocBundle\Describer;
use Doctrine\Common\Util\ClassUtils;
use EXSyst\Bundle\ApiDocBundle\RouteDescriber\RouteDescriberInterface;
use EXSyst\Component\Swagger\Swagger;
use Nelmio\ApiDocBundle\RouteDescriber\RouteDescriberInterface;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Route;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Describer;
namespace Nelmio\ApiDocBundle\Describer;
final class SwaggerPhpDescriber extends ExternalDocDescriber
{

View File

@ -1,43 +0,0 @@
<?php
/*
* This file is part of the ApiDocBundle package.
*
* (c) EXSyst
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle;
use EXSyst\Bundle\ApiDocBundle\DependencyInjection\Compiler\AddDescribersPass;
use EXSyst\Bundle\ApiDocBundle\DependencyInjection\Compiler\AddRouteDescribersPass;
use EXSyst\Bundle\ApiDocBundle\DependencyInjection\EXSystApiDocExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
final class EXSystApiDocBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new AddDescribersPass());
$container->addCompilerPass(new AddRouteDescribersPass());
}
/**
* {@inheritdoc}
*/
public function getContainerExtension()
{
if (null === $this->extension) {
$this->extension = new EXSystApiDocExtension();
}
if ($this->extension) {
return $this->extension;
}
}
}

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2016 EXSyst
Copyright (c) 2016 Nelmio
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

29
NelmioApiDocBundle.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle;
use Nelmio\ApiDocBundle\DependencyInjection\Compiler\AddDescribersPass;
use Nelmio\ApiDocBundle\DependencyInjection\Compiler\AddRouteDescribersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
final class NelmioApiDocBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new AddDescribersPass());
$container->addCompilerPass(new AddRouteDescribersPass());
}
}

View File

@ -6,7 +6,7 @@
Just like any bundle, you have to download it using composer:
```
composer require exsyst/api-doc-bundle dev-master
composer require nelmio/api-doc-bundle dev-master
```
And then add it to your kernel:
@ -18,7 +18,7 @@ class AppKernel extends Kernel
$bundles = [
// ...
new EXSyst\Bundle\ApiDocBundle\ApiDocBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
];
// ...
@ -37,7 +37,7 @@ documentation.
You can fetch your swagger documentation in your app:
```php
$generator = $container->get('exsyst_api_doc.generator');
$generator = $container->get('nelmio_api_doc.generator');
$swagger = $generator->generate()->toArray();
```

View File

@ -4,14 +4,14 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="exsyst_api_doc.describers.api_platform" class="EXSyst\Bundle\ApiDocBundle\Describer\ApiPlatformDescriber" public="false">
<argument type="service" id="exsyst_api_doc.describers.api_platform.documentation" />
<service id="nelmio_api_doc.describers.api_platform" class="Nelmio\ApiDocBundle\Describer\ApiPlatformDescriber" public="false">
<argument type="service" id="nelmio_api_doc.describers.api_platform.documentation" />
<argument type="service" id="api_platform.swagger.normalizer.documentation" />
<tag name="exsyst_api_doc.describer" priority="-200" />
<tag name="nelmio_api_doc.describer" priority="-200" />
</service>
<service id="exsyst_api_doc.describers.api_platform.documentation" class="ApiPlatform\Core\Documentation\Documentation" public="false">
<service id="nelmio_api_doc.describers.api_platform.documentation" class="ApiPlatform\Core\Documentation\Documentation" public="false">
<factory service="api_platform.action.documentation" method="__invoke" />
</service>
</services>

View File

@ -4,10 +4,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="exsyst_api_doc.route_describers.fos_rest" class="EXSyst\Bundle\ApiDocBundle\RouteDescriber\FosRestDescriber" public="false">
<service id="nelmio_api_doc.route_describers.fos_rest" class="Nelmio\ApiDocBundle\RouteDescriber\FosRestDescriber" public="false">
<argument type="service" id="annotation_reader" />
<tag name="exsyst_api_doc.route_describer" priority="-300" />
<tag name="nelmio_api_doc.route_describer" priority="-300" />
</service>
</services>

View File

@ -4,10 +4,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="exsyst_api_doc.route_describers.nelmio_annotation" class="EXSyst\Bundle\ApiDocBundle\RouteDescriber\NelmioAnnotationDescriber" public="false">
<service id="nelmio_api_doc.route_describers.nelmio_annotation" class="Nelmio\ApiDocBundle\RouteDescriber\NelmioAnnotationDescriber" public="false">
<argument type="service" id="annotation_reader" />
<tag name="exsyst_api_doc.route_describer" priority="-200" />
<tag name="nelmio_api_doc.route_describer" priority="-200" />
</service>
</services>

View File

@ -4,8 +4,8 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="exsyst_api_doc.route_describers.php_doc" class="EXSyst\Bundle\ApiDocBundle\RouteDescriber\PhpDocDescriber" public="false">
<tag name="exsyst_api_doc.route_describer" priority="-1000" />
<service id="nelmio_api_doc.route_describers.php_doc" class="Nelmio\ApiDocBundle\RouteDescriber\PhpDocDescriber" public="false">
<tag name="nelmio_api_doc.route_describer" priority="-1000" />
</service>
</services>

View File

@ -4,21 +4,21 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="exsyst_api_doc.generator" class="EXSyst\Bundle\ApiDocBundle\ApiDocGenerator">
<service id="nelmio_api_doc.generator" class="Nelmio\ApiDocBundle\ApiDocGenerator">
<argument type="collection" />
</service>
<!-- Extractors -->
<service id="exsyst_api_doc.describers.route.filtered_route_collection_builder" class="EXSyst\Bundle\ApiDocBundle\Routing\FilteredRouteCollectionBuilder" public="false">
<service id="nelmio_api_doc.describers.route.filtered_route_collection_builder" class="Nelmio\ApiDocBundle\Routing\FilteredRouteCollectionBuilder" public="false">
<argument type="collection" /> <!-- Path patterns -->
</service>
<service id="exsyst_api_doc.describers.route" class="EXSyst\Bundle\ApiDocBundle\Describer\RouteDescriber" public="false">
<service id="nelmio_api_doc.describers.route" class="Nelmio\ApiDocBundle\Describer\RouteDescriber" public="false">
<argument type="service" id="service_container" />
<argument type="service">
<service class="Symfony\Component\Routing\RouteCollection">
<factory service="exsyst_api_doc.describers.route.filtered_route_collection_builder" method="filter" />
<factory service="nelmio_api_doc.describers.route.filtered_route_collection_builder" method="filter" />
<argument type="service">
<service class="Symfony\Component\Routing\RouteCollection">
<factory service="router" method="getRouteCollection" />
@ -29,16 +29,16 @@
<argument type="service" id="controller_name_converter" />
<argument type="collection" />
<tag name="exsyst_api_doc.describer" priority="-100" />
<tag name="nelmio_api_doc.describer" priority="-100" />
</service>
<service id="exsyst_api_doc.describers.default" class="EXSyst\Bundle\ApiDocBundle\Describer\DefaultDescriber" public="false">
<tag name="exsyst_api_doc.describer" priority="-1000" />
<service id="nelmio_api_doc.describers.default" class="Nelmio\ApiDocBundle\Describer\DefaultDescriber" public="false">
<tag name="nelmio_api_doc.describer" priority="-1000" />
</service>
<!-- Routing Extractors -->
<service id="exsyst_api_doc.route_describers.route_metadata" class="EXSyst\Bundle\ApiDocBundle\RouteDescriber\RouteMetadataDescriber" public="false">
<tag name="exsyst_api_doc.route_describer" priority="-100" />
<service id="nelmio_api_doc.route_describers.route_metadata" class="Nelmio\ApiDocBundle\RouteDescriber\RouteMetadataDescriber" public="false">
<tag name="nelmio_api_doc.route_describer" priority="-100" />
</service>
</services>

View File

@ -4,10 +4,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="exsyst_api_doc.describers.swagger_php" class="EXSyst\Bundle\ApiDocBundle\Describer\SwaggerPhpDescriber" public="false">
<service id="nelmio_api_doc.describers.swagger_php" class="Nelmio\ApiDocBundle\Describer\SwaggerPhpDescriber" public="false">
<argument>%kernel.root_dir%</argument>
<tag name="exsyst_api_doc.describer" priority="-300" />
<tag name="nelmio_api_doc.describer" priority="-300" />
</service>
</services>

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\RouteDescriber;
namespace Nelmio\ApiDocBundle\RouteDescriber;
use Doctrine\Common\Annotations\Reader;
use EXSyst\Component\Swagger\Swagger;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\RouteDescriber;
namespace Nelmio\ApiDocBundle\RouteDescriber;
use Doctrine\Common\Annotations\Reader;
use EXSyst\Component\Swagger\Parameter;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\RouteDescriber;
namespace Nelmio\ApiDocBundle\RouteDescriber;
use EXSyst\Component\Swagger\Swagger;
use phpDocumentor\Reflection\DocBlockFactory;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\RouteDescriber;
namespace Nelmio\ApiDocBundle\RouteDescriber;
use EXSyst\Component\Swagger\Swagger;
use Symfony\Component\Routing\Route;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\RouteDescriber;
namespace Nelmio\ApiDocBundle\RouteDescriber;
use EXSyst\Component\Swagger\Operation;
use EXSyst\Component\Swagger\Swagger;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\RouteDescriber;
namespace Nelmio\ApiDocBundle\RouteDescriber;
use EXSyst\Component\Swagger\Swagger;
use Symfony\Component\Routing\Route;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Routing;
namespace Nelmio\ApiDocBundle\Routing;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Describer;
namespace Nelmio\ApiDocBundle\Tests\Describer;
use EXSyst\Component\Swagger\Swagger;

View File

@ -1,19 +1,19 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Describer;
namespace Nelmio\ApiDocBundle\Tests\Describer;
use EXSyst\Bundle\ApiDocBundle\Describer\RouteDescriber;
use EXSyst\Bundle\ApiDocBundle\RouteDescriber\RouteDescriberInterface;
use EXSyst\Component\Swagger\Swagger;
use Nelmio\ApiDocBundle\Describer\RouteDescriber;
use Nelmio\ApiDocBundle\RouteDescriber\RouteDescriberInterface;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Routing\Route;

View File

@ -1,17 +1,17 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Describer;
namespace Nelmio\ApiDocBundle\Tests\Describer;
use EXSyst\Bundle\ApiDocBundle\Describer\SwaggerPhpDescriber;
use Nelmio\ApiDocBundle\Describer\SwaggerPhpDescriber;
class SwaggerPhpDescriberTest extends AbstractDescriberTest
{

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional\Fixtures\SwaggerPhp;
namespace Nelmio\ApiDocBundle\Tests\Functional\Fixtures\SwaggerPhp;
use Swagger\Annotations\Info as InfoAnnotation;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional\Controller;
namespace Nelmio\ApiDocBundle\Tests\Functional\Controller;
use FOS\RestBundle\Controller\Annotations\QueryParam;
use FOS\RestBundle\Controller\Annotations\RequestParam;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional\Controller;
namespace Nelmio\ApiDocBundle\Tests\Functional\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional\Entity;
namespace Nelmio\ApiDocBundle\Tests\Functional\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional;
namespace Nelmio\ApiDocBundle\Tests\Functional;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@ -85,7 +85,7 @@ class FunctionalTest extends WebTestCase
{
static::createClient();
return static::$kernel->getContainer()->get('exsyst_api_doc.generator')->generate();
return static::$kernel->getContainer()->get('nelmio_api_doc.generator')->generate();
}
private function getOperation($path, $method)

View File

@ -1,15 +1,15 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace EXSyst\Bundle\ApiDocBundle\Tests\Functional;
namespace Nelmio\ApiDocBundle\Tests\Functional;
use Symfony\Component\HttpKernel\Bundle\Bundle;

View File

@ -1,17 +1,17 @@
<?php
/*
* This file is part of the ApiDocBundle package.
* This file is part of the NelmioApiDocBundle package.
*
* (c) EXSyst
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle;
use EXSyst\Bundle\ApiDocBundle\EXSystApiDocBundle;
use EXSyst\Bundle\ApiDocBundle\Tests\Functional\TestBundle;
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
use Nelmio\ApiDocBundle\Tests\Functional\TestBundle;
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
@ -35,7 +35,7 @@ class TestKernel extends Kernel
new TwigBundle(),
new SensioFrameworkExtraBundle(),
new ApiPlatformBundle(),
new EXSystApiDocBundle(),
new NelmioApiDocBundle(),
new TestBundle(),
];
}
@ -61,7 +61,7 @@ class TestKernel extends Kernel
]);
// Filter routes
$c->loadFromExtension('exsyst_api_doc', [
$c->loadFromExtension('nelmio_api_doc', [
'routes' => [
'path_patterns' => ['^/api(?!/admin)'],
],

View File

@ -1,20 +1,27 @@
{
"name": "exsyst/api-doc-bundle",
"name": "nelmio/api-doc-bundle",
"description": "Generates documentation for your REST API from annotations",
"keywords": ["api", "documentation", "doc", "rest"],
"type": "symfony-bundle",
"description": "[WIP] Generates Swagger docs from several sources",
"license": "MIT",
"authors": [
{
"name": "EXSyst"
"name": "Nelmio",
"homepage": "http://nelm.io"
},
{
"name": "Symfony Community",
"homepage": "https://github.com/nelmio/NelmioApiDocBundle/contributors"
}
],
"require": {
"php": "^7.0",
"php": "~7.0|~7.1",
"symfony/framework-bundle": "^3.2",
"exsyst/swagger": "~0.2.2"
},
"require-dev": {
"symfony/twig-bundle": "^3.2",
"symfony/console": "^3.2",
"symfony/config": "^3.2",
"symfony/validator": "^3.2",
"symfony/property-access": "^3.2",
@ -25,14 +32,12 @@
"phpunit/phpunit": "^5.4",
"doctrine/annotations": "^1.2",
"nelmio/api-doc-bundle": "^2.0",
"phpdocumentor/reflection-docblock": "^3.1",
"zircote/swagger-php": "^2.0",
"api-platform/core": "dev-master",
"api-platform/core": "^2.0",
"friendsofsymfony/rest-bundle": "^2.0"
},
"suggest": {
"nelmio/api-doc-bundle": "For using the ApiDoc annotation.",
"phpdocumentor/reflection-docblock": "For parsing php docs.",
"zircote/swagger-php": "For using swagger annotations.",
"api-platform/core": "For using an API oriented framework.",
@ -40,14 +45,12 @@
},
"autoload": {
"psr-4": {
"EXSyst\\Bundle\\ApiDocBundle\\": ""
"Nelmio\\ApiDocBundle\\": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "0.1.x-dev"
"dev-master": "3.0.x-dev"
}
},
"prefer-stable": true,
"minimum-stability": "dev"
}
}