mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-13 04:59:24 +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`.')
|
->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()
|
->end()
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('documentation')
|
|
||||||
->useAttributeAsKey('key')
|
|
||||||
->info('The documentation used as base')
|
|
||||||
->example(['info' => ['title' => 'My App']])
|
|
||||||
->prototype('variable')->end()
|
|
||||||
->end()
|
|
||||||
->arrayNode('areas')
|
->arrayNode('areas')
|
||||||
->info('Filter the routes that are documented')
|
->info('Filter the routes that are documented')
|
||||||
->defaultValue(['default' => ['path_patterns' => [], 'host_patterns' => []]])
|
->defaultValue(['default' => ['path_patterns' => [], 'host_patterns' => []]])
|
||||||
@ -77,6 +71,12 @@ final class Configuration implements ConfigurationInterface
|
|||||||
->example(['^api\.'])
|
->example(['^api\.'])
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
->end()
|
->end()
|
||||||
|
->arrayNode('documentation')
|
||||||
|
->useAttributeAsKey('key')
|
||||||
|
->info('The documentation used as base')
|
||||||
|
->example(['info' => ['title' => 'My App']])
|
||||||
|
->prototype('variable')->end()
|
||||||
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
@ -13,6 +13,7 @@ namespace Nelmio\ApiDocBundle\DependencyInjection;
|
|||||||
|
|
||||||
use FOS\RestBundle\Controller\Annotations\ParamInterface;
|
use FOS\RestBundle\Controller\Annotations\ParamInterface;
|
||||||
use Nelmio\ApiDocBundle\ApiDocGenerator;
|
use Nelmio\ApiDocBundle\ApiDocGenerator;
|
||||||
|
use Nelmio\ApiDocBundle\Describer\ExternalDocDescriber;
|
||||||
use Nelmio\ApiDocBundle\Describer\RouteDescriber;
|
use Nelmio\ApiDocBundle\Describer\RouteDescriber;
|
||||||
use Nelmio\ApiDocBundle\Describer\SwaggerPhpDescriber;
|
use Nelmio\ApiDocBundle\Describer\SwaggerPhpDescriber;
|
||||||
use Nelmio\ApiDocBundle\ModelDescriber\BazingaHateoasModelDescriber;
|
use Nelmio\ApiDocBundle\ModelDescriber\BazingaHateoasModelDescriber;
|
||||||
@ -103,6 +104,16 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
|
|||||||
new Reference('logger'),
|
new Reference('logger'),
|
||||||
])
|
])
|
||||||
->addTag(sprintf('nelmio_api_doc.describer.%s', $area), ['priority' => -200]);
|
->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')
|
$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
|
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">
|
<service id="nelmio_api_doc.describers.config" class="Nelmio\ApiDocBundle\Describer\ExternalDocDescriber" public="false">
|
||||||
<argument type="collection" />
|
<argument type="collection" />
|
||||||
|
|
||||||
<tag name="nelmio_api_doc.describer" priority="1000" />
|
<tag name="nelmio_api_doc.describer" priority="-1000" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="nelmio_api_doc.describers.default" class="Nelmio\ApiDocBundle\Describer\DefaultDescriber" public="false">
|
<service id="nelmio_api_doc.describers.default" class="Nelmio\ApiDocBundle\Describer\DefaultDescriber" public="false">
|
||||||
|
@ -26,6 +26,7 @@ final class FilteredRouteCollectionBuilder
|
|||||||
->setDefaults([
|
->setDefaults([
|
||||||
'path_patterns' => [],
|
'path_patterns' => [],
|
||||||
'host_patterns' => [],
|
'host_patterns' => [],
|
||||||
|
'documentation' => [],
|
||||||
])
|
])
|
||||||
->setAllowedTypes('path_patterns', 'string[]')
|
->setAllowedTypes('path_patterns', 'string[]')
|
||||||
->setAllowedTypes('host_patterns', 'string[]')
|
->setAllowedTypes('host_patterns', 'string[]')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user