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

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new cad57ff6a7 Fixes #6169. Add OpenAPI Validator extension
cad57ff6a7 is described below

commit cad57ff6a7728fe9b6bbe412fe564aa82b2ce719
Author: Jomin Mathew <[email protected]>
AuthorDate: Tue Jul 21 09:58:53 2026 +0100

    Fixes #6169. Add OpenAPI Validator extension
    
    Add a Camel Quarkus extension for the camel-openapi-validator component,
    providing native image support for JSON Schema validation of REST API
    requests against OpenAPI specifications.
    
    The extension registers reflective classes for keyword validators,
    native image resources for JSON Schema draft directories, and
    runtime-initialized classes required by the underlying Atlassian
    swagger-request-validator library.
    
    The integration test uses the REST DSL consumer with
    clientRequestValidation enabled to exercise the full validation path,
    including JSON Schema keyword validation for required fields and type
    checking.
    
    Co-authored-by: jomin mathew <>
---
 catalog/pom.xml                                    |  13 ++
 .../ROOT/examples/others/openapi-validator.yml     |  13 ++
 docs/modules/ROOT/nav.adoc                         |   1 +
 .../reference/extensions/openapi-validator.adoc    |  58 +++++++++
 extensions/openapi-validator/deployment/pom.xml    |  63 ++++++++++
 .../deployment/OpenapiValidatorProcessor.java      | 111 ++++++++++++++++
 extensions/openapi-validator/pom.xml               |  39 ++++++
 extensions/openapi-validator/runtime/pom.xml       | 107 ++++++++++++++++
 .../runtime/src/main/doc/usage.adoc                |   8 ++
 .../main/resources/META-INF/quarkus-extension.yaml |  36 ++++++
 extensions/pom.xml                                 |   1 +
 integration-tests/openapi-validator/pom.xml        | 140 +++++++++++++++++++++
 .../validator/it/OpenapiValidatorRoutes.java       |  31 +++++
 .../src/main/resources/application.properties      |  17 +++
 .../src/main/resources/openapi.json                |  60 +++++++++
 .../openapi/validator/it/OpenapiValidatorIT.java   |  24 ++++
 .../openapi/validator/it/OpenapiValidatorTest.java |  72 +++++++++++
 integration-tests/pom.xml                          |   1 +
 poms/bom/pom.xml                                   |  15 +++
 poms/bom/src/main/generated/flattened-full-pom.xml |  15 +++
 .../src/main/generated/flattened-reduced-pom.xml   |  15 +++
 .../generated/flattened-reduced-verbose-pom.xml    |  15 +++
 tooling/scripts/test-categories.yaml               |   1 +
 23 files changed, 856 insertions(+)

diff --git a/catalog/pom.xml b/catalog/pom.xml
index ae8718b537..51b8842e25 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -3165,6 +3165,19 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-openapi-validator</artifactId>
+            <version>${project.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-opensearch</artifactId>
diff --git a/docs/modules/ROOT/examples/others/openapi-validator.yml 
b/docs/modules/ROOT/examples/others/openapi-validator.yml
new file mode 100644
index 0000000000..b3f91fd39a
--- /dev/null
+++ b/docs/modules/ROOT/examples/others/openapi-validator.yml
@@ -0,0 +1,13 @@
+# Do not edit directly!
+# This file was generated by 
camel-quarkus-maven-plugin:update-extension-doc-page
+cqArtifactId: camel-quarkus-openapi-validator
+cqArtifactIdBase: openapi-validator
+cqNativeSupported: true
+cqStatus: Stable
+cqDeprecated: false
+cqJvmSince: 3.38.0
+cqNativeSince: 3.38.0
+cqCamelPartName: openapi-validator
+cqCamelPartTitle: Openapi Validator
+cqCamelPartDescription: OpenAPI validator for Camel Rest DSL
+cqExtensionPageTitle: OpenAPI Validator
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 36792ec1af..bb0ffd2c66 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -257,6 +257,7 @@
 *** xref:reference/extensions/once.adoc[Once]
 *** xref:reference/extensions/openai.adoc[OpenAI]
 *** xref:reference/extensions/openapi-java.adoc[OpenAPI Java]
+*** xref:reference/extensions/openapi-validator.adoc[OpenAPI Validator]
 *** xref:reference/extensions/opensearch.adoc[OpenSearch]
 *** xref:reference/extensions/openstack.adoc[OpenStack]
 *** xref:reference/extensions/opentelemetry.adoc[OpenTelemetry]
diff --git 
a/docs/modules/ROOT/pages/reference/extensions/openapi-validator.adoc 
b/docs/modules/ROOT/pages/reference/extensions/openapi-validator.adoc
new file mode 100644
index 0000000000..fdd4ee4131
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/openapi-validator.adoc
@@ -0,0 +1,58 @@
+// Do not edit directly!
+// This file was generated by 
camel-quarkus-maven-plugin:update-extension-doc-page
+[id="extensions-openapi-validator"]
+= OpenAPI Validator
+:linkattrs:
+:cq-artifact-id: camel-quarkus-openapi-validator
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
+:cq-description: OpenAPI validator for Camel Rest DSL
+:cq-deprecated: false
+:cq-jvm-since: 3.38.0
+:cq-native-since: 3.38.0
+
+ifeval::[{doc-show-badges} == true]
+[.badges]
+[.badge-key]##JVM since##[.badge-supported]##3.38.0## [.badge-key]##Native 
since##[.badge-supported]##3.38.0##
+endif::[]
+
+OpenAPI validator for Camel Rest DSL
+
+[id="extensions-openapi-validator-whats-inside"]
+== What's inside
+
+* xref:{cq-camel-components}:others:openapi-validator.adoc[Openapi Validator]
+
+Please refer to the above link for usage and configuration details.
+
+[id="extensions-openapi-validator-maven-coordinates"]
+== Maven coordinates
+
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-openapi-validator[Create
 a new project with this extension on {link-quarkus-code-generator}, 
window="_blank"]
+
+Or add the coordinates to your existing project:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-openapi-validator</artifactId>
+</dependency>
+----
+ifeval::[{doc-show-user-guide-link} == true]
+Check the xref:user-guide/index.adoc[User guide] for more information about 
writing Camel Quarkus applications.
+endif::[]
+
+[id="extensions-openapi-validator-usage"]
+== Usage
+[id="extensions-openapi-validator-usage-native-mode"]
+=== Native Mode
+
+When using a classpath-based OpenAPI specification in native mode, the file 
must be explicitly included in the native image. Add the following to your 
`application.properties`:
+
+[source,properties]
+----
+quarkus.native.resources.includes=openapi.json
+----
+
diff --git a/extensions/openapi-validator/deployment/pom.xml 
b/extensions/openapi-validator/deployment/pom.xml
new file mode 100644
index 0000000000..f40fbd5cf4
--- /dev/null
+++ b/extensions/openapi-validator/deployment/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator-parent</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-openapi-validator-deployment</artifactId>
+    <name>Camel Quarkus :: OpenAPI Validator :: Deployment</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-rest-openapi-deployment</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-openapi-validator</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            
<artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git 
a/extensions/openapi-validator/deployment/src/main/java/org/apache/camel/quarkus/component/openapi/validator/deployment/OpenapiValidatorProcessor.java
 
b/extensions/openapi-validator/deployment/src/main/java/org/apache/camel/quarkus/component/openapi/validator/deployment/OpenapiValidatorProcessor.java
new file mode 100644
index 0000000000..ffea36931a
--- /dev/null
+++ 
b/extensions/openapi-validator/deployment/src/main/java/org/apache/camel/quarkus/component/openapi/validator/deployment/OpenapiValidatorProcessor.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapi.validator.deployment;
+
+import com.atlassian.oai.validator.schema.SwaggerV20Library;
+import com.github.fge.jackson.JsonLoader;
+import com.github.fge.jackson.JsonNodeReader;
+import com.github.fge.jsonschema.core.messages.JsonSchemaCoreMessageBundle;
+import com.github.fge.jsonschema.core.messages.JsonSchemaSyntaxMessageBundle;
+import com.github.fge.jsonschema.core.util.RegexECMA262Helper;
+import com.github.fge.jsonschema.keyword.validator.AbstractKeywordValidator;
+import com.github.fge.jsonschema.messages.JsonSchemaConfigurationBundle;
+import com.github.fge.jsonschema.messages.JsonSchemaValidationBundle;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceDirectoryBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+
+class OpenapiValidatorProcessor {
+
+    private static final String FEATURE = "camel-openapi-validator";
+    private static final DotName ABSTRACT_KEYWORD_VALIDATOR = DotName
+            .createSimple(AbstractKeywordValidator.class.getName());
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void indexDependencies(BuildProducer<IndexDependencyBuildItem> 
indexDependency) {
+        indexDependency.produce(new 
IndexDependencyBuildItem("com.atlassian.oai", 
"swagger-request-validator-core"));
+        indexDependency.produce(new 
IndexDependencyBuildItem("com.github.java-json-tools", 
"json-schema-validator"));
+        indexDependency.produce(new 
IndexDependencyBuildItem("com.github.java-json-tools", "json-schema-core"));
+    }
+
+    @BuildStep
+    void registerReflectiveClasses(
+            CombinedIndexBuildItem combinedIndex,
+            BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+
+        // Keyword validators are instantiated via 
ReflectionKeywordValidatorFactory using Constructor.newInstance()
+        String[] keywordValidators = combinedIndex.getIndex()
+                .getAllKnownSubclasses(ABSTRACT_KEYWORD_VALIDATOR)
+                .stream()
+                .map(ClassInfo::name)
+                .map(DotName::toString)
+                .toArray(String[]::new);
+        
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(keywordValidators).constructors(true).build());
+
+        // Message bundles are instantiated via MessageBundles.getBundle() 
using Constructor.newInstance()
+        reflectiveClasses.produce(ReflectiveClassBuildItem.builder(
+                SwaggerV20Library.ValidationBundle.class.getName(),
+                SwaggerV20Library.SyntaxBundle.class.getName(),
+                JsonSchemaCoreMessageBundle.class.getName(),
+                JsonSchemaSyntaxMessageBundle.class.getName(),
+                JsonSchemaConfigurationBundle.class.getName(),
+                
JsonSchemaValidationBundle.class.getName()).constructors(true).build());
+    }
+
+    @BuildStep
+    void 
runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> 
runtimeInitializedClasses) {
+        runtimeInitializedClasses
+                .produce(new 
RuntimeInitializedClassBuildItem(JsonNodeReader.class.getName()));
+        runtimeInitializedClasses
+                .produce(new 
RuntimeInitializedClassBuildItem(JsonLoader.class.getName()));
+        runtimeInitializedClasses
+                .produce(new 
RuntimeInitializedClassBuildItem(RegexECMA262Helper.class.getName()));
+    }
+
+    @BuildStep
+    void registerNativeImageResources(
+            BuildProducer<NativeImageResourceBuildItem> nativeImageResources,
+            BuildProducer<NativeImageResourceDirectoryBuildItem> 
nativeImageResourceDirectories) {
+        nativeImageResources.produce(new NativeImageResourceBuildItem(
+                "swagger/validation/default-levels.properties",
+                "swagger/validation/schema-validation.properties",
+                "swagger/validation/messages.properties",
+                "com/github/fge/jsonschema/validator/validation.properties",
+                "com/github/fge/jsonschema/validator/configuration.properties",
+                "com/github/fge/jsonschema/core/core.properties",
+                "com/github/fge/jsonschema/core/syntax.properties",
+                "com/github/fge/jackson/jsonNodeReader.properties",
+                "com/github/fge/jackson/jsonpointer.properties",
+                "com/github/fge/uritemplate/messages.properties"));
+        // Register entire draft schema directories to capture all schema 
files (schema, hyper-schema, links, etc.)
+        nativeImageResourceDirectories.produce(new 
NativeImageResourceDirectoryBuildItem("draftv3"));
+        nativeImageResourceDirectories.produce(new 
NativeImageResourceDirectoryBuildItem("draftv4"));
+    }
+}
diff --git a/extensions/openapi-validator/pom.xml 
b/extensions/openapi-validator/pom.xml
new file mode 100644
index 0000000000..eda4a7cfb2
--- /dev/null
+++ b/extensions/openapi-validator/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-extensions</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-openapi-validator-parent</artifactId>
+    <name>Camel Quarkus :: OpenAPI Validator</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>deployment</module>
+        <module>runtime</module>
+    </modules>
+</project>
diff --git a/extensions/openapi-validator/runtime/pom.xml 
b/extensions/openapi-validator/runtime/pom.xml
new file mode 100644
index 0000000000..27b587a7ff
--- /dev/null
+++ b/extensions/openapi-validator/runtime/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator-parent</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-openapi-validator</artifactId>
+    <name>Camel Quarkus :: OpenAPI Validator :: Runtime</name>
+    <description>OpenAPI validator for Camel Rest DSL</description>
+
+    <properties>
+        <camel.quarkus.jvmSince>3.38.0</camel.quarkus.jvmSince>
+        <camel.quarkus.nativeSince>3.38.0</camel.quarkus.nativeSince>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-rest-openapi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-openapi-validator</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.google.code.findbugs</groupId>
+                    <artifactId>jsr305</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-extension-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            
<artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+
+    <profiles>
+        <profile>
+            <id>full</id>
+            <activation>
+                <property>
+                    <name>!quickly</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.camel.quarkus</groupId>
+                        <artifactId>camel-quarkus-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>update-extension-doc-page</id>
+                                <goals>
+                                    <goal>update-extension-doc-page</goal>
+                                </goals>
+                                <phase>process-classes</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
diff --git a/extensions/openapi-validator/runtime/src/main/doc/usage.adoc 
b/extensions/openapi-validator/runtime/src/main/doc/usage.adoc
new file mode 100644
index 0000000000..3fc6159175
--- /dev/null
+++ b/extensions/openapi-validator/runtime/src/main/doc/usage.adoc
@@ -0,0 +1,8 @@
+=== Native Mode
+
+When using a classpath-based OpenAPI specification in native mode, the file 
must be explicitly included in the native image. Add the following to your 
`application.properties`:
+
+[source,properties]
+----
+quarkus.native.resources.includes=openapi.json
+----
diff --git 
a/extensions/openapi-validator/runtime/src/main/resources/META-INF/quarkus-extension.yaml
 
b/extensions/openapi-validator/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000000..b2a5cc5d2b
--- /dev/null
+++ 
b/extensions/openapi-validator/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a generated file. Do not edit directly!
+# To re-generate, run the following command from the top level directory:
+#
+#   mvn -N cq:update-quarkus-metadata
+#
+---
+name: "Camel OpenAPI Validator"
+description: "OpenAPI validator for Camel Rest DSL"
+metadata:
+  icon-url: 
"https://raw.githubusercontent.com/apache/camel-website/main/antora-ui-camel/src/img/logo-d.svg";
+  sponsor: "Apache Software Foundation"
+  guide: 
"https://camel.apache.org/camel-quarkus/latest/reference/extensions/openapi-validator.html";
+  categories:
+  - "integration"
+  status: "stable"
+  integrates:
+    - name: "Camel"
+      artifact: "org.apache.camel:camel-base"
+      version: "${camel.version}"
\ No newline at end of file
diff --git a/extensions/pom.xml b/extensions/pom.xml
index e7a08fbff7..26e5d187d9 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -229,6 +229,7 @@
         <module>once</module>
         <module>openai</module>
         <module>openapi-java</module>
+        <module>openapi-validator</module>
         <module>openstack</module>
         <module>opentelemetry</module>
         <module>opentelemetry2</module>
diff --git a/integration-tests/openapi-validator/pom.xml 
b/integration-tests/openapi-validator/pom.xml
new file mode 100644
index 0000000000..7bcb83726d
--- /dev/null
+++ b/integration-tests/openapi-validator/pom.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-build-parent-it</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-integration-test-openapi-validator</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: OpenAPI Validator</name>
+    <description>Integration tests for Camel Quarkus OpenAPI Validator 
extension</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-openapi-validator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-platform-http</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <properties>
+                <quarkus.native.enabled>true</quarkus.native.enabled>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>virtualDependencies</id>
+            <activation>
+                <property>
+                    <name>!noVirtualDependencies</name>
+                </property>
+            </activation>
+            <dependencies>
+                <!-- The following dependencies guarantee that this module is 
built after them. You can update them by running `mvn process-resources 
-Pformat -N` from the source tree root directory -->
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-direct-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    
<artifactId>camel-quarkus-openapi-validator-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    
<artifactId>camel-quarkus-platform-http-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
+</project>
diff --git 
a/integration-tests/openapi-validator/src/main/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorRoutes.java
 
b/integration-tests/openapi-validator/src/main/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorRoutes.java
new file mode 100644
index 0000000000..3c9c883841
--- /dev/null
+++ 
b/integration-tests/openapi-validator/src/main/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorRoutes.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapi.validator.it;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class OpenapiValidatorRoutes extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        
rest().clientRequestValidation(true).openApi().specification("openapi.json");
+
+        // auto-wired by the REST DSL using the operationId from the OpenAPI 
spec
+        from("direct:addFruit")
+                .setBody(constant("Fruit created"));
+    }
+}
diff --git 
a/integration-tests/openapi-validator/src/main/resources/application.properties 
b/integration-tests/openapi-validator/src/main/resources/application.properties
new file mode 100644
index 0000000000..6671702ac4
--- /dev/null
+++ 
b/integration-tests/openapi-validator/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+quarkus.native.resources.includes = openapi.json
diff --git 
a/integration-tests/openapi-validator/src/main/resources/openapi.json 
b/integration-tests/openapi-validator/src/main/resources/openapi.json
new file mode 100644
index 0000000000..b425703184
--- /dev/null
+++ b/integration-tests/openapi-validator/src/main/resources/openapi.json
@@ -0,0 +1,60 @@
+{
+  "openapi": "3.0.3",
+  "info": {
+    "title": "Fruits API",
+    "version": "1.0.0"
+  },
+  "servers": [
+    {
+      "url": "/api"
+    }
+  ],
+  "paths": {
+    "/fruits": {
+      "post": {
+        "operationId": "addFruit",
+        "requestBody": {
+          "content": {
+            "application/json": {
+              "schema": {
+                "$ref": "#/components/schemas/Fruit"
+              }
+            }
+          },
+          "required": true
+        },
+        "responses": {
+          "200": {
+            "description": "OK",
+            "content": {
+              "text/plain": {
+                "schema": {
+                  "type": "string"
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  },
+  "components": {
+    "schemas": {
+      "Fruit": {
+        "type": "object",
+        "required": [
+          "name",
+          "description"
+        ],
+        "properties": {
+          "name": {
+            "type": "string"
+          },
+          "description": {
+            "type": "string"
+          }
+        }
+      }
+    }
+  }
+}
diff --git 
a/integration-tests/openapi-validator/src/test/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorIT.java
 
b/integration-tests/openapi-validator/src/test/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorIT.java
new file mode 100644
index 0000000000..7789ac0fef
--- /dev/null
+++ 
b/integration-tests/openapi-validator/src/test/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapi.validator.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class OpenapiValidatorIT extends OpenapiValidatorTest {
+
+}
diff --git 
a/integration-tests/openapi-validator/src/test/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorTest.java
 
b/integration-tests/openapi-validator/src/test/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorTest.java
new file mode 100644
index 0000000000..4c061b7582
--- /dev/null
+++ 
b/integration-tests/openapi-validator/src/test/java/org/apache/camel/quarkus/component/openapi/validator/it/OpenapiValidatorTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapi.validator.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+class OpenapiValidatorTest {
+
+    @Test
+    void validRequestShouldSucceed() {
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body("{\"name\":\"Apple\",\"description\":\"A fruit\"}")
+                .post("/api/fruits")
+                .then()
+                .statusCode(200)
+                .body(is("Fruit created"));
+    }
+
+    @Test
+    void emptyRequestBodyShouldFail() {
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .post("/api/fruits")
+                .then()
+                .statusCode(400)
+                .body(containsString("request body"));
+    }
+
+    @Test
+    void missingRequiredFieldShouldFail() {
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body("{\"name\":\"Apple\"}")
+                .post("/api/fruits")
+                .then()
+                .statusCode(400)
+                .body(containsString("description"));
+    }
+
+    @Test
+    void wrongPropertyTypeShouldFail() {
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body("{\"name\":123,\"description\":\"A fruit\"}")
+                .post("/api/fruits")
+                .then()
+                .statusCode(400)
+                .body(containsString("name"));
+    }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 95051215d9..1bd3422916 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -201,6 +201,7 @@
         <module>once</module>
         <module>openai</module>
         <module>openapi-java</module>
+        <module>openapi-validator</module>
         <module>openstack</module>
         <module>opentelemetry</module>
         <module>opentelemetry2</module>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 30892d3f38..e887ffde64 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -2551,6 +2551,11 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-openapi-validator</artifactId>
+                <version>${camel.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.apache.camel</groupId>
                 <artifactId>camel-opensearch</artifactId>
@@ -5891,6 +5896,16 @@
                 <artifactId>camel-quarkus-openapi-java-deployment</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-openapi-validator</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                
<artifactId>camel-quarkus-openapi-validator-deployment</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-opensearch</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml 
b/poms/bom/src/main/generated/flattened-full-pom.xml
index e72ef17a40..3a217a5766 100644
--- a/poms/bom/src/main/generated/flattened-full-pom.xml
+++ b/poms/bom/src/main/generated/flattened-full-pom.xml
@@ -2464,6 +2464,11 @@
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-openapi-validator</artifactId>
+        <version>4.21.0</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-opensearch</artifactId>
@@ -5776,6 +5781,16 @@
         <artifactId>camel-quarkus-openapi-java-deployment</artifactId>
         <version>3.38.0-SNAPSHOT</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator-deployment</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus-opensearch</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml 
b/poms/bom/src/main/generated/flattened-reduced-pom.xml
index 7dea99c1d3..5dea3081ab 100644
--- a/poms/bom/src/main/generated/flattened-reduced-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml
@@ -3792,6 +3792,11 @@
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-openapi-validator</artifactId>
+        <version>4.21.0</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-opensearch</artifactId>
@@ -7109,6 +7114,16 @@
         <artifactId>camel-quarkus-openapi-java-deployment</artifactId>
         <version>3.38.0-SNAPSHOT</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator-deployment</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus-opensearch</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml 
b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
index 892afa2804..c819585c22 100644
--- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
@@ -3792,6 +3792,11 @@
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-openapi-validator</artifactId>
+        <version>4.21.0</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-opensearch</artifactId>
@@ -7109,6 +7114,16 @@
         <artifactId>camel-quarkus-openapi-java-deployment</artifactId>
         <version>3.38.0-SNAPSHOT</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-openapi-validator-deployment</artifactId>
+        <version>3.38.0-SNAPSHOT</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus-opensearch</artifactId>
diff --git a/tooling/scripts/test-categories.yaml 
b/tooling/scripts/test-categories.yaml
index 362f0273ae..ee0a7b6be3 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -238,6 +238,7 @@ group-12:
   - langchain4j-web-search
   - langchain4j-tools
   - openapi-java
+  - openapi-validator
   - paho-mqtt5
   - platform-http
   - reactive-streams


Reply via email to