Hi @david2 ,
Yes this will have an impact on vendors. Luckily it will only affect the consumers of the Java API so if they’re using REST APIs for their scripts or add-ons then they have nothing to worry about.
For consumers of the Java API that want to simultaneously support both versions of the API I would suggest a bridge layer that would decide what version of the API to use and converting it to your own internal preference. I have anecdotal evidence that quite a few vendors already have similar and we even do something like that for Portfolio for Jira.
So abstracting calls to the JSD API through your own wrapper
Your code
|
|
JSD Bridge
|
+------------+
| |
JSD 3.x JSD 4.x
The choice of whether you convert the exceptions to Either<AnError, T> like it used to be or convert the Eithers to Exceptions is entirely up to the vendor and how they want to handle things.
Those might look something like
try {
ServiceDeskComment serviceDeskComment = serviceDeskCommentService.getServiceDeskCommentById(user, commentId);
} catch (ServiceDeskServiceException e) {
return Either.left(new AnError(ErrorMessage.builder().message(e.getMessage()).build(), HttpStatusCode.INTERNAL_SERVER_ERROR));
}
or
either.fold(err -> {
throw new ServerException(err.getMessage());
}, Function.identity());
Both of which I’d put in some kind of helper to help keep the duplication down.
Hope that helps
Lachlan Goodhew-Cook
Senior Developer, Jira Service Desk Team