Search code examples
javamapstructopenapi-generator

Erroneous element error with mapstruct and OpenAPI


While trying to convert the java model generated by openapi-generator with MapStruct getting the following exception

error: No implementation was created for EmployeeMapper due to having a problem in the erroneous element org.openapitools.jackson.nullable.JsonNullable. Hint: this often means that some other annotation processor was supposed to process the erroneous element. You can also enable MapStruct verbose mode by setting -Amapstruct.verbose=true as a compilation argument.


Solution

  • The problem was the generated java files having the unused import

    org.openapitools.jackson.nullable.JsonNullable 
    

    So while generating the code using openapi-generator passed the following config to ignore the JsonNullable import.

    "openApiNullable": false