Your payload factory contains an invalid JSON

On Fri, Nov 24, 2017 at 7:27 PM, Lahiru Cooray <[email protected]>
wrote:

> 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>
>
*"* is missing
  <format>{"Error":*"*$1"}</format> should work

>                   <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
>
>


-- 
*Senduran *
Senior Software Engineer,
WSO2, Inc.;  http://wso2.com/ <http://wso2.com/>
Mobile: +94 77 952 6548
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to