This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new fe54dcc CAMEL-15023 camel-restdsl-openapi-plugin: pass configOptions to swagger-codegen-maven-plugin (#3808) fe54dcc is described below commit fe54dcccc6595e8d3412d10096ce9f447ed6f3de Author: Alexey Markevich <buhhu...@gmail.com> AuthorDate: Thu May 7 07:42:52 2020 +0300 CAMEL-15023 camel-restdsl-openapi-plugin: pass configOptions to swagger-codegen-maven-plugin (#3808) * camel-restdsl-openapi-plugin: pass configOptions to swagger-codegen-maven-plugin * extend doc --- .../src/main/docs/camel-restdsl-openapi-plugin.adoc | 2 ++ .../camel/maven/generator/openapi/AbstractGenerateMojo.java | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/main/docs/camel-restdsl-openapi-plugin.adoc b/tooling/maven/camel-restdsl-openapi-plugin/src/main/docs/camel-restdsl-openapi-plugin.adoc index b8b869e..943fef0 100644 --- a/tooling/maven/camel-restdsl-openapi-plugin/src/main/docs/camel-restdsl-openapi-plugin.adoc +++ b/tooling/maven/camel-restdsl-openapi-plugin/src/main/docs/camel-restdsl-openapi-plugin.adoc @@ -115,6 +115,7 @@ The plugin supports the following *additional* options | `modelNamePrefix` | | Sets the pre- or suffix for model classes and enums | `modelNameSuffix` | | Sets the pre- or suffix for model classes and enums | `modelWithXml` | true | Enable XML annotations inside the generated models (only works with ibraries that provide support for JSON and XML) +| `configOptions` | | Pass a map of language-specific parameters to `swagger-codegen-maven-plugin` |======================================== @@ -181,5 +182,6 @@ The plugin supports the following *additional* options | `modelNamePrefix` | | Sets the pre- or suffix for model classes and enums | `modelNameSuffix` | | Sets the pre- or suffix for model classes and enums | `modelWithXml` | true | Enable XML annotations inside the generated models (only works with ibraries that provide support for JSON and XML) +| `configOptions` | | Pass a map of language-specific parameters to `swagger-codegen-maven-plugin` |======================================== diff --git a/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java b/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java index af38bfd..21dc061 100644 --- a/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java +++ b/tooling/maven/camel-restdsl-openapi-plugin/src/main/java/org/apache/camel/maven/generator/openapi/AbstractGenerateMojo.java @@ -31,12 +31,9 @@ import java.util.Optional; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.BaseJsonNode; import io.apicurio.datamodels.Library; import io.apicurio.datamodels.openapi.models.OasDocument; import org.apache.camel.generator.openapi.DestinationGenerator; -import org.apache.camel.model.dataformat.YAMLLibrary; import org.apache.camel.util.IOHelper; import org.apache.camel.util.ObjectHelper; import org.apache.maven.execution.MavenSession; @@ -114,6 +111,9 @@ abstract class AbstractGenerateMojo extends AbstractMojo { @Component private BuildPluginManager pluginManager; + @Parameter + private Map<String, String> configOptions; + DestinationGenerator createDestinationGenerator() throws MojoExecutionException { final Class<DestinationGenerator> destinationGeneratorClass; @@ -184,6 +184,10 @@ abstract class AbstractGenerateMojo extends AbstractMojo { if (modelWithXml != null) { elements.add(new MojoExecutor.Element("withXml", modelPackage)); } + if (configOptions != null) { + elements.add(new MojoExecutor.Element("configOptions", configOptions.entrySet().stream() + .map(e -> new MojoExecutor.Element(e.getKey(), e.getValue())).toArray(MojoExecutor.Element[]::new))); + } executeMojo( plugin(