Skip to content

feat(config): allow to disable api platform support #2401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public function getConfigTreeBuilder(): TreeBuilder
->info('If true, `groups` passed to @Model annotations will be used to limit validation constraints')
->defaultFalse()
->end()
->booleanNode('api_platform_support')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->booleanNode('api_platform_support')
->booleanNode('api_platform')

->info('If false, the service declaration that support ApiPlatform will not be loaded even if ApiPlatform is detected in your installation')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->info('If false, the service declaration that support ApiPlatform will not be loaded even if ApiPlatform is detected in your installation')
->info('Enable API Platform integration'')

->defaultTrue()
->end()
->arrayNode('cache')
->validate()
->ifTrue(function ($v) { return null !== $v['item_id'] && null === $v['pool']; })
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/NelmioApiDocExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function load(array $configs, ContainerBuilder $container): void
}

// ApiPlatform support
if (isset($bundles['ApiPlatformBundle']) && class_exists('ApiPlatform\Documentation\Documentation')) {
if ($config['api_platform_support'] && isset($bundles['ApiPlatformBundle']) && class_exists('ApiPlatform\Documentation\Documentation')) {
$loader->load('api_platform.xml');
}

Expand Down
Loading