Skip to content

Conversation

@vitgrams
Copy link
Contributor

@vitgrams vitgrams commented Mar 7, 2023

…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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@vitgrams
Copy link
Contributor Author

vitgrams commented Mar 7, 2023

@DenTray Done as discussed. Could you please review this code?

@DenTray DenTray requested a review from NikitaYakovlev March 7, 2023 10:01
public function saveTmpData($data)
{
self::$data = $tempData;
$this->disk->put($this->tempFilePath, json_encode($data));
Copy link
Collaborator

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

@DenTray DenTray assigned vitgrams and unassigned DenTray Mar 9, 2023
@vitgrams vitgrams force-pushed the 78_save_temp_doc_in_file_for_local_and_storage_drivers branch from 11a1d58 to 76f09fc Compare March 9, 2023 14:51
@vitgrams vitgrams assigned DenTray and unassigned vitgrams Mar 9, 2023
@vitgrams
Copy link
Contributor Author

vitgrams commented Mar 9, 2023

@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"
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
"phpunit/phpunit": ">=7.0|<10.0"
"phpunit/phpunit": ">=7.0"

Copy link
Contributor Author

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.

Copy link
Collaborator

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

public function getTmpData()
{
return self::$data;
if (file_exists($this->tempFilePath)) {
Copy link
Collaborator

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

@DenTray
Copy link
Collaborator

DenTray commented Mar 13, 2023

@vitgrams please don't forget to rebuild composer.lock

@DenTray DenTray assigned vitgrams and unassigned DenTray Mar 13, 2023
@vitgrams vitgrams force-pushed the 78_save_temp_doc_in_file_for_local_and_storage_drivers branch from 9a3eb0b to 676887a Compare March 13, 2023 13:13
…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,
Copy link
Collaborator

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


namespace RonasIT\Support\AutoDoc\Drivers;

abstract class BaseDriver
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
abstract class BaseDriver
abstract class BaseDriver implements SwaggerDriverInterface

public function __construct()
{
$this->prodFilePath = config('auto-doc.drivers.local.production_path');
$this->tempFilePath = storage_path('temp_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.

could we also move it to the parent class

Comment on lines 26 to 28
if (file_exists($this->tempFilePath)) {
unlink($this->tempFilePath);
}
Copy link
Collaborator

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

@vitgrams
Copy link
Contributor Author

@DenTray Fixed. Could you please take a look?

@vitgrams vitgrams removed their assignment Mar 14, 2023
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.");
Copy link
Collaborator

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

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"
Copy link
Collaborator

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

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vitgrams vitgrams assigned DenTray and unassigned DenTray Mar 21, 2023
@DenTray DenTray merged commit 1acfdaa into master Mar 21, 2023
@DenTray DenTray deleted the 78_save_temp_doc_in_file_for_local_and_storage_drivers branch September 18, 2023 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants