Skip to content

Commit

Permalink
Fix error in GraphQL logic in config ds
Browse files Browse the repository at this point in the history
  • Loading branch information
sgayangi committed Mar 12, 2024
1 parent e77cbef commit 10c0d3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion runtime/config-deployer-service/ballerina/APIClient.bal
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,6 @@ public class APIClient {
private isolated function retrieveGQLRouteMatch(APKOperations apiOperation) returns model:GQLRouteMatch|error {
model:GQLType? routeMatch = model:getGQLRouteMatch(<string>apiOperation.verb);
if routeMatch is model:GQLType {
log:printInfo(routeMatch);
return {'type: routeMatch, path: <string>apiOperation.target};
} else {
return e909052(error("Error occured retrieving GQL route match", message = "Internal Server Error", code = 909000, description = "Internal Server Error", statusCode = 500));
Expand Down
8 changes: 5 additions & 3 deletions runtime/config-deployer-service/ballerina/DeployerClient.bal
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public class DeployerClient {
}
}
private isolated function deployRoutes(model:HTTPRoute[]? httproutes, model:GQLRoute[]? gqlroutes, string namespace, model:OwnerReference ownerReference) returns error? {
if httproutes is model:HTTPRoute[] {
if httproutes is model:HTTPRoute[] && httproutes.length() > 0 {
model:HTTPRoute[] deployReadyHttproutes = httproutes;
model:HTTPRoute[]|commons:APKError orderedHttproutes = self.createHttpRoutesOrder(httproutes);
if orderedHttproutes is model:HTTPRoute[] {
Expand Down Expand Up @@ -379,7 +379,7 @@ public class DeployerClient {
}
}
}
} else if gqlroutes is model:GQLRoute[] {
} else if gqlroutes is model:GQLRoute[] && gqlroutes.length() > 0 {
model:GQLRoute[] deployReadyGqlRoutes = gqlroutes;
model:GQLRoute[]|commons:APKError orderedGqlRoutes = self.createGqlRoutesOrder(gqlroutes);
if orderedGqlRoutes is model:GQLRoute[] {
Expand Down Expand Up @@ -408,8 +408,10 @@ public class DeployerClient {
}
}
}
} else {
log:printError("Error occured while deploying routes");
return e909022("Error occured while deploying routes", error("Error occured while deploying routes"));
}

}

public isolated function createHttpRoutesOrder(model:HTTPRoute[] httproutes) returns model:HTTPRoute[]|commons:APKError {
Expand Down

0 comments on commit 10c0d3e

Please sign in to comment.