Hi team,
Im using ESB 5.0.0 and trying to validate a json payload against a schema.
Below is my sample synapse code snippet

 <validate>
            <schema key="conf:/schema/sample.json"/>
            <on-fail>
               <payloadFactory media-type="json">
                  <format>{"Error":$1"}</format>
                  <args>
                     <arg evaluator="xml" expression="$ctx:ERROR_MESSAGE"/>
                  </args>
               </payloadFactory>
               <property name="HTTP_SC" value="500" scope="axis2"/>
               <respond/>
            </on-fail>
         </validate>

When I try to send an invalid payload it gets validated but the specific
erroneous property is not returned.

DEBUG - wire HTTP-Listener I/O dispatcher-3 << "{"Error":the following
keywords are unknown and will be ignored: [$id]"}[\r][\n]"

Is there a way to access the specific invalid property and return a custom
message. Appreciate your help!

Regards,
Lahiru
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to