mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Last fixes
This commit is contained in:
parent
8ec31194a2
commit
97b722f97d
@ -65,7 +65,7 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
|
||||
$nameAliases = $this->findNameAliases($config['models']['names'], $area);
|
||||
|
||||
$container->register(sprintf('nelmio_api_doc.generator.%s', $area), ApiDocGenerator::class)
|
||||
->setPublic(false)
|
||||
->setPublic(true)
|
||||
->addMethodCall('setAlternativeNames', [$nameAliases])
|
||||
->setArguments([
|
||||
new TaggedIteratorArgument(sprintf('nelmio_api_doc.describer.%s', $area)),
|
||||
|
@ -29,9 +29,9 @@ class ConfigurationTest extends TestCase
|
||||
{
|
||||
$processor = new Processor();
|
||||
$config = $processor->processConfiguration(new Configuration(), [['areas' => $areas = [
|
||||
'default' => ['path_patterns' => ['/foo'], 'documentation' => []],
|
||||
'internal' => ['path_patterns' => ['/internal'], 'host_patterns' => ['^swagger\.']],
|
||||
'commercial' => ['path_patterns' => ['/internal'], 'host_patterns' => []],
|
||||
'default' => ['path_patterns' => ['/foo'], 'host_patterns' => [], 'documentation' => []],
|
||||
'internal' => ['path_patterns' => ['/internal'], 'host_patterns' => ['^swagger\.'], 'documentation' => []],
|
||||
'commercial' => ['path_patterns' => ['/internal'], 'host_patterns' => [], 'documentation' => []],
|
||||
]]]);
|
||||
|
||||
$this->assertSame($areas, $config['areas']);
|
||||
|
@ -19,7 +19,8 @@ class FunctionalTest extends WebTestCase
|
||||
{
|
||||
public function testConfiguredDocumentation()
|
||||
{
|
||||
$this->assertEquals('My Test App', $this->getSwaggerDefinition()->getInfo()->getTitle());
|
||||
$this->assertEquals('My Default App', $this->getSwaggerDefinition()->getInfo()->getTitle());
|
||||
$this->assertEquals('My Test App', $this->getSwaggerDefinition('test')->getInfo()->getTitle());
|
||||
}
|
||||
|
||||
public function testUndocumentedAction()
|
||||
|
@ -41,6 +41,7 @@ class SwaggerUiTest extends WebTestCase
|
||||
yield ['/docs', 'default', $expected];
|
||||
|
||||
// Api-platform documentation
|
||||
$expected['info']['title'] = 'My Test App';
|
||||
$expected['paths'] = [
|
||||
'/api/dummies' => $expected['paths']['/api/dummies'],
|
||||
'/api/foo' => $expected['paths']['/api/foo'],
|
||||
|
@ -119,7 +119,7 @@ class TestKernel extends Kernel
|
||||
$c->loadFromExtension('nelmio_api_doc', [
|
||||
'documentation' => [
|
||||
'info' => [
|
||||
'title' => 'My Test App',
|
||||
'title' => 'My Default App',
|
||||
],
|
||||
'definitions' => [
|
||||
'Test' => [
|
||||
@ -138,23 +138,6 @@ class TestKernel extends Kernel
|
||||
'default' => [
|
||||
'path_patterns' => ['^/api(?!/admin)'],
|
||||
'host_patterns' => ['^api\.'],
|
||||
'documentation' => [
|
||||
'info' => [
|
||||
'title' => 'My Test App',
|
||||
],
|
||||
'definitions' => [
|
||||
'Test' => [
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
'parameters' => [
|
||||
'test' => [
|
||||
'name' => 'id',
|
||||
'in' => 'path',
|
||||
'required' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'test' => [
|
||||
'path_patterns' => ['^/test'],
|
||||
@ -163,18 +146,6 @@ class TestKernel extends Kernel
|
||||
'info' => [
|
||||
'title' => 'My Test App',
|
||||
],
|
||||
'definitions' => [
|
||||
'Test' => [
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
'parameters' => [
|
||||
'test' => [
|
||||
'name' => 'id',
|
||||
'in' => 'path',
|
||||
'required' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -22,11 +22,11 @@ class WebTestCase extends BaseWebTestCase
|
||||
return new TestKernel();
|
||||
}
|
||||
|
||||
protected function getSwaggerDefinition()
|
||||
protected function getSwaggerDefinition($area = 'default')
|
||||
{
|
||||
static::createClient([], ['HTTP_HOST' => 'api.example.com']);
|
||||
|
||||
return static::$kernel->getContainer()->get('nelmio_api_doc.generator')->generate();
|
||||
return static::$kernel->getContainer()->get(sprintf('nelmio_api_doc.generator.%s', $area))->generate();
|
||||
}
|
||||
|
||||
protected function getModel($name): Schema
|
||||
|
Loading…
x
Reference in New Issue
Block a user