mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Make source folder configurable
This commit is contained in:
parent
3a29c598cc
commit
92c108839c
@ -22,6 +22,7 @@ final class Configuration implements ConfigurationInterface
|
|||||||
$treeBuilder
|
$treeBuilder
|
||||||
->root('nelmio_api_doc')
|
->root('nelmio_api_doc')
|
||||||
->children()
|
->children()
|
||||||
|
->scalarNode('source_folder')->defaultValue('%kernel.root_dir%/../src')->end()
|
||||||
->arrayNode('routes')
|
->arrayNode('routes')
|
||||||
->info('Filter the routes that are documented')
|
->info('Filter the routes that are documented')
|
||||||
->addDefaultsIfNotSet()
|
->addDefaultsIfNotSet()
|
||||||
|
@ -41,6 +41,9 @@ final class NelmioApiDocExtension extends Extension
|
|||||||
}
|
}
|
||||||
if (class_exists(Swagger::class)) {
|
if (class_exists(Swagger::class)) {
|
||||||
$loader->load('swagger_php.xml');
|
$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)) {
|
if (interface_exists(ParamInterface::class)) {
|
||||||
$loader->load('fos_rest.xml');
|
$loader->load('fos_rest.xml');
|
||||||
|
@ -62,6 +62,7 @@ class TestKernel extends Kernel
|
|||||||
|
|
||||||
// Filter routes
|
// Filter routes
|
||||||
$c->loadFromExtension('nelmio_api_doc', [
|
$c->loadFromExtension('nelmio_api_doc', [
|
||||||
|
'source_folder' => '%kernel.root_dir%',
|
||||||
'routes' => [
|
'routes' => [
|
||||||
'path_patterns' => ['^/api(?!/admin)'],
|
'path_patterns' => ['^/api(?!/admin)'],
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user