javawindowsopenapiopenapi-generatoropenapi-generator-maven-plugin

openapi-generator-maven-plugin not finding mustache template on Windows


I'm using the openapi-generator-maven-plugin Version 6.6.0 on a Windows machine and want to generate server stubs with the jaxrs-jersey or jaxrs-spec generator from an openapi 3.0.3 yaml definiton. In my understanding I must modify some mustache templates to be able to inject some delegator classes with my business logic into the generated stubs. So I put the api.mustache file into src/main/resources/templates/ but it is simply ignored by the generator. I suspect some issue with path resolving, debug output gets me:

"inputSpec" : "C:\\workspace\\path\\project\\submodule/src/main/resources/api.yaml",

"templateDir" : "C:\\workspace\\path\\project\\submodule\\src\\main\\resources\\templates",

For the path definitions in the pom.xml plugin config I have tried with the same result:

<templateDirectory>${project.basedir}/src/main/resources/templates</templateDirectory>
                                                                                              

<templateResourcePath>${project.basedir}/src/main/resources/templates</templateResourcePath>

Note that the api.yaml input spec is found by the generator and that the file separators differ. Any idea how I can get the generator to pick up the templates?


Solution

  • Ok this is kind of embarrassing, it was a typo. I somehow named the template file api.moustache instead of api.mustache. After correcting the typo the template is picked up.