Skip to content

Commit 2c504cd

Browse files
authored
Add exceptions in the upgrading command to warn about the requirement to run it on 2.x (nelmio#1501)
1 parent 92dfcc4 commit 2c504cd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ for your APIs.
1212

1313
## Migrate from 2.x to 3.0
1414

15-
[To migrate from 2.x to 3.0, just follow our guide.](https://github.com/nelmio/NelmioApiDocBundle/blob/master/UPGRADE-3.0.md)
15+
[To migrate from 2.x to 3.0, follow our guide.](https://github.com/nelmio/NelmioApiDocBundle/blob/master/UPGRADE-3.0.md)
1616

1717
## Installation
1818

UPGRADE-3.0.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ class SwaggerDocblockConvertCommand extends ContainerAwareCommand
4444
{
4545
$views = explode(',', $input->getOption('views'));
4646

47+
if (!$this->getContainer()->has('nelmio_api_doc.extractor.api_doc_extractor')) {
48+
if (!$this->getContainer()->has('nelmio_api_doc.controller.swagger_ui')) {
49+
throw new \RuntimeException('NelmioApiDocBundle is not installed. Please run `composer require nelmio/api-doc-bundle`.');
50+
} else {
51+
throw new \RuntimeException('This command only works with NelmioApiDocBundle 2.x installed while version 3.x is currently installed. Please downgrade to 2.x to execute this command and bump your constraint only after its execution.');
52+
}
53+
}
54+
4755
$extractor = $this->getContainer()->get('nelmio_api_doc.extractor.api_doc_extractor');
4856

4957
$apiDocs = [];

0 commit comments

Comments
 (0)