Rothamsted / knetminer

KnetMiner - webapp to search and visualize genome-scale knowledge graphs
https://knetminer.com
MIT License
25 stars 16 forks source link

Making the data source ID optional in API URLs #753

Closed marco-brandizi closed 1 year ago

marco-brandizi commented 1 year ago

From the logical point of view, the API URLs don't need the data source ID in their paths and haven't for quite a while now, since we have changed the server architecture to support one data source only.

So far, having URLs like host/ws/poaceae/... hasn't been a big deal, despite /poaceae isn't logically needed.

Now that we are about to switch the knetminer.com proxy mappings, from /ws/poaceae/* to /poaceae/ws/*, forcing the DS in the URL path would force us to have really weird URLs like https://knetminer.com/poaceae/ws/poaceae/*.

A possible workaround is mapping /ws/poaceae/* to internalhost/ws/poaceae/*, when normally the target is internalhost/ws/poaceae/*. However, this would conflict with a quantity of code which tries to auto-guess the API URL by following the pattern where the API ID is specified.

In conclusion, the solution is to make the DS ID optional, in a backward-compatible way, ie, without eliminating it altogether. In other words, both /ws/genome?... and /ws/poaceae/genome?... would work the same, with client code using the second.

This can be done with changes in Spring annotations and in the code to deal with the case the DS is null (corresponding to being omitted from the URL).

Unfortunately, we have to do this before reviewing the proxy mappings. More precisely, we have to:

  1. Make the changes in this hereby issue and test (locally and on ci-test)
  2. retrofit them into the 5.6 branch and make them available for the final 5.6 release
  3. re-deploy production instances