diff --git a/DependencyInjection/LoadExtractorParsersPass.php b/DependencyInjection/LoadExtractorParsersPass.php new file mode 100644 index 0000000..4626496 --- /dev/null +++ b/DependencyInjection/LoadExtractorParsersPass.php @@ -0,0 +1,36 @@ +hasDefinition('jms_serializer.serializer')) { + $loader->load('services.jms.xml'); + } + + // forms may not be installed/enabled, if it is, load that config as well + if ($container->hasDefinition('form.factory')) { + $loader->load('services.form.xml'); + } + + // validation may not be installed/enabled, if it is, load that config as well + if ($container->hasDefinition('validator.mapping.class_metadata_factory')) { + $loader->load('services.validation.xml'); + } + } +} diff --git a/DependencyInjection/RegisterJmsParserPass.php b/DependencyInjection/RegisterJmsParserPass.php deleted file mode 100644 index 7c61460..0000000 --- a/DependencyInjection/RegisterJmsParserPass.php +++ /dev/null @@ -1,21 +0,0 @@ -hasDefinition('jms_serializer.serializer')) { - $loader->load('services.jms.xml'); - } - } -} diff --git a/EventListener/RequestListener.php b/EventListener/RequestListener.php index ef47e57..fedd4a9 100644 --- a/EventListener/RequestListener.php +++ b/EventListener/RequestListener.php @@ -14,7 +14,6 @@ namespace Nelmio\ApiDocBundle\EventListener; use Nelmio\ApiDocBundle\Extractor\ApiDocExtractor; use Nelmio\ApiDocBundle\Formatter\FormatterInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; diff --git a/NelmioApiDocBundle.php b/NelmioApiDocBundle.php index bfce996..a1851e7 100644 --- a/NelmioApiDocBundle.php +++ b/NelmioApiDocBundle.php @@ -4,10 +4,9 @@ namespace Nelmio\ApiDocBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Nelmio\ApiDocBundle\DependencyInjection\RegisterJmsParserPass; +use Nelmio\ApiDocBundle\DependencyInjection\LoadExtractorParsersPass; use Nelmio\ApiDocBundle\DependencyInjection\RegisterExtractorParsersPass; use Nelmio\ApiDocBundle\DependencyInjection\ExtractorHandlerCompilerPass; -use Nelmio\ApiDocBundle\DependencyInjection\ParserHandlerCompilerPass; class NelmioApiDocBundle extends Bundle { @@ -15,7 +14,7 @@ class NelmioApiDocBundle extends Bundle { parent::build($container); - $container->addCompilerPass(new RegisterJmsParserPass()); + $container->addCompilerPass(new LoadExtractorParsersPass()); $container->addCompilerPass(new RegisterExtractorParsersPass()); $container->addCompilerPass(new ExtractorHandlerCompilerPass()); } diff --git a/Resources/config/formatters.xml b/Resources/config/formatters.xml index bbb404b..b50a2be 100644 --- a/Resources/config/formatters.xml +++ b/Resources/config/formatters.xml @@ -4,8 +4,6 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - Nelmio\ApiDocBundle\Parser\FormTypeParser - Nelmio\ApiDocBundle\Parser\ValidationParser Nelmio\ApiDocBundle\Formatter\AbstractFormatter Nelmio\ApiDocBundle\Formatter\MarkdownFormatter Nelmio\ApiDocBundle\Formatter\SimpleFormatter @@ -14,14 +12,6 @@ - - - - - - - - diff --git a/Resources/config/services.form.xml b/Resources/config/services.form.xml new file mode 100644 index 0000000..e83b7de --- /dev/null +++ b/Resources/config/services.form.xml @@ -0,0 +1,17 @@ + + + + + Nelmio\ApiDocBundle\Parser\FormTypeParser + + + + + + + + + + diff --git a/Resources/config/services.validation.xml b/Resources/config/services.validation.xml new file mode 100644 index 0000000..5ba9b96 --- /dev/null +++ b/Resources/config/services.validation.xml @@ -0,0 +1,17 @@ + + + + + Nelmio\ApiDocBundle\Parser\ValidationParser + + + + + + + + + + diff --git a/composer.json b/composer.json index 9fc8413..1c1b84e 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,6 @@ "require": { "symfony/framework-bundle": "~2.1", "symfony/twig-bundle": "~2.1", - "symfony/form": "~2.1", "dflydev/markdown": "1.0.*" }, "conflict": { @@ -33,6 +32,12 @@ "jms/serializer-bundle": ">=0.11", "sensio/framework-extra-bundle": "~2.1" }, + "suggest": { + "symfony/form": "For using form definitions as input.", + "symfony/validator": "For making use of validator information in the doc.", + "friendsofsymfony/rest-bundle": "For making use of REST information in the doc.", + "jms/serializer": "For making use of serializer informamtion in the doc." + }, "minimum-stability": "dev", "autoload": { "psr-0": { "Nelmio\\ApiDocBundle": "" }