Getting this error message in the /admin/config/services/openapi/swagger-ui/jsonapi when trying to access Swagger UI Json API Documentation. We've tried to uninstall and reenable the module. No changes.
Warning: file_get_contents(libraries/swagger-ui/dist/swagger-ui-bundle.js): failed to open stream: No such file or directory in Drupal\Core\Asset\JsOptimizer->optimize() (line 25 of core/lib/Drupal/Core/Asset/JsOptimizer.php).
Drupal\Core\Asset\JsOptimizer->optimize(Array) (Line: 115)
Drupal\Core\Asset\JsCollectionOptimizer->optimize(Array) (Line: 297)
Drupal\Core\Asset\AssetResolver->getJsAssets(Object, 1) (Line: 298)
...
...
and
Warning: file_get_contents(libraries/swagger-ui/dist/swagger-ui-standalone-preset.js): failed to open stream: No such file or directory in Drupal\Core\Asset\JsOptimizer->optimize() (line 25 of core/lib/Drupal/Core/Asset/JsOptimizer.php).
Drupal\Core\Asset\JsOptimizer->optimize(Array) (Line: 115)
Drupal\Core\Asset\JsCollectionOptimizer->optimize(Array) (Line: 297)
Drupal\Core\Asset\AssetResolver->getJsAssets(Object, 1) (Line: 298)
...
...
Comments
Comment #2
richgerdesThe OpenAPI Swagger UI module requires the installation of the Swagger UI javascript library. This requirement and installation steps are detailed in the sub module's README.
However, there is merit in the module gracefully handling this requirement and providing user feedback if the library is missing; either trough a message on the page or the Drupal status page.
Comment #3
johnreytanquinco commented@richgerdes Perfect. Thanks for pointing out. Will try it.
Comment #4
richgerdesRevisiting this issue as I found that the instructions could use a little revising. I switched them to leverage packagist as the source for the the library instead of manually defining the download from git.
Note that when installing the latest version from Packagist, I noticed that it does not render nicely. For now the instructions in the Readme pin swagger-ui at version 3.0.17, which I can confirm should work and look okay with the current version of the project. I am going to have to revisit getting a more recent version of SwaggerUI working within the Drupal install once some other issues have been fixed with this module.
I have also opened #2940512: Missing SwaggerUI library provides a blank page. to include a message on the page when the library is not found.
See the attached patch for the updated instructions.
Comment #6
richgerdes