Skip to content

Commit

Permalink
Add: API Validation for Sequence Backend
Browse files Browse the repository at this point in the history
  • Loading branch information
BLasan committed Sep 17, 2024
1 parent d277f6a commit 9c40f67
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2920,10 +2920,8 @@ public static void validateAPIEndpointConfig(Object endpointConfigObject, String
throws APIManagementException {
Map endpointConfigMap = (Map) endpointConfigObject;

if (endpointConfigMap.containsKey("endpoint_type") && endpointConfigMap.containsKey("sequence_name")
&& APIConstants.ENDPOINT_TYPE_SEQUENCE.equals(
if (endpointConfigMap.containsKey("endpoint_type") && APIConstants.ENDPOINT_TYPE_SEQUENCE.equals(
endpointConfigMap.get(APIConstants.API_ENDPOINT_CONFIG_PROTOCOL_TYPE))
&& !APIConstants.APITransportType.GRAPHQL.toString().equalsIgnoreCase(apiType)
&& !APIConstants.API_TYPE_HTTP.equalsIgnoreCase(apiType)
&& !APIConstants.API_TYPE_SOAPTOREST.equalsIgnoreCase(apiType)) {
throw new APIManagementException("Invalid endpoint configuration provided for the API " + apiName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public void restoreAPIRevision(Organization org, String apiUUID, String revision
GenericArtifact artifact = getAPIArtifact(apiUUID, registry);
artifact.setAttribute(APIConstants.API_OVERVIEW_STATUS, lifecycleStatus);
// Update with the modified artifact
artifactManager.updateGenericArtifact(artifact);
artifactManager.updateGenericArtifact(apiArtifact);
RegistryPersistenceUtil.clearResourcePermissions(apiPath, api.getId(),
((UserRegistry) registry).getTenantId());
RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,9 @@ private static void setCustomSequencesToBeAdded(APIProduct apiProduct, API api,

JsonObject endpointConfigMap = JsonParser.parseString(api.getEndpointConfig()).getAsJsonObject();
if (endpointConfigMap != null && APIConstants.ENDPOINT_TYPE_SEQUENCE.equals(
endpointConfigMap.get(APIConstants.API_ENDPOINT_CONFIG_PROTOCOL_TYPE).getAsString())) {
endpointConfigMap.get(APIConstants.API_ENDPOINT_CONFIG_PROTOCOL_TYPE).getAsString()) && (
APIConstants.API_TYPE_HTTP.equals(api.getType()) || APIConstants.API_TYPE_SOAPTOREST.equals(
api.getType()))) {
GatewayContentDTO gatewayCustomBackendSequenceDTO = retrieveCustomBackendSequence(api,
APIConstants.API_KEY_TYPE_SANDBOX, extractedPath);
if (gatewayCustomBackendSequenceDTO != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ public static File exportApi(APIProvider apiProvider, APIIdentifier apiIdentifie

JsonObject endpointConfig = JsonParser.parseString(api.getEndpointConfig()).getAsJsonObject();
if (APIConstants.ENDPOINT_TYPE_SEQUENCE.equals(
endpointConfig.get(API_ENDPOINT_CONFIG_PROTOCOL_TYPE).getAsString())) {
endpointConfig.get(API_ENDPOINT_CONFIG_PROTOCOL_TYPE).getAsString()) && StringUtils.equals(
apiDtoToReturn.getType().toString().toLowerCase(), APIConstants.API_TYPE_HTTP.toLowerCase())
|| StringUtils.equals(apiDtoToReturn.getType().toString().toLowerCase(),
APIConstants.API_TYPE_SOAPTOREST.toLowerCase())) {
addCustomBackendToArchive(archivePath, apiProvider, currentApiUuid);
}

Expand Down

0 comments on commit 9c40f67

Please sign in to comment.