-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: Increase config version add new config key for documentation saving and check directory existing #127
base: master
Are you sure you want to change the base?
Conversation
-increase config version -on documentation saving directory should be created if not exists
add new config key for documentation saving and check directory existing
…agger into change-drivers-config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please cover new code by autotests
config/auto-doc.php
Outdated
@@ -128,7 +128,7 @@ | |||
'drivers' => [ | |||
'local' => [ | |||
'class' => LocalDriver::class, | |||
'production_path' => storage_path('documentation.json') | |||
'production_path' => storage_path(env('SWAGGER_DOCUMENTATION_PATH', '/swagger/documentation.json')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move directory as a separate config key
src/Drivers/LocalDriver.php
Outdated
@@ -18,6 +18,10 @@ public function __construct() | |||
if (empty($this->prodFilePath)) { | |||
throw new MissedProductionFilePathException(); | |||
} | |||
|
|||
if (!is_dir(dirname($this->prodFilePath))) { | |||
mkdir(dirname($this->prodFilePath),0777, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir(dirname($this->prodFilePath),0777, true); | |
mkdir(dirname($this->prodFilePath), 0777, true); |
src/Drivers/StorageDriver.php
Outdated
@@ -21,6 +21,10 @@ public function __construct() | |||
if (empty($this->prodFilePath)) { | |||
throw new MissedProductionFilePathException(); | |||
} | |||
|
|||
if (!is_dir(dirname($this->prodFilePath))) { | |||
mkdir(dirname($this->prodFilePath),0777, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I not sure that it will works for S3 or GCS drivers
config/auto-doc.php
Outdated
@@ -128,7 +128,7 @@ | |||
'drivers' => [ | |||
'local' => [ | |||
'class' => LocalDriver::class, | |||
'production_path' => storage_path('documentation.json') | |||
'production_path' => storage_path(env('SWAGGER_DOCUMENTATION_PATH', '/swagger').DIRECTORY_SEPARATOR.'documentation.json'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'production_path' => storage_path(env('SWAGGER_DOCUMENTATION_PATH', '/swagger').DIRECTORY_SEPARATOR.'documentation.json'), | |
'file_name' => 'documentation.json', | |
'file_path' => env('SWAGGER_DOCUMENTATION_PATH', 'documentation'), |
tests/LocalDriverTest.php
Outdated
$productionPath = __DIR__ . '/../storage/non_existent_directory/documentation.json'; | ||
config(['auto-doc.drivers.local.production_path' => $productionPath]); | ||
|
||
mkdir(dirname($productionPath), 0777, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
directory should be created by the testable class, not via the native php function
Quality Gate passedIssues Measures |
feat: Increase config version
add new config key for documentation saving and check directory existing