title: HttpMessageNotWritableException: No converter for [...] with preset Content-Type 'null'] with OpenApi Spring generator
body: <p>I am implementing the petstore API with openAPI in a (gradle) spring boot project. I generate a server with the openapi generator plugin and implement a simple request:</p>
  <pre><code>@Service
  @RestController
  public class PetApiController implements PetApi {
  
      @Override
      public ResponseEntity&lt;Pet&gt; getPetById(Long petId) {
          Pet p = new Pet();
          p.setId(0L);
          p.setName(&quot;fido&quot;);
          p.setPhotoUrls(new ArrayList&lt;String&gt;());
          p.setStatus(StatusEnum.AVAILABLE);
          p.setTags(new ArrayList&lt;Tag&gt;());
          Category c = new Category();
          c.setId(3L);
          c.setName(&quot;dummy category&quot;);
          p.setCategory(c);
          
          ResponseEntity&lt;Pet&gt; r = new ResponseEntity&lt;Pet&gt;(p, HttpStatus.OK);
          
          return r;
      }
  }
  </code></pre>
  <p>The swagger-ui that I generate offers both xml and json queries for a request, but xml doesn't seem to work:</p>
  <pre><code>$ curl -X GET &quot;http://localhost:8080/pet/1&quot; -H  &quot;accept: application/xml&quot;; echo &quot;&quot;
  
  $ curl -X GET &quot;http://localhost:8080/pet/1&quot; -H  &quot;accept: application/json&quot;; echo &quot;&quot;
  {&quot;id&quot;:0,&quot;name&quot;:&quot;fido&quot;,&quot;category&quot;:{&quot;id&quot;:3,&quot;name&quot;:&quot;dummy category&quot;},&quot;photoUrls&quot;:[],&quot;tags&quot;:[],&quot;status&quot;:&quot;available&quot;}
  </code></pre>
  <p>I even get an error message:</p>
  <pre><code>2020-09-10 09:04:34.213  WARN 23958 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class com.petstore.server.model.Pet] with preset Content-Type 'null']
  </code></pre>
  <p>However I cannot catch this exception and print the whole context, it only happens after <code>return r</code></p>
  <p>There is already a question with my exact error message:
  <a href="https://stackoverflow.com/q/60502811/3014199">Springboot HttpMessageNotWritableException: No converter for [...] with preset Content-Type &#39;null&#39;]</a> But I still think my context is different since I generate my POJOs so I have no controll over them and I shouldn't have this problem in the first place since the plugin should generate everything fittingly.</p>