mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Add docs for areas
This commit is contained in:
parent
29f3042754
commit
5a6145fac8
@ -40,12 +40,6 @@ final class Configuration implements ConfigurationInterface
|
||||
->thenInvalid('You must not use both `nelmio_api_doc.areas` and `nelmio_api_doc.routes` config options. Please update your config to only use `nelmio_api_doc.areas`.')
|
||||
->end()
|
||||
->children()
|
||||
->arrayNode('documentation')
|
||||
->useAttributeAsKey('key')
|
||||
->info('The documentation used as base')
|
||||
->example(['info' => ['title' => 'My App']])
|
||||
->prototype('variable')->end()
|
||||
->end()
|
||||
->arrayNode('areas')
|
||||
->info('Filter the routes that are documented')
|
||||
->defaultValue(['default' => ['path_patterns' => [], 'host_patterns' => []]])
|
||||
@ -77,6 +71,12 @@ final class Configuration implements ConfigurationInterface
|
||||
->example(['^api\.'])
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->arrayNode('documentation')
|
||||
->useAttributeAsKey('key')
|
||||
->info('The documentation used as base')
|
||||
->example(['info' => ['title' => 'My App']])
|
||||
->prototype('variable')->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
|
@ -13,6 +13,7 @@ namespace Nelmio\ApiDocBundle\DependencyInjection;
|
||||
|
||||
use FOS\RestBundle\Controller\Annotations\ParamInterface;
|
||||
use Nelmio\ApiDocBundle\ApiDocGenerator;
|
||||
use Nelmio\ApiDocBundle\Describer\ExternalDocDescriber;
|
||||
use Nelmio\ApiDocBundle\Describer\RouteDescriber;
|
||||
use Nelmio\ApiDocBundle\Describer\SwaggerPhpDescriber;
|
||||
use Nelmio\ApiDocBundle\ModelDescriber\BazingaHateoasModelDescriber;
|
||||
@ -103,6 +104,16 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
|
||||
new Reference('logger'),
|
||||
])
|
||||
->addTag(sprintf('nelmio_api_doc.describer.%s', $area), ['priority' => -200]);
|
||||
|
||||
$container->register(sprintf('nelmio_api_doc.describers.config.%s', $area), ExternalDocDescriber::class)
|
||||
->setPublic(false)
|
||||
->setArguments([
|
||||
$config['areas'][$area]['documentation'],
|
||||
true,
|
||||
])
|
||||
->addTag(sprintf('nelmio_api_doc.describer.%s', $area), ['priority' => 1000]);
|
||||
|
||||
$container->getDefinition(sprintf('nelmio_api_doc.describers.config.%s', $area))->replaceArgument(0, $config['areas'][$area]['documentation']);
|
||||
}
|
||||
|
||||
$container->register('nelmio_api_doc.generator_locator')
|
||||
@ -151,9 +162,6 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// Import the base configuration
|
||||
$container->getDefinition('nelmio_api_doc.describers.config')->replaceArgument(0, $config['documentation']);
|
||||
}
|
||||
|
||||
private function findNameAliases(array $names, string $area): array
|
||||
|
@ -26,7 +26,7 @@
|
||||
<service id="nelmio_api_doc.describers.config" class="Nelmio\ApiDocBundle\Describer\ExternalDocDescriber" public="false">
|
||||
<argument type="collection" />
|
||||
|
||||
<tag name="nelmio_api_doc.describer" priority="1000" />
|
||||
<tag name="nelmio_api_doc.describer" priority="-1000" />
|
||||
</service>
|
||||
|
||||
<service id="nelmio_api_doc.describers.default" class="Nelmio\ApiDocBundle\Describer\DefaultDescriber" public="false">
|
||||
|
@ -26,6 +26,7 @@ final class FilteredRouteCollectionBuilder
|
||||
->setDefaults([
|
||||
'path_patterns' => [],
|
||||
'host_patterns' => [],
|
||||
'documentation' => [],
|
||||
])
|
||||
->setAllowedTypes('path_patterns', 'string[]')
|
||||
->setAllowedTypes('host_patterns', 'string[]')
|
||||
|
Loading…
x
Reference in New Issue
Block a user