How to make openapi-generator generate model for importMappings anyway?

1.2k Views Asked by At

I know that importMappings prevents openapi's codegen from creating the corresponding model (see below) but I want it to be created anyway. Is there a way to do so? (I am using the maven plugin.)

Sometimes you don't want a model generated. In this case, you can simply specify an import mapping to tell the codegen what not to create. (docs)

In the end, what I want to do is using a custom Converter to convert type A to B and register it with Spring Boot. But, of course, for that purpose I need the generated API and everything behind it to use B. That is why I wanted to replace A with B by using the importMappings option. But I still need A to be created so the Converter can start from there (converting AB) because otherwise I would need to parse the JSON string (yikes).

So, if you have a better idea to combine the Converter with openapi's codegen I am also excited to hear about that.

0

There are 0 best solutions below