HttpMessageNotWritableException: No converter for [...] with preset Content-Type 'null'] with OpenApi Spring generator
The spring generator discriminates against xml by default, see the documentation: https://openapi-generator.tech/docs/generators/spring under
Option | Description | Default
--------+---------------------------------------------------+---------
withXml | whether to include support for application/xml | false
| content type and include XML annotations in the |
| model (works with libraries that provide support |
| for JSON and XML) |
org.springframework.http.converter.HttpMessageNotWritableException No converter found for return value of type: class
I just encountered this issue today and spent several hours to figure out what the issue is. Almost all of the answers I've seen are either because of missing getters and setters, adding the fasterxml dependency into the pom. I already have getters and setters and the tutorial I was following did not require those pom changes.
mariotepro's solution is what got me past the issue. His solution is buried under the comments so I decided to put it here in the answer so people can easily see it in case they have the same scenario.
So yes, just to reiterate, going into my maven repo and deleting the fasterxml folder and re-running maven is what fixed the issue for me.
Related Topics
Jsonobject.Tostring: How Not to Escape Slashes
How to Set Environment Variable or System Property in Spring Tests
How to Send List of Long to Rest Controller Spring Boot
Error Starting Applicationcontext in Spring Boot App
Hibernate Error Executing Ddl Via Jdbc Statement
Java - How to Find Students With Their Highest Marks Writing a Method in a Student Class
How to Split a String, But Also Keep the Delimiters
Spring @Transaction Method Call by the Method Within the Same Class, Does Not Work
How to Exclude Property from Lombok Builder
How to Check If a Date Is After Today Java
Eclipse Problems View Not Showing Errors Anymore
Calculating the Sum of Number and Its Reverse in Java
How to Modify Log4J Jsonlayout Field Names
How to Replace Every N-Th Character X from an String
Alternative to Switch Case in Java
How to Set a Description and an Example in Swagger With Swagger Annotations