I am trying to figure out if openapi-generator-maven-plugin supports customization like the original generator that allows use defined templates like:
templateDir: my_custom_templates
additionalProperties:
artifactId: kotlin-petstore-client
serializableModel: "true"
dateLibrary: java8
files:
AUTHORS.md: {}
api_interfaces.mustache:
templateType: API
destinationFilename: Interface.kt
api.mustache:
templateType: API
destinationFilename: Impl.kt
other/check.mustache:
folder: scripts
destinationFilename: check.sh
templateType: SupportingFiles
Does anyone know how to reprocess api model with another mustache again?
I am trying to figure out if openapi-generator-maven-plugin supports customization like the original generator that allows use defined templates like:
templateDir: my_custom_templates
additionalProperties:
artifactId: kotlin-petstore-client
serializableModel: "true"
dateLibrary: java8
files:
AUTHORS.md: {}
api_interfaces.mustache:
templateType: API
destinationFilename: Interface.kt
api.mustache:
templateType: API
destinationFilename: Impl.kt
other/check.mustache:
folder: scripts
destinationFilename: check.sh
templateType: SupportingFiles
Does anyone know how to reprocess api model with another mustache again?
Share Improve this question asked Feb 6 at 15:59 Patryk ImosaPatryk Imosa 8142 gold badges11 silver badges32 bronze badges1 Answer
Reset to default 1I found the solution by myself. The documentation lacks information that this "files" could be put on configurationFile in json format:
{
"basePackage": "mypackage",
"apiPackage": "mypackage",
"configPackage": "mypackage.config",
"modelPackage": "mypackage.model",
"files": {
"myheaders.mustache": {
"templateType": "SupportingFiles",
"folder": "src/gen/java/mypackage",
"destinationFilename": "ServiceYamlHeaders.java"
}
}
}
So you have to specify the path to this config file in the plugin
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi.codegen.maven.plugin.version}</version>
<executions>
<execution>
<id>service</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>myyaml.yaml</inputSpec>
<configurationFile>packageBoot-service.json</configurationFile>
Anyway I still struggle how to access all headers parameters only without looping through operations and apis...