apigee / apigeelint

Static code analysis for Apigee proxy bundles to encourage API developers to use best practices and avoid anti-patterns.
Apache License 2.0
91 stars 71 forks source link

fix: PD002 checks for zero unconditional RouteRules #440

Closed DinoChiesa closed 3 months ago

DinoChiesa commented 3 months ago

Alter plugin PD002 to now check for zero unconditional RouteRules.

Without this change PD002 checks for more than one unconditional RouteRule. But it does not check for exactly one. With zero unconditional RouteRules, at runtime the proxy can generate this error:

{
  "fault": {
    "faultstring": "Unable to route the message to a Target Endpoint",
    "detail": {
      "errorcode": "messaging.runtime.RouteFailed"
    }
  }
}

This change ALSO modifies PD002 to flag the redundant RouteRules when there are multiple. Previously it flagged every unconditional RouteRule (1..n); now it flags only 2..n.