cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Data Validator - validate pipeline parameters?

Henchway
Contributor

Is there a way to validate the pipeline parameters using the data validator?
Getting the following error when trying to validate a pipeline parameter:

Data Validator[5dc15a412e2bfc322115a57d_286ad388-7bdb-4bcf-be8e-0cb286d68710 -- f2cdd56e-15b0-4ea4-a8a7-bf0d537584d2]
com.snaplogic.snap.api.SnapDataException: Error occurred while validating the document against the defined constraints
	at com.snaplogic.snaps.flow.DataValidator.getException(DataValidator.java:423)
	at com.snaplogic.snaps.flow.DataValidator.process(DataValidator.java:404)
	at com.snaplogic.snap.api.ExecutionUtil.process(ExecutionUtil.java:106)
	at com.snaplogic.snap.api.ExecutionUtil.executeForDocument(ExecutionUtil.java:118)
	at com.snaplogic.snap.api.ExecutionUtil.execute(ExecutionUtil.java:81)
	at com.snaplogic.snap.api.SimpleSnap.execute(SimpleSnap.java:70)
	at com.snaplogic.cc.snap.common.SnapRunnableImpl.executeSnap(SnapRunnableImpl.java:803)
	at com.snaplogic.cc.snap.common.SnapRunnableImpl.execute(SnapRunnableImpl.java:585)
	at com.snaplogic.cc.snap.common.SnapRunnableImpl.doRun(SnapRunnableImpl.java:868)
	at com.snaplogic.cc.snap.common.SnapRunnableImpl.call(SnapRunnableImpl.java:435)
	at com.snaplogic.cc.snap.common.SnapRunnableImpl.call(SnapRunnableImpl.java:117)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Reason: Missing property value of $._opportunityId
Resolution: Address the reported issue.

Mapping this to a field beforehand defeats the purpose in this case, as I want to check whether this variable has been delivered.
Alternatively I could probably add an error view to a mapper and try mapping the parameters.

Best regards
Thomas

1 REPLY 1

alex_panganiban
Contributor

You can check if a property exists by using the hasPath() method. In this example, the previous snap only passed an element called, fileDate. The element, noSuchProperty, was not passed into the snap.

Alternatively, depending on what you ultimately want to achieve, you might also want to use the get() method. This method will check to see if your element exists. If it does, then the element will be evaluated and its value will be passed into your target path. If it does not exist, then a null value will be passed into your target path.

image

Using these suggestions might fit into the constraints of the Data Validator snap, but I think it would give you what youโ€™re looking for.