Merge pull request #949 from magnetik/source-folder

Make source folder configurable
This commit is contained in:
Guilhem N 2017-01-19 10:06:42 +01:00 committed by GitHub
commit 69f0a6fd35
3 changed files with 5 additions and 0 deletions

View file

@ -22,6 +22,7 @@ final class Configuration implements ConfigurationInterface
$treeBuilder
->root('nelmio_api_doc')
->children()
->scalarNode('source_folder')->defaultValue('%kernel.root_dir%/../src')->end()
->arrayNode('routes')
->info('Filter the routes that are documented')
->addDefaultsIfNotSet()

View file

@ -41,6 +41,9 @@ final class NelmioApiDocExtension extends Extension
}
if (class_exists(Swagger::class)) {
$loader->load('swagger_php.xml');
$swaggerPHPDescriber = $container->getDefinition('nelmio_api_doc.describers.swagger_php');
$swaggerPHPDescriber->replaceArgument(0, $config['source_folder']);
}
if (interface_exists(ParamInterface::class)) {
$loader->load('fos_rest.xml');

View file

@ -62,6 +62,7 @@ class TestKernel extends Kernel
// Filter routes
$c->loadFromExtension('nelmio_api_doc', [
'source_folder' => '%kernel.root_dir%',
'routes' => [
'path_patterns' => ['^/api(?!/admin)'],
],