title: How to generate XSD file from OpenAPI 3.0 specification?
body: <p>I create XML API specification using OpenAPI 3.0 with additional xml metadata, as described in <a href="https://swagger.io/docs/specification/data-models/representing-xml/" rel="noreferrer">Swagger docs</a>. During development phase I would like to automatically test my endpoint's XML response against OpenAPI 3.0 specification.</p>
  
  <p>What is the best way to validate endpoint's XML response against OpenAPI 3.0 schema? By validation I mean:</p>
  
  <ul>
  <li>verification that each XML tag or tag's attribute is compliant with specs,</li>
  <li>all the elements required by specification are present,</li>
  <li>data is successfully validated against types declared in response content schema.</li>
  </ul>
  
  <p>I imagine that such a test could be done with following steps:</p>
  
  <ol>
  <li><p>During project build, generate XSD file from schema definition for each path in OpenAPI specification, if that path has specified <code>application/xml</code> content type and response schema is defined.</p></li>
  <li><p>In tests, fetch the response of specific endpoint and validate it against XSD file.</p></li>
  </ol>
  
  <p>Unfortunately it seems there are currently no tools that could generate XSD from OpenAPI specs to create above pipeline.</p>
  
  <p>How could you achieve this goal? Is it possible with some combination of OpenAPI/Swagger Tools? Are there any other reliable ways to validate XML response without creating XSD manually?</p>
  
  <p>The problem is not programming language specific.</p>