Skip to content

Commit

Permalink
Add synapse expression support to validate mediator
Browse files Browse the repository at this point in the history
Add synapse expression support to validate mediator
  • Loading branch information
GDLMadushanka committed Dec 13, 2024
1 parent 546f86c commit a7f2074
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.apache.synapse.util.resolver.ResourceMap;
import org.apache.synapse.util.resolver.UserDefinedXmlSchemaURIResolver;
import org.apache.synapse.util.xpath.SourceXPathSupport;
import org.apache.synapse.util.xpath.SynapseExpression;
import org.apache.synapse.util.xpath.SynapseJsonPath;
import org.apache.synapse.util.xpath.SynapseXPath;
import org.xml.sax.SAXException;
Expand Down Expand Up @@ -279,10 +280,11 @@ public boolean mediate(MessageContext synCtx) {
String jsonPayload = null;
if (sourcePath != null) {
//evaluating
if (sourcePath instanceof SynapseJsonPath) {
if (sourcePath instanceof SynapseJsonPath || sourcePath instanceof SynapseExpression) {
jsonPayload = sourcePath.stringValueOf(synCtx);
} else {
handleException("Could not find the JSONPath evaluator for Source", synCtx);
handleException("Could not find JSONPath or Synapse Expression to extract the message " +
"to validate from the payload", synCtx);
}
} else {
jsonPayload = JsonUtil.jsonPayloadToString(a2mc);
Expand Down

0 comments on commit a7f2074

Please sign in to comment.