Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add synapse expression support to validate mediator #2255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading