This commit is contained in:
William Durand 2015-03-06 11:19:08 +01:00
parent e23a7d7d66
commit 0a1cef77ad
No known key found for this signature in database
GPG Key ID: A509BCF1C1274F3B
17 changed files with 37 additions and 48 deletions

View File

@ -66,6 +66,7 @@ class SwaggerDumpCommand extends ContainerAwareCommand
if ($input->getOption('list-only')) {
$data = $this->getResourceList($apiDocs, $output);
$this->dump($data, null, $input, $output);
return;
}
@ -75,6 +76,7 @@ class SwaggerDumpCommand extends ContainerAwareCommand
throw new \InvalidArgumentException(sprintf('Resource "%s" does not exist.', $resource));
}
$this->dump($data, $resource, $input, $output);
return;
}
@ -110,6 +112,7 @@ class SwaggerDumpCommand extends ContainerAwareCommand
if (!$destination) {
$output->writeln($content);
return;
}

View File

@ -11,15 +11,8 @@
namespace Nelmio\ApiDocBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
/**
* Compiler pass that configures the SwaggerFormatter instance.

View File

@ -531,6 +531,7 @@ class ApiDocExtractor
if (class_exists($subType)) {
$parts = explode('\\', $subType);
return sprintf('object (%s)', end($parts));
}
@ -545,6 +546,7 @@ class ApiDocExtractor
if (class_exists($subType)) {
$parts = explode('\\', $subType);
return sprintf('array of objects (%s)', end($parts));
}

View File

@ -16,7 +16,6 @@ use Nelmio\ApiDocBundle\Util\DocCommentExtractor;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Routing\RouterInterface;
/**

View File

@ -11,7 +11,6 @@
namespace Nelmio\ApiDocBundle\Formatter;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\HttpFoundation\Request;

View File

@ -15,8 +15,6 @@ use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Nelmio\ApiDocBundle\DataTypes;
use Nelmio\ApiDocBundle\Swagger\ModelRegistry;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Router;
use Symfony\Component\Routing\RouterInterface;
/**
* Produces Swagger-compliant resource lists and API declarations as defined here:
@ -202,7 +200,6 @@ class SwaggerFormatter implements FormatterInterface
$apiBag = array();
foreach ($collection as $item) {
/** @var $apiDoc ApiDoc */
@ -373,6 +370,7 @@ class SwaggerFormatter implements FormatterInterface
$path = preg_replace('/({.*?})/', '', $path);
$path = trim(preg_replace('/[^0-9a-zA-Z]/', '-', $path), '-');
$path = preg_replace('/-+/', '-', $path);
return $path;
}
@ -580,6 +578,7 @@ class SwaggerFormatter implements FormatterInterface
$pattern = sprintf('#^%s#', preg_quote($this->basePath));
$subPath = preg_replace($pattern, '', $path);
return $subPath;
}
@ -594,6 +593,7 @@ class SwaggerFormatter implements FormatterInterface
{
$resource = preg_replace('#/^#', '', $resource);
$resource = $this->normalizeResourcePath($resource);
return sprintf('%s_%s', strtolower($method), $resource);
}
}

View File

@ -9,7 +9,6 @@
namespace NelmioApiDocBundle\Tests\Controller;
use Nelmio\ApiDocBundle\Tests\WebTestCase;
/**
* Class ApiDocControllerTest
*

View File

@ -1,6 +1,5 @@
<?php
namespace Nelmio\ApiDocBundle\Tests\Extractor;
class CollectionDirectiveTest extends \PHPUnit_Framework_TestCase

View File

@ -1,6 +1,5 @@
<?php
namespace Nelmio\ApiDocBundle\Tests\Extractor;
use Nelmio\ApiDocBundle\Extractor\ApiDocExtractor;

View File

@ -2,12 +2,10 @@
namespace Nelmio\ApiDocBundle\Tests\Formatter;
use Nelmio\ApiDocBundle\Extractor\ApiDocExtractor;
use Nelmio\ApiDocBundle\Formatter\SwaggerFormatter;
use Nelmio\ApiDocBundle\Tests\WebTestCase;
/**
* Class SwaggerFormatterTest
*
@ -36,7 +34,6 @@ class SwaggerFormatterTest extends WebTestCase
$this->formatter = $container->get('nelmio_api_doc.formatter.swagger_formatter');
}
public function testResourceListing()
{
@ -99,7 +96,6 @@ class SwaggerFormatterTest extends WebTestCase
$this->assertEquals($expected, $actual);
}
/**