3.9. Camel REST DSL OpenApi Maven Plugin
The Camel REST DSL OpenApi Maven Plugin supports the following goals.
- camel-restdsl-openapi:generate - To generate consumer REST DSL RouteBuilder source code from OpenApi specification
- camel-restdsl-openapi:generate-with-dto - To generate consumer REST DSL RouteBuilder source code from OpenApi specification and with DTO model classes generated via the swagger-codegen-maven-plugin.
- camel-restdsl-openapi:generate-xml - To generate consumer REST DSL XML source code from OpenApi specification
- camel-restdsl-openapi:generate-xml-with-dto - To generate consumer REST DSL XML source code from OpenApi specification and with DTO model classes generated via the swagger-codegen-maven-plugin.
- camel-restdsl-openapi:generate-yaml - To generate consumer REST DSL YAML source code from OpenApi specification
- camel-restdsl-openapi:generate-yaml-with-dto - To generate consumer REST DSL YAML source code from OpenApi specification and with DTO model classes generated via the swagger-codegen-maven-plugin.
3.9.1. Adding plugin to Maven pom.xml 링크 복사링크가 클립보드에 복사되었습니다!
This plugin can be added to your Maven pom.xml file by adding it to the plugins section, for example in a Spring Boot application:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-restdsl-openapi-plugin</artifactId>
<version>{CamelCommunityVersion}</version>
</plugin>
</plugins>
</build>
The plugin can then be executed using its prefix camel-restdsl-openapi as shown below.
$mvn camel-restdsl-openapi:generate
3.9.2. camel-restdsl-openapi:generate 링크 복사링크가 클립보드에 복사되었습니다!
The goal of the Camel REST DSL OpenApi Maven Plugin is used to generate REST DSL RouteBuilder implementation source code from Maven.
3.9.2.1. Options 링크 복사링크가 클립보드에 복사되었습니다!
The plugin supports the following options which can be configured from the command line (use -D syntax), or defined in the pom.xml file in the configuration tag.
| Parameter | Default Value | Description |
|---|---|---|
|
|
|
Set to |
|
|
Used for including only the operation ids specified. Multiple ids can be separated by comma. Wildcards can be used, eg | |
|
|
|
URI of the OpenApi specification, supports filesystem paths, HTTP and classpath resources, by default |
|
| Adds authorization headers when fetching the OpenApi specification definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values. | |
|
|
from |
Name of the generated class, taken from the OpenApi specification title or set to |
|
|
from |
Name of the package for the generated class, taken from the OpenApi specification host value or |
|
|
|
Which indenting character(s) to use, by default four spaces, you can use |
|
|
|
Where to place the generated source file, by default |
|
|
Fully qualified class name of the class that implements | |
|
|
| The default to syntax for the to uri, which is to use the direct component. |
|
|
| Whether to include generation of the rest configuration with detected rest component to be used. |
|
|
Define openapi endpoint path if | |
|
|
| Whether to enable request validation. |
|
| Overrides the api base path as defined in the OpenAPI specification. | |
|
|
| Allows generation of custom RequestMapping mapping values. Multiple mapping values can be passed as:
|
3.9.3. Spring Boot Project with Servlet component 링크 복사링크가 클립보드에 복사되었습니다!
If the Maven project is a Spring Boot project and restConfiguration is enabled and the servlet component is being used as REST component, then this plugin will autodetect the package name (if packageName has not been explicitly configured) where the @SpringBootApplication main class is located, and use the same package name for generating Rest DSL source code and a needed CamelRestController support class.
3.9.4. camel-restdsl-openapi:generate-with-dto 링크 복사링크가 클립보드에 복사되었습니다!
Works as generate goal but also generates DTO model classes by automatic executing the swagger-codegen-maven-plugin to generate java source code of the DTO model classes from the OpenApi specification.
This plugin has been scoped and limited to only support a good effort set of defaults for using the swagger-codegen-maven-plugin to generate the model DTOs. If you need more power and flexibility then use the Swagger Codegen Maven Plugin directly to generate the DTO and not this plugin.
The DTO classes may require additional dependencies such as:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.6.8</version>
</dependency>
3.9.4.1. Options 링크 복사링크가 클립보드에 복사되었습니다!
The plugin supports the following additional options
| Parameter | Default Value | Description |
|---|---|---|
|
| 3.0.36 |
The version of the |
|
| Target output path (default is ${project.build.directory}/generated-sources/openapi) | |
|
|
| The package to use for generated model objects/classes |
|
| Sets the pre- or suffix for model classes and enums | |
|
| Sets the pre- or suffix for model classes and enums | |
|
| false | Enable XML annotations inside the generated models (only works with libraries that provide support for JSON and XML) |
|
|
Pass a map of language-specific parameters to |
3.9.5. camel-restdsl-openapi:generate-xml 링크 복사링크가 클립보드에 복사되었습니다!
The camel-restdsl-openapi:generate-xml goal of the Camel REST DSL OpenApi Maven Plugin is used to generate REST DSL XML implementation source code from Maven.
3.9.5.1. Options 링크 복사링크가 클립보드에 복사되었습니다!
The plugin supports the following options which can be configured from the command line (use -D syntax), or defined in the pom.xml file in the <configuration> tag.
| Parameter | Default Value | Description |
|---|---|---|
|
|
|
Set to |
|
|
Used for including only the operation ids specified. Multiple ids can be separated by comma. Wildcards can be used, eg | |
|
|
|
URI of the OpenApi specification, supports filesystem paths, HTTP and classpath resources, by default |
|
| Adds authorization headers when fetching the OpenApi specification definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values. | |
|
|
|
Where to place the generated source file, by default |
|
|
| The name of the XML file as output. |
|
|
| If enabled generates OSGi Blueprint XML instead of Spring XML. |
|
|
Fully qualified class name of the class that implements | |
|
|
| The default to syntax for the to uri, which is to use the direct component. |
|
|
| |
| Whether to include generation of the rest configuration with detected rest component to be used. |
| |
|
Define openapi endpoint path if |
|
|
| Whether to enable request validation. |
| |
| Overrides the api base path as defined in the OpenAPI specification. |
|
|
3.9.6. camel-restdsl-openapi:generate-xml-with-dto 링크 복사링크가 클립보드에 복사되었습니다!
Works as generate-xml goal but also generates DTO model classes by automatic executing the swagger-codegen-maven-plugin to generate java source code of the DTO model classes from the OpenApi specification.
This plugin has been scoped and limited to only support a good effort set of defaults for using the swagger-codegen-maven-plugin to generate the model DTOs. If you need more power and flexibility then use the Swagger Codegen Maven Plugin directly to generate the DTO and not this plugin.
The DTO classes may require additional dependencies such as:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.6.8</version>
</dependency>
3.9.6.1. Options 링크 복사링크가 클립보드에 복사되었습니다!
The plugin supports the following additional options
| Parameter | Default Value | Description |
|---|---|---|
|
| 3.0.36 |
The version of the |
|
| Target output path (default is ${project.build.directory}/generated-sources/openapi) | |
|
|
| The package to use for generated model objects/classes |
|
| Sets the pre- or suffix for model classes and enums | |
|
| Sets the pre- or suffix for model classes and enums | |
|
| false | Enable XML annotations inside the generated models (only works with libraries that provide support for JSON and XML) |
|
|
Pass a map of language-specific parameters to |
3.9.7. camel-restdsl-openapi:generate-yaml 링크 복사링크가 클립보드에 복사되었습니다!
The camel-restdsl-openapi:generate-yaml goal of the Camel REST DSL OpenApi Maven Plugin is used to generate REST DSL YAML implementation source code from Maven.
3.9.7.1. Options 링크 복사링크가 클립보드에 복사되었습니다!
The plugin supports the following options which can be configured from the command line (use -D syntax), or defined in the pom.xml file in the <configuration> tag.
| Parameter | Default Value | Description |
|---|---|---|
|
|
|
Set to |
|
|
Used for including only the operation ids specified. Multiple ids can be separated by comma. Wildcards can be used, eg | |
|
|
|
URI of the OpenApi specification, supports filesystem paths, HTTP and classpath resources, by default |
|
| Adds authorization headers when fetching the OpenApi specification definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values. | |
|
|
|
Where to place the generated source file, by default |
|
|
| The name of the XML file as output. |
|
|
Fully qualified class name of the class that implements | |
|
|
| The default to syntax for the to uri, which is to use the direct component. |
|
|
| |
| Whether to include generation of the rest configuration with detected rest component to be used. |
| |
|
Define openapi endpoint path if |
|
|
| Whether to enable request validation. |
| |
| Overrides the api base path as defined in the OpenAPI specification. |
|
|
3.9.8. camel-restdsl-openapi:generate-yaml-with-dto 링크 복사링크가 클립보드에 복사되었습니다!
Works as generate-yaml goal but also generates DTO model classes by automatic executing the swagger-codegen-maven-plugin to generate java source code of the DTO model classes from the OpenApi specification.
This plugin has been scoped and limited to only support a good effort set of defaults for using the swagger-codegen-maven-plugin to generate the model DTOs. If you need more power and flexibility then use the Swagger Codegen Maven Plugin directly to generate the DTO and not this plugin.
The DTO classes may require additional dependencies such as:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.6.8</version>
</dependency>
3.9.8.1. Options 링크 복사링크가 클립보드에 복사되었습니다!
The plugin supports the following additional options
| Parameter | Default Value | Description |
|---|---|---|
|
| 3.0.36 |
The version of the |
|
| Target output path (default is ${project.build.directory}/generated-sources/openapi) | |
|
|
| The package to use for generated model objects/classes |
|
| Sets the pre- or suffix for model classes and enums | |
|
| Sets the pre- or suffix for model classes and enums | |
|
| false | Enable XML annotations inside the generated models (only works with libraries that provide support for JSON and XML) |
|
|
Pass a map of language-specific parameters to |