Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

shahinyanmronas
Copy link

feat: Increase config version
add new config key for documentation saving and check directory existing

Shahinyanm and others added 3 commits April 29, 2024 17:32
-increase config version
-on documentation saving directory should be created if not exists
add new config key for documentation saving and check directory existing
Copy link
Collaborator

@DenTray DenTray left a 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

@@ -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')),
Copy link
Collaborator

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

@@ -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);
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
mkdir(dirname($this->prodFilePath),0777, true);
mkdir(dirname($this->prodFilePath), 0777, true);

@@ -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);
Copy link
Collaborator

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

@DenTray DenTray assigned shahinyanmronas and unassigned DenTray Apr 30, 2024
@@ -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'),
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
'production_path' => storage_path(env('SWAGGER_DOCUMENTATION_PATH', '/swagger').DIRECTORY_SEPARATOR.'documentation.json'),
'file_name' => 'documentation.json',
'file_path' => env('SWAGGER_DOCUMENTATION_PATH', 'documentation'),

$productionPath = __DIR__ . '/../storage/non_existent_directory/documentation.json';
config(['auto-doc.drivers.local.production_path' => $productionPath]);

mkdir(dirname($productionPath), 0777, true);
Copy link
Collaborator

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

Copy link

sonarcloud bot commented May 15, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants