简体   繁体   中英

How to validate JSON in WSO2 ESB mediator?

Does the validate mediator validate a message payload against a JSON schema?

If validate mediator does not validate JSON against a schema, what is the best workaround?

Currently there is no native JSON schema validation support in any ESB mediators. As a workaround, you will have to create an XSD structure as per your JSON payload and then use it in the validate mediator [1].

But however this feature is available in the road map [2].

[1] - https://docs.wso2.com/display/ESB490/Validate+Mediator

[2] - https://wso2.org/jira/browse/ESBJAVA-4640

You can simply do this using filter mediators. use filter mediators for validate required keys/values in request.

for more details about filter mediators refer the below [1] wso2 doc

[1] - https://docs.wso2.com/display/ESB480/Filter+Mediator

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM