Validate oas spec 2.0 and 3.0

vdhulipala
Participant I

oas20postman-collectionjson.zipswagger-petstore-oas2-rev1-2020-10-19.zipoas20postman-collectionjson.zipsf-oasvalildation-rev1-2020-10-19.zip

How to validate open spec 2.0 and 3.0 versions using javascript policy?

I saw an article https://community.apigee.com/articles/42993/using-the-openapi-spec-to-validate-json-requests.html

Kurt Googler Kanaskie Could you please let me know how to validate OAS 3.0 spec

Solved Solved
0 3 458
1 ACCEPTED SOLUTION

Hi @Vijaya Krishna,

I provided an updated solution that supports OAS 2 and 3 request validation, plus it validates required headers and query params. See: https://community.apigee.com/articles/88441/validate-json-requests-using-openapi-spec-20-or-30.html

One of the differences between OAS 2 and 3 is how the request body schema is represented. Its now located in "requestBody.content['application/json'].schema" vs parameters[in==body].

View solution in original post

3 REPLIES 3

Hi, @Vijaya Krishna,

I've not done that yet, merely using an OAS 3.0 spec doesn't work.

Hi Kurt, Why do you say OAS 3.0 doesn't work? Can it be made to work? Many thanks

Hi @Vijaya Krishna,

I provided an updated solution that supports OAS 2 and 3 request validation, plus it validates required headers and query params. See: https://community.apigee.com/articles/88441/validate-json-requests-using-openapi-spec-20-or-30.html

One of the differences between OAS 2 and 3 is how the request body schema is represented. Its now located in "requestBody.content['application/json'].schema" vs parameters[in==body].