-
Notifications
You must be signed in to change notification settings - Fork 48
#78: Store tmp doc data in file instead of static class property to use it in Artisan push-documentation command #80
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
#78: Store tmp doc data in file instead of static class property to use it in Artisan push-documentation command #80
Conversation
…use Artisan command to push documentation;
|
@DenTray Done as discussed. Could you please review this code? |
src/Drivers/StorageDriver.php
Outdated
| public function saveTmpData($data) | ||
| { | ||
| self::$data = $tempData; | ||
| $this->disk->put($this->tempFilePath, json_encode($data)); |
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.
tmp data should be stored in the local file, but storage disc may be set as remote storage which may cause a slow testing process. Please use file_put_contetn as well here
11a1d58 to
76f09fc
Compare
|
@DenTray Review conversations have been resolved. |
composer.json
Outdated
| "php": ">=7.3.0", | ||
| "laravel/framework": ">=5.3.0", | ||
| "phpunit/phpunit": ">=7.0|<=10.0" | ||
| "phpunit/phpunit": ">=7.0|<10.0" |
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.
| "phpunit/phpunit": ">=7.0|<10.0" | |
| "phpunit/phpunit": ">=7.0" |
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.
@DenTray We cannot remove this restriction, because we will have code that depends on code that does not exist in version 10 of PhpUnit lib.
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.
@vitgrams as we discussed, let's add this restriction after the swagger 3 will be released
src/Drivers/StorageDriver.php
Outdated
| public function getTmpData() | ||
| { | ||
| return self::$data; | ||
| if (file_exists($this->tempFilePath)) { |
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.
it seems we can move such duplicated logic to the parent BaseDriver class
|
@vitgrams please don't forget to rebuild composer.lock |
9a3eb0b to
676887a
Compare
…added MissedRemoteDocumentationUrlException Abstract BaseDriver has been added to unify saveTmpData, getTmpData methods semantic.
| | | ||
| | The name of driver, which will collect and save documentation | ||
| | Feel free to use your own driver class which should be inherited from | ||
| | `RonasIT\Support\AutoDoc\Interfaces\SwaggerDriverInterface` interface, |
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 believe we shouldn't force developers to use BaseDriver as the parent class.
Let's just make BaseDriver implementing SwaggerDriverInterface interface
src/Drivers/BaseDriver.php
Outdated
|
|
||
| namespace RonasIT\Support\AutoDoc\Drivers; | ||
|
|
||
| abstract class BaseDriver |
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.
| abstract class BaseDriver | |
| abstract class BaseDriver implements SwaggerDriverInterface |
src/Drivers/LocalDriver.php
Outdated
| public function __construct() | ||
| { | ||
| $this->prodFilePath = config('auto-doc.drivers.local.production_path'); | ||
| $this->tempFilePath = storage_path('temp_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.
could we also move it to the parent class
src/Drivers/LocalDriver.php
Outdated
| if (file_exists($this->tempFilePath)) { | ||
| unlink($this->tempFilePath); | ||
| } |
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.
let's move it to the new parent class method clearTmpData
Return removed SwaggerDriverInterface.
|
@DenTray Fixed. Could you please take a look? |
| public function __construct(string $driver) | ||
| { | ||
| parent::__construct("The driver '{$driver}' is not implements the SwaggerDriverInterface."); | ||
| parent::__construct("The driver '{$driver}' does not extend the BaseDriver class."); |
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 revert this one
| { | ||
| public function __construct($message = null, $code = 0, Exception $previous = null) | ||
| { | ||
| $message = $message ?? 'Remote documentation url missed in 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.
let's add the information about the env variable name which should be filled to fix it
composer.json
Outdated
| "php": ">=7.3.0", | ||
| "laravel/framework": ">=5.3.0", | ||
| "phpunit/phpunit": ">=7.0|<=10.0" | ||
| "phpunit/phpunit": ">=7.0|<10.0" |
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.
@vitgrams as we discussed, let's add this restriction after the swagger 3 will be released
|
SonarCloud Quality Gate failed.
|









…use Artisan command to push documentation;
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
Checklist: