title: Validate OpenAPI response in java
body: <p>I am working on my OpenAPI 3.x testing in Java and I would like test and validate my response from server.</p>
  <p>So far I found that there is a library Rest Assured I can use for API testing. I manage to test and validate my simple response e.g. GET status using JUnit tests.</p>
  <p>I send a GET request and check the status code and content type etc...
  But what I would like as well is to check if the response from server hast correct answer and data type. Given my OpenAPI specification in .yml for example:</p>
  <pre><code>    &quot;class_name&quot;: &quot;8A&quot;,
      &quot;count&quot;: 4,
      &quot;students_in_class&quot;: [
          {
              &quot;id&quot;: &quot;s0001&quot;,
  
              &quot;first_name&quot;: &quot;Jack&quot;,
              &quot;last_name&quot;: &quot;London&quot;,
              &quot;gender&quot;: &quot;male&quot;,
              &quot;age&quot;: 10,
              &quot;marks&quot;: {
                  &quot;mathematics&quot;: 70,
                  &quot;science&quot;: 84
              }
          },
  </code></pre>
  <p>In the response body from server I would like to check for data type of my response, for example I want to see if the &quot;first_name&quot; is indeed String type and &quot;age&quot; is  Integer type.</p>
  <p>Is this possible with Rest Assured in Java or is there any other way to test OpenAPI in Java  because I want to connect tests for API Testing in Gitlab pipelines CD/CI so that I always check if my OpenAPI is good.</p>
  <p>I hope someone could answer me.</p>