Hi,
Our need is to validate the JSON request payload before forwarding the request to the back end servers
The below does link provide the steps on using the OpenAPI Spec to validate JSON requests for draft#4
https://community.apigee.com/articles/42993/using-the-openapi-spec-to-validate-json-requests.html.
Can we use other JSON Schema validators like (djv, Ajv etc) for validating Json payloads ?
if so, please let us know the steps to implement the same.
Thanks,
Raju
Yes you can use other validators.
But you'll need to assemble such a solution, yourself.
Hi @Ram Kalidindi,
The article you sited works for TV4 and uses tv4-min.js.
I tried the same approach for ajv and djv, but they do not work with the JavaScript that Edge uses, at least not without modification. Edge uses Rhino JavaScript engine 1.7.7.1
An alternate approach is to use a "hybrid" proxy with 2 targets, one for the real backend and one that uses Node.js to perform the validation. I've tested this for ajv.
The flow is:
Another alternative would be to use a Java Callout which may have better performance.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |