This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch yv
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c3b4cbe2d400c9b5bf6567246fd698e7f9db7478
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Feb 11 13:11:27 2026 +0100

    CAMEL-22931: Maven Plugin for YAML DSL validator
---
 docs/components/modules/others/nav.adoc            |   1 +
 .../camel-yaml-dsl-validator-maven-plugin.adoc     |   1 +
 docs/pom.xml                                       |   3 +
 docs/user-manual/modules/ROOT/nav.adoc             |  11 +-
 .../camel-yaml-dsl-validator-maven-plugin.adoc     | 119 +++++++++++++++++++++
 5 files changed, 130 insertions(+), 5 deletions(-)

diff --git a/docs/components/modules/others/nav.adoc 
b/docs/components/modules/others/nav.adoc
index 5ccb0459539f..138e6ddf9ef3 100644
--- a/docs/components/modules/others/nav.adoc
+++ b/docs/components/modules/others/nav.adoc
@@ -5,6 +5,7 @@
 ** xref:attachments.adoc[Attachments]
 *** xref:aws-xray.adoc[AWS XRay]
 *** xref:azure-schema-registry.adoc[Azure Schema Registry]
+** xref:camel-yaml-dsl-validator-maven-plugin.adoc[Camel YAML DSL Validator 
Maven Plugin]
 ** xref:cli-connector.adoc[CLI Connector]
 ** xref:cli-debug.adoc[CLI Debug]
 ** xref:cloudevents.adoc[Cloudevents]
diff --git 
a/docs/components/modules/others/pages/camel-yaml-dsl-validator-maven-plugin.adoc
 
b/docs/components/modules/others/pages/camel-yaml-dsl-validator-maven-plugin.adoc
new file mode 120000
index 000000000000..1ab0b4936762
--- /dev/null
+++ 
b/docs/components/modules/others/pages/camel-yaml-dsl-validator-maven-plugin.adoc
@@ -0,0 +1 @@
+../../../../../dsl/camel-yaml-dsl/camel-yaml-dsl-validator-maven-plugin/src/main/docs/camel-yaml-dsl-validator-maven-plugin.adoc
\ No newline at end of file
diff --git a/docs/pom.xml b/docs/pom.xml
index 55b34dcc8b91..c50fc522a7d4 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -123,6 +123,9 @@
                                         <resource>
                                             
<directory>../catalog/camel-report-maven-plugin/src/main/docs</directory>
                                         </resource>
+                                        <resource>
+                                            
<directory>../dsl/camel-yaml-dsl/camel-yaml-dsl-validator-maven-plugin/src/main/docs</directory>
+                                        </resource>
                                     </resources>
                                 </configuration>
                             </execution>
diff --git a/docs/user-manual/modules/ROOT/nav.adoc 
b/docs/user-manual/modules/ROOT/nav.adoc
index eb09a11eadaa..62a471a755e0 100644
--- a/docs/user-manual/modules/ROOT/nav.adoc
+++ b/docs/user-manual/modules/ROOT/nav.adoc
@@ -8,13 +8,14 @@
 ** xref:camel-jbang.adoc[Camel JBang]
 *** xref:jbang-commands/camel-jbang-commands.adoc[Camel JBang Command 
Reference]
 *** xref:camel-jbang-launcher.adoc[Camel JBang Launcher]
-*** xref:camel-jbang-kubernetes.adoc[Camel JBang Kubernetes plugin]
-*** xref:camel-jbang-test.adoc[Camel JBang Testing plugin]
+*** xref:camel-jbang-kubernetes.adoc[Camel JBang Kubernetes Plugin]
+*** xref:camel-jbang-test.adoc[Camel JBang Testing Plugin]
 *** xref:camel-jbang-mcp.adoc[Camel MCP Server]
 ** xref:camel-maven-plugin.adoc[Camel Maven Plugin]
-** xref:camel-component-maven-plugin.adoc[Camel Component Maven Plugin]
-** xref:camel-report-maven-plugin.adoc[Camel Maven Report Plugin]
-** xref:camel-maven-archetypes.adoc[Camel Maven Archetypes]
+*** xref:camel-component-maven-plugin.adoc[Camel Component Maven Plugin]
+*** xref:camel-report-maven-plugin.adoc[Camel Maven Report Plugin]
+*** xref:camel-yaml-dsl-validator-maven-plugin.adoc[Camel Maven YAML DSL 
Validator Plugin]
+*** xref:camel-maven-archetypes.adoc[Camel Maven Archetypes]
 ** xref:configuring-route-startup-ordering-and-autostartup.adoc[Configuring 
route startup ordering and autostartup]
 ** xref:component-dsl.adoc[Component DSL]
 ** xref:Endpoint-dsl.adoc[Endpoint DSL]
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-yaml-dsl-validator-maven-plugin.adoc
 
b/docs/user-manual/modules/ROOT/pages/camel-yaml-dsl-validator-maven-plugin.adoc
new file mode 100644
index 000000000000..99678fafadfd
--- /dev/null
+++ 
b/docs/user-manual/modules/ROOT/pages/camel-yaml-dsl-validator-maven-plugin.adoc
@@ -0,0 +1,119 @@
+= Camel YAML DSL Validator Maven Plugin
+
+The Camel YAML DSL Validator Maven Plugin supports the following goals
+
+ - camel-yaml-dsl-validator:validate - To validate YAML routes are correct 
according to spec
+
+== camel-yaml-dsl-validator:validate
+
+For validating the YAML routes for syntax errors according to the spec.
+
+Then you can run the `validate` goal from the command line or from within your 
Java editor such as IDEA or Eclipse.
+
+[source,bash]
+----
+mvn camel-yaml-dsl-validator:validate
+----
+
+You can also enable the plugin to run automatically as part of the build to 
catch these errors.
+
+[source,xml]
+----
+<plugin>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-yaml-dsl-validate-maven-plugin</artifactId>
+  <executions>
+    <execution>
+      <phase>process-classes</phase>
+      <goals>
+        <goal>validate</goal>
+      </goals>
+    </execution>
+  </executions>
+</plugin>
+----
+
+The phase determines when the plugin runs. In the sample above the phase is 
`process-classes` which runs after
+the compilation of the main source code.
+
+The maven plugin can also be configured to validate the test source code, 
which means that the phase should be
+changed accordingly to `process-test-classes` as shown below:
+
+[source,xml]
+----
+<plugin>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-yaml-dsl-validate-maven-plugin</artifactId>
+  <executions>
+    <execution>
+      <configuration>
+        <includeTest>true</includeTest>
+      </configuration>
+      <phase>process-test-classes</phase>
+      <goals>
+        <goal>validate</goal>
+      </goals>
+    </execution>
+  </executions>
+</plugin>
+----
+
+=== Running the goal on any Maven project
+
+You can also run the validate goal on any Maven project without having to add 
the plugin to the `pom.xml` file.
+Doing so requires to specify the plugin using its fully qualified name. For 
example to run the goal on
+the `main-yaml` from Apache Camel you can run
+
+[source,bash]
+----
+$cd main-yaml
+$mvn org.apache.camel:camel-yaml-dsl-validator-maven-plugin:4.18.0:validate
+----
+
+Which for example outputs (with a forced error)
+[source,text]
+----
+[INFO] --- camel-yaml-dsl-validator:4.18.0:validate (default-cli) @ 
camel-example-main-yaml ---
+[INFO] Found 
[/Users/davsclaus/workspace/camel-examples/main-yaml/src/main/resources/routes/my-route.camel.yaml]
 YAML files ...
+[INFO] Validating 1 YAML files ...
+[WARNING]
+
+Validation error detected in 1 files
+
+       File: my-route.camel.yaml
+               /0/route/from: property 'step' is not defined in the schema and 
the schema does not allow additional properties
+               /0/route/from: required property 'steps' not found
+----
+
+=== Options
+
+The maven plugin *validate* goal 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
+| skip | false | Skip the validation execution.
+| failOnError | false | Whether to fail if invalid Camel endpoints was found. 
By default the plugin logs the errors at WARN level.
+| includeTest | false | Whether to include test source code.
+| includes | | To filter the names of YAML files to only include files 
matching any of the given list of patterns (wildcard and regular expression). 
Multiple values can be separated by comma.
+| excludes | | To filter the names of YAML files to exclude files matching any 
of the given list of patterns (wildcard and regular expression). Multiple 
values can be separated by comma.
+| onlyCamelYamlExt | false | Whether to only accept files with xxx.camel.yaml 
as file name. By default, all .yaml files are accepted.
+|===
+
+For example to excludes a specific file:
+
+[source,bash]
+----
+$mvn camel-yaml-dsl-validator:validate -Dcamel.excludes=cheese.yaml
+----
+
+Notice that you must prefix the `-D` command argument with `camel.`, eg 
`camel.excludes` as the option name.
+
+=== Validating include test
+
+If you have a Maven project then you can run the plugin to validate the 
endpoints in the unit test source code as well.
+You can pass in the options using `-D` style as shown:
+
+----
+$cd myproject
+$mvn org.apache.camel:camel-yaml-dsl-validator:4.18.0:validate 
-Dcamel.includeTest=true
+----

Reply via email to