[MGNLREST-70] REST tools module uses an old version of swagger ui, meaning that relative api base paths do not work Created: 11/May/16  Updated: 09/May/19  Resolved: 26/Sep/16

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2

Type: Improvement Priority: Major
Reporter: Mike Nuttall Assignee: Cedric Reichenbach
Resolution: Fixed Votes: 0
Labels: devwl, support
Remaining Estimate: 0d
Time Spent: 3h
Original Estimate: Not Specified
Environment:

OSX Version: 10.11.2 - El Capitan


Issue Links:
Relates
relates to MAGNOLIA-6814 Update 3rd-party libraries for next m... Closed
causality
is causing MGNLREST-77 First access to Swagger UI produces m... Open
is causing MGNLREST-84 Custom endpoints no longer show up in... Closed
duplicate
duplicates MGNLREST-63 Update Swagger to 2.0 Closed
relation
is related to MGNLCACHE-148 Update module in order to use newer S... Closed
is related to MGNLREST-202 Update the REST tools module to inclu... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: Swagger API Update
Sprint: Basel 63
Story Points: 13

 Description   

The REST tools module (version 1.1.1) uses an old version of swagger-ui (although I cannot see the version specified in the source code.)

This old version relies on the shred javascript library. This version of the library contains a bug which means that the basePath attribute cannot be a relative url when the rest tools are served from a non standard port (See https://github.com/pandastrike/shred/issues/60).

In newer versions of swagger-ui, the shred library is no longer used for ajax requests, and it is possible to use swagger with a relative base path (this is something we have done in other projects - see attached screenshot.)

We think it is useful to be able to use a relative basePath if need be, as the port/ full url that Magnolia will run on is not always known before start up, and therefore cannot always be managed by .properties files.

We have managed to get the swagger ui working in magnolia if we set the relative base path (e.g. "/.rest") and hotfix the shred.bundle.js rest-tools resource as shown in the attachments. This proves that relative base paths should work fine if swagger-ui was updated, or the dependency is hotfixed.


Generated at Mon Feb 12 06:56:17 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.