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

[DRUP-610] Add url as source for apidocs spec file and (DRUP-459) allow re-fetching it afterwards. #2

Merged
merged 50 commits into from
May 27, 2019
Merged

[DRUP-610] Add url as source for apidocs spec file and (DRUP-459) allow re-fetching it afterwards. #2

merged 50 commits into from
May 27, 2019

Conversation

Jaesin
Copy link
Contributor

@Jaesin Jaesin commented May 17, 2019

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@Jaesin
Copy link
Contributor Author

Jaesin commented May 17, 2019

@cnovak cnovak added the cla: yes Indicates CLA has been signed label May 17, 2019
composer.json Show resolved Hide resolved
src/Entity/ApiDoc.php Outdated Show resolved Hide resolved
src/Entity/ApiDoc.php Outdated Show resolved Hide resolved
'%label' => $this->entity->label(),
]));
}
// TODO: $needs_save doesn't tell us if something went wrong.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly why I suggested earlier to throw an exception when file fetching or saving fails instead of returning a boolean indicator value which is not the OOP solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO was added so it can be changed in a follow up task.

Copy link
Contributor

@mxr576 mxr576 May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which is the related follow-up task to this? Probably it would be better to create it as a GH issue, because that could be referenced in this PR.
Also, please keep in mind that if this module gets stable before this issue gets fixed then technically, you should not change what it is in SpecFetcherInterface::fetchSpec() without releasing a new major version because that would be a BC breaking change. So any implementation that implements this interface should not throw any exception and should always return a boolean value because this is what it is in the contract.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#14

src/SpecFetcher.php Show resolved Hide resolved
src/SpecFetcher.php Outdated Show resolved Hide resolved
private function checkRequirements(string $destination): void {
// If using private filesystem, check that it's been configured.
if (strpos($destination, 'private://') === 0 && !$this->isPrivateFileSystemConfigured()) {
throw new \Exception('Private filesystem has not been configured.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no problem with addressing this in a followup PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which is the related follow-up task to this? Probably it would be better to create it as a GH issue, because that could be referenced in this PR.

$this->httpClient = $http_client;
$this->entityTypeManager = $entityTypeManager;
$this->messenger = $messenger;
$this->logger = $logger;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this is a micro-optimization, I have no problem addressing it in a followup task.

Copy link
Contributor

@mxr576 mxr576 May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which is the related follow-up task to this? Probably it would be better to create it as a GH issue, because that could be referenced in this PR.

@mxr576
Copy link
Contributor

mxr576 commented May 20, 2019

#2 (comment)
The specfetcher service and the automated imported process still do not have a test coverage although these are the most important changes of this PR.

@cnovak cnovak added this to the 1.0.0-beta1 milestone May 22, 2019
@cnovak cnovak added cla: yes Indicates CLA has been signed and removed cla: yes Indicates CLA has been signed labels May 24, 2019
@Jaesin
Copy link
Contributor Author

Jaesin commented May 25, 2019

There are no new tests in this PR. Tests will be added in a followup PR.

Existing test results:

Testing started at 17:47 ...
/usr/local/Cellar/php@7.2/7.2.15/bin/php .../vendor/phpunit/phpunit/phpunit --configuration .../phpunit.xml .../modules/contrib/apigee_api_catalog/tests --teamcity
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.

Testing .../modules/contrib/apigee_api_catalog/tests


Time: 57.47 seconds, Memory: 6.00MB

OK (9 tests, 116 assertions)

arlina-espinoza and others added 24 commits May 24, 2019 22:52
…e to spec_file_source and make it list_string type.
The default value for the `http_errors` option is `TRUE`.
[DRUP-624] Add revisions to API Docs.
….com/Jaesin/apigee-api-catalog-drupal into Jaesin-8.x-1.x-DRUP-610-459-apidocs-add-url

# Conflicts:
#	apigee_api_catalog.links.task.yml
#	src/Entity/Access/ApiDocAccessControlHandler.php
#	src/Entity/ApiDoc.php
#	src/Entity/ApiDocInterface.php
#	src/Entity/Form/ApiDocForm.php

Also updated ApidocEntityTest.php w/ options & file_link modules to get tests to pass.
Copy link
Collaborator

@cnovak cnovak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good now w/latest updates, should have issues in for anything outstanding. After merging other commits this PR had conflicts. I resolved merge conflicts, then ran phpcs and phpunit and all tests now pass.

However, @Jaesin you should look over ApiDocAccessControlHandler:checkAccess() to make sure that method was properly merged.

Test results:

 ../vendor/bin/phpunit --configuration core modules/contrib/apigee_api_catalog/ 
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing modules/contrib/apigee_api_catalog/
..............                                                    14 / 14 (100%)

Time: 3.36 minutes, Memory: 10.00MB

OK (14 tests, 158 assertions)

src/Entity/ApiDoc.php Outdated Show resolved Hide resolved
@Jaesin
Copy link
Contributor Author

Jaesin commented May 27, 2019

ApiDocAccessControlHandler:checkAccess() looks right to me and all of the access tests pass so it should be good to go.

@cnovak cnovak merged commit 57a5066 into apigee:8.x-1.x May 27, 2019
@Jaesin Jaesin deleted the 8.x-1.x-DRUP-610-459-apidocs-add-url branch May 28, 2019 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates CLA has been signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants