Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Can we validate json message against json schema in APIGEE?

Not applicable

I could see that Message Validation policy can validate that json message is well-formed ,and also xml or soap with xsd.But is there any way to validate json message against json schema?

I want to validate incoming json message against its length and data type.What is the way to do this in proxy?

Solved Solved
1 17 1,116
2 ACCEPTED SOLUTIONS

You can do this in two ways

1. Node.js

There are some node.js libraries to validate a JSON.

https://www.npmjs.com/package/jsonschema

You can run these node.js validator on edge in combination of proxy chaining and achieve the desired functionality.

2. Java Callout.

There are some java libraries that can do do JSON /SOAP/XSD validation. You can write a java callout policy to validate your JSON/XML .

View solution in original post

adas
New Member

The policy validates the json is well formed and the various configurations in the policy allow you to check for Element count, Object count etc. but unfortunately it doesn't allow you to validate the json against a schema. You can do that using a java or javascript callout but I agree it would be a good feature to add. I might already have a feature request logged for it.

View solution in original post

17 REPLIES 17