Source:
public Response apisApiIdSwaggerPut(String apiId, String apiDefinition, String url, InputStream fileInputStream, Attachment fileDetail, String ifMatch, MessageContext messageContext) { Map validationResponseMap = null; try { String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); APIIdentifier apiIdentifier = APIMappingUtil.getAPIIdentifierFromUUID(apiId, tenantDomain); boolean isSoapToRestConvertedAPI = SOAPOperationBindingUtils.isSOAPToRESTApi(apiIdentifier.getApiName(), apiIdentifier.getVersion(), apiIdentifier.getProviderName()); if(url != null || fileInputStream != null) { validationResponseMap = validateOpenAPIDefinition(url, fileInputStream, fileDetail, true); APIDefinitionValidationResponse validationResponse = (APIDefinitionValidationResponse) validationResponseMap .get(RestApiConstants.RETURN_MODEL); apiDefinition = validationResponse.getJsonContent(); } String updatedSwagger = updateSwagger(apiId, apiDefinition); if (isSoapToRestConvertedAPI) { SequenceGenerator.generateSequencesFromSwagger(updatedSwagger, apiIdentifier); } return Response.ok().entity(updatedSwagger).build(); } catch (APIManagementException e) { if (RestApiUtil.isDueToResourceNotFound(e) || RestApiUtil.isDueToAuthorizationFailure(e)) { RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_API, apiId, e, log); } else if (isAuthorizationFailure(e)) { RestApiUtil.handleAuthorizationFailure( "Authorization failure while updating swagger definition of API: " + apiId, e, log); } else { String errorMessage = "Error while updating the swagger definition of the API: " + apiId + " - " + e.getMessage(); RestApiUtil.handleInternalServerError(errorMessage, e, log); } } catch (FaultGatewaysException e) { String errorMessage = "Error while updating API : " + apiId; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }

Target:
public Response apisApiIdSwaggerPut(String apiId, String apiDefinition, String url, InputStream fileInputStream, Attachment fileDetail, String ifMatch, MessageContext messageContext) { try { String updatedSwagger; String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); APIIdentifier apiIdentifier = APIMappingUtil.getAPIIdentifierFromUUID(apiId, tenantDomain); boolean isSoapToRestConvertedAPI = SOAPOperationBindingUtils.isSOAPToRESTApi(apiIdentifier.getApiName(), apiIdentifier.getVersion(), apiIdentifier.getProviderName()); if(url != null || fileInputStream != null) { Map validationResponseMap = validateOpenAPIDefinition(url, fileInputStream, fileDetail, true); APIDefinitionValidationResponse validationResponse = (APIDefinitionValidationResponse) validationResponseMap .get(RestApiConstants.RETURN_MODEL); if (!validationResponse.isValid()) { RestApiUtil.handleBadRequest(validationResponse.getErrorItems(), log); } updatedSwagger = updateSwagger(apiId, validationResponse); } else { updatedSwagger = updateSwagger(apiId, apiDefinition); } if (isSoapToRestConvertedAPI) { SequenceGenerator.generateSequencesFromSwagger(updatedSwagger, apiIdentifier); } return Response.ok().entity(updatedSwagger).build(); } catch (APIManagementException e) { if (RestApiUtil.isDueToResourceNotFound(e) || RestApiUtil.isDueToAuthorizationFailure(e)) { RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_API, apiId, e, log); } else if (isAuthorizationFailure(e)) { RestApiUtil.handleAuthorizationFailure( "Authorization failure while updating swagger definition of API: " + apiId, e, log); } else { String errorMessage = "Error while updating the swagger definition of the API: " + apiId + " - " + e.getMessage(); RestApiUtil.handleInternalServerError(errorMessage, e, log); } } catch (FaultGatewaysException e) { String errorMessage = "Error while updating API : " + apiId; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }