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

[2.1.10] Swagger not working for multistore installs? #13474

Closed
zack6849 opened this issue Feb 2, 2018 · 3 comments
Closed

[2.1.10] Swagger not working for multistore installs? #13474

zack6849 opened this issue Feb 2, 2018 · 3 comments
Labels
Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@zack6849
Copy link
Contributor

zack6849 commented Feb 2, 2018

The default URL swagger attempts to fetch the details for the APIs is

http://base.url.example/rest/default/schema?services=all

The problem is, this doesn't work on our stores, Im not sure if magento's routing is expecting our default store's code to be default, or if it's a shortcut to the default store and not functioning for some other reason

For example, our store code for our default view is mxs, so our URL should be

http://mikesxs.test/rest/mxs/schema?services=all

but swagger isn't picking up on the default store code.

Preconditions

  1. Magento v2.1.10
  2. PHP v7.0.27
  3. Ubuntu Linux 17.10 "Artful"

Steps to reproduce

  1. Have a multistore setup (or maybe it just needs to have no store with the code default?)
  2. Navigate to ${base_url}/swagger/

Expected result

  1. It should show endpoints.

Actual result

  1. It doesn't.

I wrote a small patch that i'm using in our local environment, that obviously isn't something i'd put in a PR because it uses the ObjectManager to get the current store code, but for anyone else that's having this issue, it can be fixed by doing the following

edit the magento-swagger module's file view/frontend/templates/swagger-ui/index.phtml

Change the following line:
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/default/schema?services=all';

To this:

$objectManager = Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/' . $storeManager->getStore()->getCode(). '/schema?services=all'; 

and refresh the page / flush any caches and you should be set.

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Feb 2, 2018
@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Feb 8, 2018
@magento-engcom-team
Copy link
Contributor

@zack6849, thank you for your report.
We've acknowledged the issue and added to our backlog.

@magento-engcom-team magento-engcom-team added Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line and removed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Feb 8, 2018
@okorshenko okorshenko removed Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line labels Feb 22, 2018
@magento-engcom-team
Copy link
Contributor

@zack6849 The issue is already fixed in 2.2 and 2.3-dev.
Closing ticket for now. Please reopen if you need any further assistance with this.

@magento-engcom-team magento-engcom-team added Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line labels Mar 6, 2018
@magento-engcom-team
Copy link
Contributor

Hi @zack6849. Thank you for your report.
The issue has been fixed in #13486 by @JeroenVanLeusden in 2.1-develop branch
Related commit(s):

The fix will be available with the upcoming 2.1.14 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.1.x The issue has been fixed in 2.1 release line label Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests

3 participants