# Generate a test to validate response from OpenAPI3 schema?

**URL:** <https://community.postman.com/t/generate-a-test-to-validate-response-from-openapi3-schema/8409>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [October 16, 2019, 9:28pm UTC](https://community.postman.com/t/generate-a-test-to-validate-response-from-openapi3-schema/8409 "2019-10-16T21:28:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amy](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@amy](https://community.postman.com/u/amy)\
**Post date:** [October 16, 2019, 9:28pm UTC](https://community.postman.com/t/generate-a-test-to-validate-response-from-openapi3-schema/8409/1 "2019-10-16T21:28:52Z")

</div>

Is it possible to generate a test to validate the response from an OpenAPI3 schema? The closest I have been able to find is to convert the OAI schema to JSONSchema and manually write a test using ajv to validate. I was hoping there might be a solution that is more auto generated and that uses the OAI schema as imported. Thanks.

---

<div class="post-metadata">

**Author:** ![Moon](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@Moon](https://community.postman.com/u/Moon)\
**Post date:** [May 19, 2020, 3:06pm UTC](https://community.postman.com/t/generate-a-test-to-validate-response-from-openapi3-schema/8409/2 "2020-05-19T15:06:41Z")

</div>

Hi @amy  
I have the same issue. Did you find out a solution? Which library are you using to convert from OAS to Json Schema?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![umckib2](https://avatars.discourse-cdn.com/v4/letter/u/e47c2d/32.png) [@umckib2](https://community.postman.com/u/umckib2)\
**Post date:** [October 17, 2020, 5:28pm UTC](https://community.postman.com/t/generate-a-test-to-validate-response-from-openapi3-schema/8409/3 "2020-10-17T17:28:33Z")

</div>

openapi2jsonschema is one tools you can use.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [October 19, 2020, 11:27am UTC](https://community.postman.com/t/generate-a-test-to-validate-response-from-openapi3-schema/8409/4 "2020-10-19T11:27:02Z")

</div>

I actually [wrote a blog post](https://www.readysetcloud.io/blog/allen.helton/dynamic-test-generation-with-oas/) on this exact topic recently. Hopefully you can adapt it to your use case.
