blob: b5efce7b3cadedc8af09eb04b1d62ce68fde81c9 [file] [log] [blame]
// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
= Bean Validator
:page-aliases: extensions/bean-validator.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-bean-validator
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Validate the message body using the Java Bean Validation API.
:cq-deprecated: false
:cq-jvm-since: 1.0.0
:cq-native-since: 1.0.0
[.badges]
[.badge-key]##JVM since##[.badge-supported]##1.0.0## [.badge-key]##Native since##[.badge-supported]##1.0.0##
Validate the message body using the Java Bean Validation API.
== What's inside
* xref:{cq-camel-components}::bean-validator-component.adoc[Bean Validator component], URI syntax: `bean-validator:label`
Please refer to the above link for usage and configuration details.
== Maven coordinates
https://code.quarkus.io/?extension-search=camel-quarkus-bean-validator[Create a new project with this extension on code.quarkus.io, window="_blank"]
Or add the coordinates to your existing project:
[source,xml]
----
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-bean-validator</artifactId>
</dependency>
----
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
== Usage
=== Configuring the ValidatorFactory
Implementation of this extension leverages the https://quarkus.io/guides/validation[Quarkus Hibernate Validator extension].
Therefore it is not possible to configure the `ValidatorFactory` by Camel's properties (`constraintValidatorFactory`, `messageInterpolator`, `traversableResolver`, `validationProviderResolver` and `validatorFactory`).
You can configure the `ValidatorFactory` by the creation of beans which will be injected into the default `ValidatorFactory` (created by Quarkus).
See the https://quarkus.io/guides/validation#hibernate-validator-extension-and-cdi[Quarkus CDI documentation] for more information.
=== Custom validation groups in native mode
When using custom validation groups in native mode, all the interfaces need to be registered for reflection (see the https://quarkus.io/guides/writing-native-applications-tips#register-reflection[documentation]).
Example:
[source,java]
----
@RegisterForReflection
public interface OptionalChecks {
}
----
== Camel Quarkus limitations
It is not possible to describe your constraints as XML (by providing the file META-INF/validation.xml), only Java annotations are supported.
This is caused by the limitation of the Quarkus Hibernate Validator extension (see the https://github.com/quarkusio/quarkus/issues/24027[issue]).