This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 9dd47b805c0 CAMEL-20623: Use same client request validation in
rest-dsl with open… (#13663)
9dd47b805c0 is described below
commit 9dd47b805c005445424460485f76bb5d424a28a2
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Mar 29 17:02:39 2024 +0100
CAMEL-20623: Use same client request validation in rest-dsl with open…
(#13663)
* CAMEL-20623: Use same client request validation in rest-dsl with openapi
contract first, as rest-dsl with code-first.
* CAMEL-20623: Use same client request validation in rest-dsl with openapi
contract first, as rest-dsl with code-first.
---
.../camel/catalog/components/rest-openapi.json | 56 ++---
.../org/apache/camel/catalog/models/openApi.json | 5 +-
.../apache/camel/catalog/schemas/camel-spring.xsd | 10 -
...PlatformHttpRestOpenApiConsumerRestDslTest.java | 4 +-
.../vertx/PlatformHttpRestOpenApiConsumerTest.java | 4 +-
.../http/PlatformHttpHeaderFilterStrategy.java | 2 +-
.../openapi/RestOpenApiComponentConfigurer.java | 6 +
.../openapi/RestOpenApiEndpointConfigurer.java | 6 +
.../openapi/RestOpenApiEndpointUriFactory.java | 3 +-
.../camel/component/rest/openapi/rest-openapi.json | 56 ++---
.../rest/openapi/RestOpenApiComponent.java | 14 +-
.../rest/openapi/RestOpenApiEndpoint.java | 13 +-
.../rest/openapi/RestOpenApiProcessor.java | 234 ++++++++++++++++++---
.../org/apache/camel/model/rest/openApi.json | 5 +-
.../apache/camel/model/rest/OpenApiDefinition.java | 37 ----
.../apache/camel/model/rest/RestDefinition.java | 11 +-
.../apache/camel/processor/RestBindingAdvice.java | 37 +---
.../org/apache/camel/support/http/HttpUtil.java | 1 -
.../org/apache/camel/support/http/RestUtil.java | 63 ++++++
.../java/org/apache/camel/xml/in/ModelParser.java | 1 -
.../java/org/apache/camel/xml/out/ModelWriter.java | 1 -
.../org/apache/camel/yaml/out/ModelWriter.java | 1 -
.../dsl/RestOpenapiComponentBuilderFactory.java | 54 +++--
.../dsl/RestOpenApiEndpointBuilderFactory.java | 203 ++++++++++--------
.../camel/kotlin/components/RestOpenapiUriDsl.kt | 44 ++--
.../dsl/yaml/deserializers/ModelDeserializers.java | 6 -
.../generated/resources/schema/camelYamlDsl.json | 5 -
27 files changed, 563 insertions(+), 319 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
index 112945aab32..d5104b9f003 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
@@ -24,43 +24,45 @@
},
"componentProperties": {
"basePath": { "index": 0, "kind": "property", "displayName": "Base Path",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "API basePath, for example \/v2. Default is
unset, if set overrides the value present in OpenApi specification." },
- "requestValidationEnabled": { "index": 1, "kind": "property",
"displayName": "Request Validation Enabled", "group": "common", "label":
"common", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Enable validation of requests against the configured
OpenAPI specification" },
- "specificationUri": { "index": 2, "kind": "property", "displayName":
"Specification Uri", "group": "common", "label": "common", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "openapi.json",
"description": "Path to the OpenApi specification file. The scheme, host base
path are taken from this specification, but these can be overridden with
properties on the component or endpoint level. If [...]
- "requestValidationCustomizer": { "index": 3, "kind": "property",
"displayName": "Request Validation Customizer", "group": "common (advanced)",
"label": "common,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer",
"deprecated": false, "autowired": false, "secret": false, "description": "If
request validation is enabled, this option provides the capability to customize
the creation of OpenApiInterac [...]
- "apiContextPath": { "index": 4, "kind": "property", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
- "bridgeErrorHandler": { "index": 5, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
- "missingOperation": { "index": 6, "kind": "property", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
- "consumerComponentName": { "index": 7, "kind": "property", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfac [...]
- "mockIncludePattern": { "index": 8, "kind": "property", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sepa [...]
- "restOpenapiProcessorStrategy": { "index": 9, "kind": "property",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
- "host": { "index": 10, "kind": "property", "displayName": "Host", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a na [...]
- "lazyStartProducer": { "index": 11, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the producer should be started lazy (on the first message). By
starting lazy you can use this to allow CamelContext and routes to startup in
situations where a producer may otherwise fai [...]
+ "specificationUri": { "index": 1, "kind": "property", "displayName":
"Specification Uri", "group": "common", "label": "common", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "openapi.json",
"description": "Path to the OpenApi specification file. The scheme, host base
path are taken from this specification, but these can be overridden with
properties on the component or endpoint level. If [...]
+ "requestValidationCustomizer": { "index": 2, "kind": "property",
"displayName": "Request Validation Customizer", "group": "common (advanced)",
"label": "common,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer",
"deprecated": false, "autowired": false, "secret": false, "description": "If
request validation is enabled, this option provides the capability to customize
the creation of OpenApiInterac [...]
+ "apiContextPath": { "index": 3, "kind": "property", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
+ "bridgeErrorHandler": { "index": 4, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
+ "missingOperation": { "index": 5, "kind": "property", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
+ "consumerComponentName": { "index": 6, "kind": "property", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfac [...]
+ "mockIncludePattern": { "index": 7, "kind": "property", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sepa [...]
+ "restOpenapiProcessorStrategy": { "index": 8, "kind": "property",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
+ "host": { "index": 9, "kind": "property", "displayName": "Host", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a nam [...]
+ "lazyStartProducer": { "index": 10, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the producer should be started lazy (on the first message). By
starting lazy you can use this to allow CamelContext and routes to startup in
situations where a producer may otherwise fai [...]
+ "requestValidationEnabled": { "index": 11, "kind": "property",
"displayName": "Request Validation Enabled", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Enable validation of requests against the configured
OpenAPI specification" },
"componentName": { "index": 12, "kind": "property", "displayName":
"Component Name", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "Name
of the Camel component that will perform the requests. The component must be
present in Camel registry and it must implement RestProducerFactory service
provider interface. If not set CLASSPATH [...]
"consumes": { "index": 13, "kind": "property", "displayName": "Consumes",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "What payload type this
component capable of consuming. Could be one type, like application\/json or
multiple types as application\/json, application\/xml; q=0.5 according to the
RFC7231. This equates to the va [...]
"produces": { "index": 14, "kind": "property", "displayName": "Produces",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "What payload type this
component is producing. For example application\/json according to the RFC7231.
This equates to the value of Content-Type HTTP header. If set overrides any
value present in the OpenApi s [...]
"autowiredEnabled": { "index": 15, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching [...]
- "sslContextParameters": { "index": 16, "kind": "property", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "description": "Customize TLS parameters
used by the component. If not set defaults to the TLS parameters set in the
Camel context" },
- "useGlobalSslContextParameters": { "index": 17, "kind": "property",
"displayName": "Use Global Ssl Context Parameters", "group": "security",
"label": "security", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Enable usage of global SSL context
parameters." }
+ "clientRequestValidation": { "index": 16, "kind": "property",
"displayName": "Client Request Validation", "group": "consumes", "label":
"consumes", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Whether to enable validation of the client request to
check if the incoming request is valid according to the OpenAPI specification"
},
+ "sslContextParameters": { "index": 17, "kind": "property", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "description": "Customize TLS parameters
used by the component. If not set defaults to the TLS parameters set in the
Camel context" },
+ "useGlobalSslContextParameters": { "index": 18, "kind": "property",
"displayName": "Use Global Ssl Context Parameters", "group": "security",
"label": "security", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Enable usage of global SSL context
parameters." }
},
"properties": {
"specificationUri": { "index": 0, "kind": "path", "displayName":
"Specification Uri", "group": "common", "label": "common", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "openapi.json",
"description": "Path to the OpenApi specification file. The scheme, host base
path are taken from this specification, but these can be overridden with
properties on the component or endpoint level. If not [...]
"operationId": { "index": 1, "kind": "path", "displayName": "Operation
Id", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "ID of the operation from the OpenApi
specification. This is required when using producer" },
- "requestValidationEnabled": { "index": 2, "kind": "parameter",
"displayName": "Request Validation Enabled", "group": "common", "label": "",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Enable validation of requests against the configured OpenAPI
specification" },
- "apiContextPath": { "index": 3, "kind": "parameter", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
- "missingOperation": { "index": 4, "kind": "parameter", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
- "bridgeErrorHandler": { "index": 5, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
- "consumerComponentName": { "index": 6, "kind": "parameter", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfa [...]
- "exceptionHandler": { "index": 7, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By def [...]
- "exchangePattern": { "index": 8, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
- "mockIncludePattern": { "index": 9, "kind": "parameter", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sep [...]
- "restOpenapiProcessorStrategy": { "index": 10, "kind": "parameter",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
- "basePath": { "index": 11, "kind": "parameter", "displayName": "Base
Path", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "API basePath, for example \/v3. Default
is unset, if set overrides the value present in OpenApi specification and in
the component configuration." },
- "consumes": { "index": 12, "kind": "parameter", "displayName": "Consumes",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component capable of
consuming. Could be one type, like application\/json or multiple types as
application\/json, application\/xml; q=0.5 according to the RFC7231. This
equates to the value of Accept HTTP [...]
- "host": { "index": 13, "kind": "parameter", "displayName": "Host",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a n [...]
- "produces": { "index": 14, "kind": "parameter", "displayName": "Produces",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component is producing.
For example application\/json according to the RFC7231. This equates to the
value of Content-Type HTTP header. If set overrides any value present in the
OpenApi specification. Overr [...]
+ "apiContextPath": { "index": 2, "kind": "parameter", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
+ "missingOperation": { "index": 3, "kind": "parameter", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
+ "bridgeErrorHandler": { "index": 4, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
+ "consumerComponentName": { "index": 5, "kind": "parameter", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfa [...]
+ "exceptionHandler": { "index": 6, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By def [...]
+ "exchangePattern": { "index": 7, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
+ "mockIncludePattern": { "index": 8, "kind": "parameter", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sep [...]
+ "restOpenapiProcessorStrategy": { "index": 9, "kind": "parameter",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
+ "basePath": { "index": 10, "kind": "parameter", "displayName": "Base
Path", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "API basePath, for example \/v3. Default
is unset, if set overrides the value present in OpenApi specification and in
the component configuration." },
+ "consumes": { "index": 11, "kind": "parameter", "displayName": "Consumes",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component capable of
consuming. Could be one type, like application\/json or multiple types as
application\/json, application\/xml; q=0.5 according to the RFC7231. This
equates to the value of Accept HTTP [...]
+ "host": { "index": 12, "kind": "parameter", "displayName": "Host",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a n [...]
+ "produces": { "index": 13, "kind": "parameter", "displayName": "Produces",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component is producing.
For example application\/json according to the RFC7231. This equates to the
value of Content-Type HTTP header. If set overrides any value present in the
OpenApi specification. Overr [...]
+ "requestValidationEnabled": { "index": 14, "kind": "parameter",
"displayName": "Request Validation Enabled", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Enable validation of requests against the configured
OpenAPI specification" },
"componentName": { "index": 15, "kind": "parameter", "displayName":
"Component Name", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "Name
of the Camel component that will perform the requests. The component must be
present in Camel registry and it must implement RestProducerFactory service
provider interface. If not set CLASSPAT [...]
"lazyStartProducer": { "index": 16, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
"requestValidationCustomizer": { "index": 17, "kind": "parameter",
"displayName": "Request Validation Customizer", "group": "advanced", "label":
"advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer",
"deprecated": false, "autowired": false, "secret": false, "description": "If
request validation is enabled, this option provides the capability to customize
the creation of OpenApiInteractionValidator [...]
- "requestValidationLevels": { "index": 18, "kind": "parameter",
"displayName": "Request Validation Levels", "group": "advanced", "label":
"advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.",
"multiValue": true, "deprecated": false, "autowired": false, "secret": false,
"description": "Levels for specific OpenAPI request validation options.
Multiple options can be specified as URI options prefixed by ' [...]
+ "requestValidationLevels": { "index": 18, "kind": "parameter",
"displayName": "Request Validation Levels", "group": "advanced", "label":
"advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.",
"multiValue": true, "deprecated": false, "autowired": false, "secret": false,
"description": "Levels for specific OpenAPI request validation options.
Multiple options can be specified as URI options prefixed by ' [...]
+ "clientRequestValidation": { "index": 19, "kind": "parameter",
"displayName": "Client Request Validation", "group": "consumes", "label":
"consumes", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Whether to enable validation of the client request to
check if the incoming request is valid according to the OpenAPI specification" }
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
index 2d064458544..f1292c7c300 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
@@ -17,8 +17,7 @@
"disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled",
"label": "advanced", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to disable all the REST services
from the OpenAPI contract from the route during build time. Once an REST
service has been disabled then it cannot be enabled later at runtime." },
"specification": { "index": 3, "kind": "attribute", "displayName":
"Specification", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Path to the OpenApi specification file." },
"routeId": { "index": 4, "kind": "attribute", "displayName": "Route Id",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the id of the route" },
- "requestValidationEnabled": { "index": 5, "kind": "attribute",
"displayName": "Request Validation Enabled", "required": false, "type":
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether to
enable validation of the client request to check that the request contains
valid and expected data." },
- "missingOperation": { "index": 6, "kind": "attribute", "displayName":
"Missing Operation", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "fail", "description":
"Whether to fail, ignore or return a mock response for OpenAPI operations that
are not mapped to a corresponding route." },
- "mockIncludePattern": { "index": 7, "kind": "attribute", "displayName":
"Mock Include Pattern", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "classpath:camel-mock\/**",
"description": "Used for inclusive filtering of mock data from directories. The
pattern is using Ant-path style pattern. Multiple patterns can be specified
separated by comma." }
+ "missingOperation": { "index": 5, "kind": "attribute", "displayName":
"Missing Operation", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "fail", "description":
"Whether to fail, ignore or return a mock response for OpenAPI operations that
are not mapped to a corresponding route." },
+ "mockIncludePattern": { "index": 6, "kind": "attribute", "displayName":
"Mock Include Pattern", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "classpath:camel-mock\/**",
"description": "Used for inclusive filtering of mock data from directories. The
pattern is using Ant-path style pattern. Multiple patterns can be specified
separated by comma." }
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 745fd32593f..ab44d54adc5 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -16414,16 +16414,6 @@ Sets the id of the route.
<![CDATA[
Whether to disable all the REST services from the OpenAPI contract from the
route during build time. Once an REST
service has been disabled then it cannot be enabled later at runtime. Default
value: false
-]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="requestValidationEnabled" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">
-<![CDATA[
-Whether to enable validation of the client request to check that the request
contains valid and expected data. Default
-value: false
]]>
</xs:documentation>
</xs:annotation>
diff --git
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java
index c659090e47a..0a64d1edb0c 100644
---
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java
+++
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java
@@ -213,7 +213,7 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
-
rest().openApi().specification("openapi-v3.json").missingOperation("ignore").requestValidationEnabled();
+
rest().clientRequestValidation(true).openApi().specification("openapi-v3.json").missingOperation("ignore");
from("direct:updatePet")
.setBody().constant("{\"pet\": \"tony the
tiger\"}");
@@ -226,7 +226,7 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
.when()
.put("/api/v3/pet")
.then()
- .statusCode(405); // no request body
+ .statusCode(400); // no request body
} finally {
context.stop();
}
diff --git
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerTest.java
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerTest.java
index e67426764f1..9a28f9ce5ba 100644
---
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerTest.java
+++
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerTest.java
@@ -216,7 +216,7 @@ public class PlatformHttpRestOpenApiConsumerTest {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
-
from("rest-openapi:classpath:openapi-v3.json?missingOperation=ignore&requestValidationEnabled=true")
+
from("rest-openapi:classpath:openapi-v3.json?missingOperation=ignore&clientRequestValidation=true")
.log("dummy");
from("direct:updatePet")
@@ -230,7 +230,7 @@ public class PlatformHttpRestOpenApiConsumerTest {
.when()
.put("/api/v3/pet")
.then()
- .statusCode(405); // no request body
+ .statusCode(400); // no request body
} finally {
context.stop();
}
diff --git
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpHeaderFilterStrategy.java
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpHeaderFilterStrategy.java
index 3621d67280e..f291bc3030c 100644
---
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpHeaderFilterStrategy.java
+++
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpHeaderFilterStrategy.java
@@ -24,7 +24,7 @@ import org.apache.camel.support.http.HttpUtil;
* {@code camel-http-common} not to depend on {@code jakarta.servlet-api} and
then use the
* {@code HttpHeaderFilterStrategy} from there.
*
- * @deprecated use {@link
org.apache.camel.http.common.HttpHeaderFilterStrategy} instead.
+ * @deprecated use {@link
org.apache.camel.http.common.HttpHeaderFilterStrategy} instead.
*/
@Deprecated
public class PlatformHttpHeaderFilterStrategy extends
DefaultHeaderFilterStrategy {
diff --git
a/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentConfigurer.java
b/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentConfigurer.java
index 5d48898caa9..e7bfca41e55 100644
---
a/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentConfigurer.java
+++
b/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentConfigurer.java
@@ -29,6 +29,8 @@ public class RestOpenApiComponentConfigurer extends
PropertyConfigurerSupport im
case "basePath": target.setBasePath(property(camelContext,
java.lang.String.class, value)); return true;
case "bridgeerrorhandler":
case "bridgeErrorHandler":
target.setBridgeErrorHandler(property(camelContext, boolean.class, value));
return true;
+ case "clientrequestvalidation":
+ case "clientRequestValidation":
target.setClientRequestValidation(property(camelContext, boolean.class,
value)); return true;
case "componentname":
case "componentName": target.setComponentName(property(camelContext,
java.lang.String.class, value)); return true;
case "consumercomponentname":
@@ -69,6 +71,8 @@ public class RestOpenApiComponentConfigurer extends
PropertyConfigurerSupport im
case "basePath": return java.lang.String.class;
case "bridgeerrorhandler":
case "bridgeErrorHandler": return boolean.class;
+ case "clientrequestvalidation":
+ case "clientRequestValidation": return boolean.class;
case "componentname":
case "componentName": return java.lang.String.class;
case "consumercomponentname":
@@ -110,6 +114,8 @@ public class RestOpenApiComponentConfigurer extends
PropertyConfigurerSupport im
case "basePath": return target.getBasePath();
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+ case "clientrequestvalidation":
+ case "clientRequestValidation": return
target.isClientRequestValidation();
case "componentname":
case "componentName": return target.getComponentName();
case "consumercomponentname":
diff --git
a/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointConfigurer.java
b/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointConfigurer.java
index cdcf0df0cba..9d7b7321749 100644
---
a/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointConfigurer.java
+++
b/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointConfigurer.java
@@ -27,6 +27,8 @@ public class RestOpenApiEndpointConfigurer extends
PropertyConfigurerSupport imp
case "basePath": target.setBasePath(property(camelContext,
java.lang.String.class, value)); return true;
case "bridgeerrorhandler":
case "bridgeErrorHandler":
target.setBridgeErrorHandler(property(camelContext, boolean.class, value));
return true;
+ case "clientrequestvalidation":
+ case "clientRequestValidation":
target.setClientRequestValidation(property(camelContext, boolean.class,
value)); return true;
case "componentname":
case "componentName": target.setComponentName(property(camelContext,
java.lang.String.class, value)); return true;
case "consumercomponentname":
@@ -65,6 +67,8 @@ public class RestOpenApiEndpointConfigurer extends
PropertyConfigurerSupport imp
case "basePath": return java.lang.String.class;
case "bridgeerrorhandler":
case "bridgeErrorHandler": return boolean.class;
+ case "clientrequestvalidation":
+ case "clientRequestValidation": return boolean.class;
case "componentname":
case "componentName": return java.lang.String.class;
case "consumercomponentname":
@@ -104,6 +108,8 @@ public class RestOpenApiEndpointConfigurer extends
PropertyConfigurerSupport imp
case "basePath": return target.getBasePath();
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+ case "clientrequestvalidation":
+ case "clientRequestValidation": return
target.isClientRequestValidation();
case "componentname":
case "componentName": return target.getComponentName();
case "consumercomponentname":
diff --git
a/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointUriFactory.java
b/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointUriFactory.java
index 5831306e28b..12de0f22eb9 100644
---
a/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointUriFactory.java
+++
b/components/camel-rest-openapi/src/generated/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointUriFactory.java
@@ -21,10 +21,11 @@ public class RestOpenApiEndpointUriFactory extends
org.apache.camel.support.comp
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(19);
+ Set<String> props = new HashSet<>(20);
props.add("apiContextPath");
props.add("basePath");
props.add("bridgeErrorHandler");
+ props.add("clientRequestValidation");
props.add("componentName");
props.add("consumerComponentName");
props.add("consumes");
diff --git
a/components/camel-rest-openapi/src/generated/resources/META-INF/org/apache/camel/component/rest/openapi/rest-openapi.json
b/components/camel-rest-openapi/src/generated/resources/META-INF/org/apache/camel/component/rest/openapi/rest-openapi.json
index 112945aab32..d5104b9f003 100644
---
a/components/camel-rest-openapi/src/generated/resources/META-INF/org/apache/camel/component/rest/openapi/rest-openapi.json
+++
b/components/camel-rest-openapi/src/generated/resources/META-INF/org/apache/camel/component/rest/openapi/rest-openapi.json
@@ -24,43 +24,45 @@
},
"componentProperties": {
"basePath": { "index": 0, "kind": "property", "displayName": "Base Path",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "API basePath, for example \/v2. Default is
unset, if set overrides the value present in OpenApi specification." },
- "requestValidationEnabled": { "index": 1, "kind": "property",
"displayName": "Request Validation Enabled", "group": "common", "label":
"common", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Enable validation of requests against the configured
OpenAPI specification" },
- "specificationUri": { "index": 2, "kind": "property", "displayName":
"Specification Uri", "group": "common", "label": "common", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "openapi.json",
"description": "Path to the OpenApi specification file. The scheme, host base
path are taken from this specification, but these can be overridden with
properties on the component or endpoint level. If [...]
- "requestValidationCustomizer": { "index": 3, "kind": "property",
"displayName": "Request Validation Customizer", "group": "common (advanced)",
"label": "common,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer",
"deprecated": false, "autowired": false, "secret": false, "description": "If
request validation is enabled, this option provides the capability to customize
the creation of OpenApiInterac [...]
- "apiContextPath": { "index": 4, "kind": "property", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
- "bridgeErrorHandler": { "index": 5, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
- "missingOperation": { "index": 6, "kind": "property", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
- "consumerComponentName": { "index": 7, "kind": "property", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfac [...]
- "mockIncludePattern": { "index": 8, "kind": "property", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sepa [...]
- "restOpenapiProcessorStrategy": { "index": 9, "kind": "property",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
- "host": { "index": 10, "kind": "property", "displayName": "Host", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a na [...]
- "lazyStartProducer": { "index": 11, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the producer should be started lazy (on the first message). By
starting lazy you can use this to allow CamelContext and routes to startup in
situations where a producer may otherwise fai [...]
+ "specificationUri": { "index": 1, "kind": "property", "displayName":
"Specification Uri", "group": "common", "label": "common", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "openapi.json",
"description": "Path to the OpenApi specification file. The scheme, host base
path are taken from this specification, but these can be overridden with
properties on the component or endpoint level. If [...]
+ "requestValidationCustomizer": { "index": 2, "kind": "property",
"displayName": "Request Validation Customizer", "group": "common (advanced)",
"label": "common,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer",
"deprecated": false, "autowired": false, "secret": false, "description": "If
request validation is enabled, this option provides the capability to customize
the creation of OpenApiInterac [...]
+ "apiContextPath": { "index": 3, "kind": "property", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
+ "bridgeErrorHandler": { "index": 4, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
+ "missingOperation": { "index": 5, "kind": "property", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
+ "consumerComponentName": { "index": 6, "kind": "property", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfac [...]
+ "mockIncludePattern": { "index": 7, "kind": "property", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sepa [...]
+ "restOpenapiProcessorStrategy": { "index": 8, "kind": "property",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
+ "host": { "index": 9, "kind": "property", "displayName": "Host", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a nam [...]
+ "lazyStartProducer": { "index": 10, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the producer should be started lazy (on the first message). By
starting lazy you can use this to allow CamelContext and routes to startup in
situations where a producer may otherwise fai [...]
+ "requestValidationEnabled": { "index": 11, "kind": "property",
"displayName": "Request Validation Enabled", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Enable validation of requests against the configured
OpenAPI specification" },
"componentName": { "index": 12, "kind": "property", "displayName":
"Component Name", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "Name
of the Camel component that will perform the requests. The component must be
present in Camel registry and it must implement RestProducerFactory service
provider interface. If not set CLASSPATH [...]
"consumes": { "index": 13, "kind": "property", "displayName": "Consumes",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "What payload type this
component capable of consuming. Could be one type, like application\/json or
multiple types as application\/json, application\/xml; q=0.5 according to the
RFC7231. This equates to the va [...]
"produces": { "index": 14, "kind": "property", "displayName": "Produces",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "What payload type this
component is producing. For example application\/json according to the RFC7231.
This equates to the value of Content-Type HTTP header. If set overrides any
value present in the OpenApi s [...]
"autowiredEnabled": { "index": 15, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching [...]
- "sslContextParameters": { "index": 16, "kind": "property", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "description": "Customize TLS parameters
used by the component. If not set defaults to the TLS parameters set in the
Camel context" },
- "useGlobalSslContextParameters": { "index": 17, "kind": "property",
"displayName": "Use Global Ssl Context Parameters", "group": "security",
"label": "security", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Enable usage of global SSL context
parameters." }
+ "clientRequestValidation": { "index": 16, "kind": "property",
"displayName": "Client Request Validation", "group": "consumes", "label":
"consumes", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Whether to enable validation of the client request to
check if the incoming request is valid according to the OpenAPI specification"
},
+ "sslContextParameters": { "index": 17, "kind": "property", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "description": "Customize TLS parameters
used by the component. If not set defaults to the TLS parameters set in the
Camel context" },
+ "useGlobalSslContextParameters": { "index": 18, "kind": "property",
"displayName": "Use Global Ssl Context Parameters", "group": "security",
"label": "security", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Enable usage of global SSL context
parameters." }
},
"properties": {
"specificationUri": { "index": 0, "kind": "path", "displayName":
"Specification Uri", "group": "common", "label": "common", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "openapi.json",
"description": "Path to the OpenApi specification file. The scheme, host base
path are taken from this specification, but these can be overridden with
properties on the component or endpoint level. If not [...]
"operationId": { "index": 1, "kind": "path", "displayName": "Operation
Id", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "ID of the operation from the OpenApi
specification. This is required when using producer" },
- "requestValidationEnabled": { "index": 2, "kind": "parameter",
"displayName": "Request Validation Enabled", "group": "common", "label": "",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Enable validation of requests against the configured OpenAPI
specification" },
- "apiContextPath": { "index": 3, "kind": "parameter", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
- "missingOperation": { "index": 4, "kind": "parameter", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
- "bridgeErrorHandler": { "index": 5, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
- "consumerComponentName": { "index": 6, "kind": "parameter", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfa [...]
- "exceptionHandler": { "index": 7, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By def [...]
- "exchangePattern": { "index": 8, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
- "mockIncludePattern": { "index": 9, "kind": "parameter", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sep [...]
- "restOpenapiProcessorStrategy": { "index": 10, "kind": "parameter",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
- "basePath": { "index": 11, "kind": "parameter", "displayName": "Base
Path", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "API basePath, for example \/v3. Default
is unset, if set overrides the value present in OpenApi specification and in
the component configuration." },
- "consumes": { "index": 12, "kind": "parameter", "displayName": "Consumes",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component capable of
consuming. Could be one type, like application\/json or multiple types as
application\/json, application\/xml; q=0.5 according to the RFC7231. This
equates to the value of Accept HTTP [...]
- "host": { "index": 13, "kind": "parameter", "displayName": "Host",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a n [...]
- "produces": { "index": 14, "kind": "parameter", "displayName": "Produces",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component is producing.
For example application\/json according to the RFC7231. This equates to the
value of Content-Type HTTP header. If set overrides any value present in the
OpenApi specification. Overr [...]
+ "apiContextPath": { "index": 2, "kind": "parameter", "displayName": "Api
Context Path", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Sets the context-path to
use for servicing the OpenAPI specification" },
+ "missingOperation": { "index": 3, "kind": "parameter", "displayName":
"Missing Operation", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail",
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore
or return a mock response for OpenAPI operations that are not mapped to a
corresponding route." },
+ "bridgeErrorHandler": { "index": 4, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
+ "consumerComponentName": { "index": 5, "kind": "parameter", "displayName":
"Consumer Component Name", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name of the Camel component that will service the requests. The
component must be present in Camel registry and it must implement
RestOpenApiConsumerFactory service provider interfa [...]
+ "exceptionHandler": { "index": 6, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By def [...]
+ "exchangePattern": { "index": 7, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
+ "mockIncludePattern": { "index": 8, "kind": "parameter", "displayName":
"Mock Include Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive
filtering of mock data from directories. The pattern is using Ant-path style
pattern. Multiple patterns can be specified sep [...]
+ "restOpenapiProcessorStrategy": { "index": 9, "kind": "parameter",
"displayName": "Rest Openapi Processor Strategy", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType":
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
use a custom strategy for how to process Rest DSL requests" },
+ "basePath": { "index": 10, "kind": "parameter", "displayName": "Base
Path", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "API basePath, for example \/v3. Default
is unset, if set overrides the value present in OpenApi specification and in
the component configuration." },
+ "consumes": { "index": 11, "kind": "parameter", "displayName": "Consumes",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component capable of
consuming. Could be one type, like application\/json or multiple types as
application\/json, application\/xml; q=0.5 according to the RFC7231. This
equates to the value of Accept HTTP [...]
+ "host": { "index": 12, "kind": "parameter", "displayName": "Host",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Scheme hostname and port to direct the HTTP
requests to in the form of https:\/\/hostname:port. Can be configured at the
endpoint, component or in the corresponding REST configuration in the Camel
Context. If you give this component a n [...]
+ "produces": { "index": 13, "kind": "parameter", "displayName": "Produces",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "What payload type this component is producing.
For example application\/json according to the RFC7231. This equates to the
value of Content-Type HTTP header. If set overrides any value present in the
OpenApi specification. Overr [...]
+ "requestValidationEnabled": { "index": 14, "kind": "parameter",
"displayName": "Request Validation Enabled", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Enable validation of requests against the configured
OpenAPI specification" },
"componentName": { "index": 15, "kind": "parameter", "displayName":
"Component Name", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "Name
of the Camel component that will perform the requests. The component must be
present in Camel registry and it must implement RestProducerFactory service
provider interface. If not set CLASSPAT [...]
"lazyStartProducer": { "index": 16, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
"requestValidationCustomizer": { "index": 17, "kind": "parameter",
"displayName": "Request Validation Customizer", "group": "advanced", "label":
"advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer",
"deprecated": false, "autowired": false, "secret": false, "description": "If
request validation is enabled, this option provides the capability to customize
the creation of OpenApiInteractionValidator [...]
- "requestValidationLevels": { "index": 18, "kind": "parameter",
"displayName": "Request Validation Levels", "group": "advanced", "label":
"advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.",
"multiValue": true, "deprecated": false, "autowired": false, "secret": false,
"description": "Levels for specific OpenAPI request validation options.
Multiple options can be specified as URI options prefixed by ' [...]
+ "requestValidationLevels": { "index": 18, "kind": "parameter",
"displayName": "Request Validation Levels", "group": "advanced", "label":
"advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.",
"multiValue": true, "deprecated": false, "autowired": false, "secret": false,
"description": "Levels for specific OpenAPI request validation options.
Multiple options can be specified as URI options prefixed by ' [...]
+ "clientRequestValidation": { "index": 19, "kind": "parameter",
"displayName": "Client Request Validation", "group": "consumes", "label":
"consumes", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
false, "description": "Whether to enable validation of the client request to
check if the incoming request is valid according to the OpenAPI specification" }
}
}
diff --git
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
index d9eb5b17925..02e49d0b590 100644
---
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
+++
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
@@ -124,7 +124,10 @@ public final class RestOpenApiComponent extends
DefaultComponent implements SSLC
+ " any value present in the OpenApi
specification. Can be overridden in endpoint configuration.",
label = "producer,advanced")
private String produces;
- @Metadata(label = "common", description = "Enable validation of requests
against the configured OpenAPI specification")
+ @Metadata(label = "consumes",
+ description = "Whether to enable validation of the client
request to check if the incoming request is valid according to the OpenAPI
specification")
+ private boolean clientRequestValidation;
+ @Metadata(label = "producer", description = "Enable validation of requests
against the configured OpenAPI specification")
private boolean requestValidationEnabled;
@Metadata(description = "If request validation is enabled, this option
provides the capability to customize"
+ " the creation of OpenApiInteractionValidator
used to validate requests.",
@@ -159,6 +162,7 @@ public final class RestOpenApiComponent extends
DefaultComponent implements SSLC
throws Exception {
RestOpenApiEndpoint endpoint = new RestOpenApiEndpoint(uri, remaining,
this, parameters);
endpoint.setApiContextPath(getApiContextPath());
+ endpoint.setClientRequestValidation(isClientRequestValidation());
endpoint.setRequestValidationCustomizer(getRequestValidationCustomizer());
endpoint.setRequestValidationEnabled(isRequestValidationEnabled());
endpoint.setRequestValidationLevels(PropertiesHelper.extractProperties(parameters,
"validation."));
@@ -283,6 +287,14 @@ public final class RestOpenApiComponent extends
DefaultComponent implements SSLC
return this.requestValidationEnabled;
}
+ public boolean isClientRequestValidation() {
+ return clientRequestValidation;
+ }
+
+ public void setClientRequestValidation(boolean clientRequestValidation) {
+ this.clientRequestValidation = clientRequestValidation;
+ }
+
public void setRequestValidationCustomizer(RequestValidationCustomizer
requestValidationCustomizer) {
this.requestValidationCustomizer = requestValidationCustomizer;
}
diff --git
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
index da2620cb248..addc0f29e90 100644
---
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
+++
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
@@ -151,7 +151,10 @@ public final class RestOpenApiEndpoint extends
DefaultEndpoint {
defaultValue = RestOpenApiComponent.DEFAULT_SPECIFICATION_URI,
defaultValueNote = "By default loads `openapi.json` file", label
= "common")
private String specificationUri;
- @UriParam(description = "Enable validation of requests against the
configured OpenAPI specification")
+ @UriParam(label = "consumes",
+ description = "Whether to enable validation of the client
request to check if the incoming request is valid according to the OpenAPI
specification")
+ private boolean clientRequestValidation;
+ @UriParam(label = "producer", description = "Enable validation of requests
against the configured OpenAPI specification")
private boolean requestValidationEnabled;
@UriParam(description = "If request validation is enabled, this option
provides the capability to customize"
+ " the creation of OpenApiInteractionValidator
used to validate requests.",
@@ -438,6 +441,14 @@ public final class RestOpenApiEndpoint extends
DefaultEndpoint {
return requestValidationEnabled;
}
+ public boolean isClientRequestValidation() {
+ return clientRequestValidation;
+ }
+
+ public void setClientRequestValidation(boolean clientRequestValidation) {
+ this.clientRequestValidation = clientRequestValidation;
+ }
+
public void setRequestValidationLevels(Map<String, Object>
requestValidationLevels) {
this.requestValidationLevels = requestValidationLevels;
}
diff --git
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
index 44bbbce008d..7a4e6d89bb3 100644
---
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
+++
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
@@ -18,28 +18,40 @@ package org.apache.camel.component.rest.openapi;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
-import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
+import io.swagger.v3.oas.models.media.Content;
import io.swagger.v3.oas.models.parameters.Parameter;
+import joptsimple.internal.Strings;
import org.apache.camel.AsyncCallback;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.component.rest.openapi.validator.RequestValidator;
+import org.apache.camel.spi.DataType;
+import org.apache.camel.spi.DataTypeAware;
+import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.support.ExchangeHelper;
+import org.apache.camel.support.MessageHelper;
import org.apache.camel.support.RestConsumerContextPathMatcher;
import org.apache.camel.support.processor.DelegateAsyncProcessor;
import org.apache.camel.support.service.ServiceHelper;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static
org.apache.camel.support.http.RestUtil.isValidOrAcceptedContentType;
public class RestOpenApiProcessor extends DelegateAsyncProcessor implements
CamelContextAware {
+ private static final Logger LOG =
LoggerFactory.getLogger(RestOpenApiProcessor.class);
+
private static final List<String> METHODS
= Arrays.asList("GET", "HEAD", "POST", "PUT", "DELETE", "TRACE",
"OPTIONS", "CONNECT", "PATCH");
@@ -83,39 +95,18 @@ public class RestOpenApiProcessor extends
DelegateAsyncProcessor implements Came
RestConsumerContextPathMatcher.ConsumerPath<Operation> m
= RestConsumerContextPathMatcher.matchBestPath(verb, path,
paths);
if (m != null) {
- Operation operation = m.getConsumer();
-
- // we have found the operation to call, but if validation is
enabled then we need
+ Operation o = m.getConsumer();
+ // binding mode
+ RestConfiguration config = camelContext.getRestConfiguration();
+ RestConfiguration.RestBindingMode bindingMode =
config.getBindingMode();
+ // we have found the op to call, but if validation is enabled then
we need
// to validate the incoming request first
- if (endpoint.isRequestValidationEnabled()) {
- Map<String, Parameter> pathParameters;
- if (operation.getParameters() != null) {
- pathParameters = operation.getParameters().stream()
- .filter(p -> "path".equals(p.getIn()))
- .collect(Collectors.toMap(Parameter::getName,
Function.identity()));
- } else {
- pathParameters = new HashMap<>();
- }
- try {
- final String uriTemplate = endpoint.resolveUri(path,
pathParameters);
- RequestValidator validator =
endpoint.configureRequestValidator(openAPI, operation, verb, uriTemplate);
- Set<String> errors = validator.validate(exchange);
- if (!errors.isEmpty()) {
- RestOpenApiValidationException exception = new
RestOpenApiValidationException(errors);
- exchange.setException(exception);
- // validation error should be 405
-
exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 405);
- callback.done(true);
- return true;
- }
- } catch (Exception e) {
- exchange.setException(e);
- callback.done(true);
- return true;
- }
+ if (endpoint.isClientRequestValidation() &&
isInvalidClientRequest(exchange, callback, o, bindingMode)) {
+ // okay some validation error so return true
+ return true;
}
-
- return restOpenapiProcessorStrategy.process(operation, path,
exchange, callback);
+ // process the incoming request
+ return restOpenapiProcessorStrategy.process(o, path, exchange,
callback);
}
// is it the api-context path
@@ -138,6 +129,181 @@ public class RestOpenApiProcessor extends
DelegateAsyncProcessor implements Came
return true;
}
+ /**
+ * Checks if the incoming request is invalid (has some error) according to
the OpenAPI operation that is intended to
+ * be invoked.
+ *
+ * @return true if some validation error and should stop routing
+ */
+ protected boolean isInvalidClientRequest(
+ Exchange exchange, AsyncCallback callback, Operation o,
RestConfiguration.RestBindingMode bindingMode) {
+
+ // this code is similar to logic in camel-core (RestBindingAdvice) for
rest-dsl with code-first approach
+
+ boolean isXml = false;
+ boolean isJson = false;
+ String contentType = ExchangeHelper.getContentType(exchange);
+ if (contentType != null) {
+ isXml = contentType.toLowerCase(Locale.ENGLISH).contains("xml");
+ isJson = contentType.toLowerCase(Locale.ENGLISH).contains("json");
+ }
+ String accept = exchange.getMessage().getHeader("Accept",
String.class);
+
+ String consumes = endpoint.getConsumes();
+ String produces = endpoint.getProduces();
+ // the operation may have specific information what it can consume
+ if (o.getRequestBody() != null) {
+ Content c = o.getRequestBody().getContent();
+ if (c != null) {
+ consumes =
Strings.join(c.keySet().stream().sorted().collect(Collectors.toList()), ",");
+ }
+ }
+ // the operation may have specific information what it can produce
+ if (o.getResponses() != null) {
+ for (var a : o.getResponses().values()) {
+ Content c = a.getContent();
+ if (c != null) {
+ produces =
Strings.join(c.keySet().stream().sorted().collect(Collectors.toList()), ",");
+ }
+ }
+ }
+ // if content type could not tell us if it was json or xml, then
fallback to if the binding was configured with
+ // that information in the consumes
+ if (!isXml && !isJson) {
+ isXml = consumes != null &&
consumes.toLowerCase(Locale.ENGLISH).contains("xml");
+ isJson = consumes != null &&
consumes.toLowerCase(Locale.ENGLISH).contains("json");
+ }
+
+ // set data type if in use
+ if (exchange.getContext().isUseDataType()) {
+ if (exchange.getIn() instanceof DataTypeAware && (isJson ||
isXml)) {
+ ((DataTypeAware) exchange.getIn()).setDataType(new
DataType(isJson ? "json" : "xml"));
+ }
+ }
+
+ // check if the content-type is accepted according to consumes
+ if (!isValidOrAcceptedContentType(consumes, contentType)) {
+ LOG.trace("Consuming content type does not match contentType
header {}. Stopping routing.", contentType);
+ // the content-type is not something we can process so its a
HTTP_ERROR 415
+ exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 415);
+ // set empty response body as http error code indicate the problem
+ exchange.getMessage().setBody(null);
+ // stop routing and return
+ exchange.setRouteStop(true);
+ callback.done(true);
+ return true;
+ }
+ // check if what is produces is accepted by the client
+ if (!isValidOrAcceptedContentType(produces, accept)) {
+ LOG.trace("Produced content type does not match accept header {}.
Stopping routing.", contentType);
+ // the response type is not accepted by the client so its a
HTTP_ERROR 406
+ exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 406);
+ // set empty response body as http error code indicate the problem
+ exchange.getMessage().setBody(null);
+ // stop routing and return
+ exchange.setRouteStop(true);
+ callback.done(true);
+ return true;
+ }
+
+ // only allow xml/json if the binding mode allows that
+ isXml &= bindingMode.equals(RestConfiguration.RestBindingMode.auto)
+ || bindingMode.equals(RestConfiguration.RestBindingMode.xml)
+ ||
bindingMode.equals(RestConfiguration.RestBindingMode.json_xml);
+ isJson &= bindingMode.equals(RestConfiguration.RestBindingMode.auto)
+ || bindingMode.equals(RestConfiguration.RestBindingMode.json)
+ ||
bindingMode.equals(RestConfiguration.RestBindingMode.json_xml);
+
+ // if we do not yet know if its xml or json, then use the binding mode
to know the mode
+ if (!isJson && !isXml) {
+ isXml = bindingMode.equals(RestConfiguration.RestBindingMode.auto)
+ ||
bindingMode.equals(RestConfiguration.RestBindingMode.xml)
+ ||
bindingMode.equals(RestConfiguration.RestBindingMode.json_xml);
+ isJson = bindingMode.equals(RestConfiguration.RestBindingMode.auto)
+ ||
bindingMode.equals(RestConfiguration.RestBindingMode.json)
+ ||
bindingMode.equals(RestConfiguration.RestBindingMode.json_xml);
+ }
+ boolean requiredBody = false;
+ if (o.getRequestBody() != null) {
+ requiredBody = Boolean.TRUE == o.getRequestBody().getRequired();
+ }
+ if (requiredBody) {
+ String body = null;
+ if (exchange.getIn().getBody() != null) {
+ // okay we have a binding mode, so need to check for empty
body as that can cause the marshaller to fail
+ // as they assume a non-empty body
+ if (isXml || isJson) {
+ // we have binding enabled, so we need to know if there
body is empty or not
+ // so force reading the body as a String which we can work
with
+ body = MessageHelper.extractBodyAsString(exchange.getIn());
+ if (body != null) {
+ if (exchange.getIn() instanceof DataTypeAware) {
+ ((DataTypeAware) exchange.getIn()).setBody(body,
new DataType(isJson ? "json" : "xml"));
+ } else {
+ exchange.getIn().setBody(body);
+ }
+ if (isXml && isJson) {
+ // we have still not determined between xml or
json, so check the body if its xml based or not
+ isXml = body.startsWith("<");
+ isJson = !isXml;
+ }
+ }
+ }
+ }
+ // the body is required so we need to know if we have a body or not
+ // so force reading the body as a String which we can work with
+ if (body == null) {
+ body = MessageHelper.extractBodyAsString(exchange.getIn());
+ if (ObjectHelper.isNotEmpty(body)) {
+ exchange.getIn().setBody(body);
+ }
+ }
+ if (ObjectHelper.isEmpty(body)) {
+ // this is a bad request, the client did not include a message
body
+ exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE,
400);
+ exchange.getMessage().setBody("The request body is missing.");
+ // stop routing and return
+ exchange.setRouteStop(true);
+ callback.done(true);
+ return true;
+ }
+ }
+ Map<String, Parameter> requiredQueryParameters = null;
+ if (o.getParameters() != null) {
+ requiredQueryParameters = o.getParameters().stream()
+ .filter(p -> "query".equals(p.getIn()))
+ .filter(p -> Boolean.TRUE == p.getRequired())
+ .collect(Collectors.toMap(Parameter::getName,
Function.identity()));
+ }
+ if (requiredQueryParameters != null
+ &&
!exchange.getIn().getHeaders().keySet().containsAll(requiredQueryParameters.keySet()))
{
+ // this is a bad request, the client did not include some required
query parameters
+ exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 400);
+ exchange.getMessage().setBody("Some of the required query
parameters are missing.");
+ // stop routing and return
+ exchange.setRouteStop(true);
+ callback.done(true);
+ return true;
+ }
+ Map<String, Parameter> requiredHeaders = null;
+ if (o.getParameters() != null) {
+ requiredHeaders = o.getParameters().stream()
+ .filter(p -> "header".equals(p.getIn()))
+ .filter(p -> Boolean.TRUE == p.getRequired())
+ .collect(Collectors.toMap(Parameter::getName,
Function.identity()));
+ }
+ if (requiredHeaders != null &&
!exchange.getIn().getHeaders().keySet().containsAll(requiredHeaders.keySet())) {
+ // this is a bad request, the client did not include some required
http headers
+ exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 400);
+ exchange.getMessage().setBody("Some of the required HTTP headers
are missing.");
+ // stop routing and return
+ exchange.setRouteStop(true);
+ callback.done(true);
+ return true;
+ }
+ return false;
+ }
+
@Override
protected void doBuild() throws Exception {
super.doBuild();
diff --git
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json
index 2d064458544..f1292c7c300 100644
---
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json
+++
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json
@@ -17,8 +17,7 @@
"disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled",
"label": "advanced", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether to disable all the REST services
from the OpenAPI contract from the route during build time. Once an REST
service has been disabled then it cannot be enabled later at runtime." },
"specification": { "index": 3, "kind": "attribute", "displayName":
"Specification", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Path to the OpenApi specification file." },
"routeId": { "index": 4, "kind": "attribute", "displayName": "Route Id",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the id of the route" },
- "requestValidationEnabled": { "index": 5, "kind": "attribute",
"displayName": "Request Validation Enabled", "required": false, "type":
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether to
enable validation of the client request to check that the request contains
valid and expected data." },
- "missingOperation": { "index": 6, "kind": "attribute", "displayName":
"Missing Operation", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "fail", "description":
"Whether to fail, ignore or return a mock response for OpenAPI operations that
are not mapped to a corresponding route." },
- "mockIncludePattern": { "index": 7, "kind": "attribute", "displayName":
"Mock Include Pattern", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "classpath:camel-mock\/**",
"description": "Used for inclusive filtering of mock data from directories. The
pattern is using Ant-path style pattern. Multiple patterns can be specified
separated by comma." }
+ "missingOperation": { "index": 5, "kind": "attribute", "displayName":
"Missing Operation", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "fail", "description":
"Whether to fail, ignore or return a mock response for OpenAPI operations that
are not mapped to a corresponding route." },
+ "mockIncludePattern": { "index": 6, "kind": "attribute", "displayName":
"Mock Include Pattern", "label": "advanced", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "classpath:camel-mock\/**",
"description": "Used for inclusive filtering of mock data from directories. The
pattern is using Ant-path style pattern. Multiple patterns can be specified
separated by comma." }
}
}
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java
index 6579c6837e1..242026c18d5 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java
@@ -46,9 +46,6 @@ public class OpenApiDefinition extends
OptionalIdentifiedDefinition<OpenApiDefin
@Metadata(label = "advanced", javaType = "java.lang.Boolean")
private String disabled;
@XmlAttribute
- @Metadata(javaType = "java.lang.Boolean")
- private String requestValidationEnabled;
- @XmlAttribute
@Metadata(enums = "fail,ignore,mock", defaultValue = "fail")
private String missingOperation;
@XmlAttribute
@@ -97,17 +94,6 @@ public class OpenApiDefinition extends
OptionalIdentifiedDefinition<OpenApiDefin
this.disabled = disabled;
}
- public String getRequestValidationEnabled() {
- return requestValidationEnabled;
- }
-
- /**
- * Whether to enable validation of the client request to check that the
request contains valid and expected data.
- */
- public void setRequestValidationEnabled(String requestValidationEnabled) {
- this.requestValidationEnabled = requestValidationEnabled;
- }
-
public String getMissingOperation() {
return missingOperation;
}
@@ -163,29 +149,6 @@ public class OpenApiDefinition extends
OptionalIdentifiedDefinition<OpenApiDefin
return this;
}
- /**
- * Whether to enable validation of the client request to check that the
request contains valid and expected data.
- */
- public OpenApiDefinition requestValidationEnabled(String
requestValidationEnabled) {
- this.requestValidationEnabled = requestValidationEnabled;
- return this;
- }
-
- /**
- * Whether to enable validation of the client request to check that the
request contains valid and expected data.
- */
- public OpenApiDefinition requestValidationEnabled(boolean
requestValidationEnabled) {
- this.requestValidationEnabled = requestValidationEnabled ? "true" :
"false";
- return this;
- }
-
- /**
- * Whether to enable validation of the client request to check that the
request contains valid and expected data.
- */
- public OpenApiDefinition requestValidationEnabled() {
- return requestValidationEnabled(true);
- }
-
/**
* Whether to disable the OpenAPI entirely. Once the OpenAPI has been
disabled then it cannot be enabled later at
* runtime.
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 326e207d299..03a6ecfa264 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -869,7 +869,7 @@ public class RestDefinition extends
OptionalIdentifiedDefinition<RestDefinition>
}
if (openApi != null) {
addRouteDefinition(camelContext, openApi, answer,
config.getComponent(), config.getProducerComponent(),
- config.getApiContextPath());
+ config.getApiContextPath(),
config.isClientRequestValidation());
}
return answer;
@@ -970,7 +970,8 @@ public class RestDefinition extends
OptionalIdentifiedDefinition<RestDefinition>
@SuppressWarnings("rawtypes")
private void addRouteDefinition(
CamelContext camelContext, OpenApiDefinition openApi,
List<RouteDefinition> answer,
- String component, String producerComponent, String apiContextPath)
{
+ String component, String producerComponent, String apiContextPath,
+ boolean clientValidation) {
RouteDefinition route = new RouteDefinition();
if (openApi.getRouteId() != null) {
@@ -1008,8 +1009,10 @@ public class RestDefinition extends
OptionalIdentifiedDefinition<RestDefinition>
if (binding.getProduces() != null) {
options.put("produces", binding.getProduces());
}
- if (openApi.getRequestValidationEnabled() != null) {
- options.put("requestValidationEnabled",
openApi.getRequestValidationEnabled());
+ if (getClientRequestValidation() != null) {
+ options.put("clientRequestValidation",
getClientRequestValidation());
+ } else if (clientValidation) {
+ options.put("clientRequestValidation", "true");
}
if (openApi.getMissingOperation() != null) {
options.put("missingOperation", openApi.getMissingOperation());
diff --git
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RestBindingAdvice.java
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RestBindingAdvice.java
index e4beb3fadd0..0efcf7c0dae 100644
---
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RestBindingAdvice.java
+++
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RestBindingAdvice.java
@@ -36,10 +36,11 @@ import org.apache.camel.support.MessageHelper;
import org.apache.camel.support.processor.MarshalProcessor;
import org.apache.camel.support.processor.UnmarshalProcessor;
import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.StringHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static
org.apache.camel.support.http.RestUtil.isValidOrAcceptedContentType;
+
/**
* A {@link CamelInternalProcessorAdvice} that binds the REST DSL incoming and
outgoing messages from sources of json or
* xml to Java Objects.
@@ -584,38 +585,4 @@ public class RestBindingAdvice implements
CamelInternalProcessorAdvice<Map<Strin
}
}
- private static boolean isValidOrAcceptedContentType(String valid, String
target) {
- if (valid == null || target == null) {
- return true;
- }
-
- // Any MIME type
- //
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept#Directives
- if (target.contains("*/*")) {
- return true;
- }
-
- // content-type is before optional charset
- target = StringHelper.before(target, ";", target);
-
- valid = valid.toLowerCase(Locale.ENGLISH);
- target = target.toLowerCase(Locale.ENGLISH);
-
- if (valid.contains(target)) {
- return true;
- }
-
- boolean isXml = valid.contains("xml");
- if (isXml && !target.contains("xml")) {
- return false;
- }
-
- boolean isJson = valid.contains("json");
- if (isJson && !target.contains("json")) {
- return false;
- }
-
- return false;
- }
-
}
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/http/HttpUtil.java
b/core/camel-support/src/main/java/org/apache/camel/support/http/HttpUtil.java
index 67515da2842..48d687b7f83 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/http/HttpUtil.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/http/HttpUtil.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.camel.support.http;
import java.util.ArrayList;
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/http/RestUtil.java
b/core/camel-support/src/main/java/org/apache/camel/support/http/RestUtil.java
new file mode 100644
index 00000000000..e256770c9f2
--- /dev/null
+++
b/core/camel-support/src/main/java/org/apache/camel/support/http/RestUtil.java
@@ -0,0 +1,63 @@
+/*
+ * 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.support.http;
+
+import java.util.Locale;
+
+import org.apache.camel.util.StringHelper;
+
+public final class RestUtil {
+
+ /**
+ * Used for validating incoming REST calls whether Camel can process
according to consumes/produces and
+ * Accept/Content-Type headers.
+ */
+ public static boolean isValidOrAcceptedContentType(String valid, String
target) {
+ if (valid == null || target == null) {
+ return true;
+ }
+
+ // Any MIME type
+ //
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept#Directives
+ if (target.contains("*/*")) {
+ return true;
+ }
+
+ // content-type is before optional charset
+ target = StringHelper.before(target, ";", target);
+
+ valid = valid.toLowerCase(Locale.ENGLISH);
+ target = target.toLowerCase(Locale.ENGLISH);
+
+ if (valid.contains(target)) {
+ return true;
+ }
+
+ boolean isXml = valid.contains("xml");
+ if (isXml && !target.contains("xml")) {
+ return false;
+ }
+
+ boolean isJson = valid.contains("json");
+ if (isJson && !target.contains("json")) {
+ return false;
+ }
+
+ return false;
+ }
+
+}
diff --git
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 8482f81acde..aaefc3d2747 100644
---
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -3305,7 +3305,6 @@ public class ModelParser extends BaseParser {
case "disabled": def.setDisabled(val); break;
case "missingOperation": def.setMissingOperation(val); break;
case "mockIncludePattern": def.setMockIncludePattern(val);
break;
- case "requestValidationEnabled":
def.setRequestValidationEnabled(val); break;
case "routeId": def.setRouteId(val); break;
case "specification": def.setSpecification(val); break;
default: return
optionalIdentifiedDefinitionAttributeHandler().accept(def, key, val);
diff --git
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 3c7bc4cce1b..b2d94894bf5 100644
---
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -4424,7 +4424,6 @@ public class ModelWriter extends BaseWriter {
doWriteAttribute("routeId", def.getRouteId());
doWriteAttribute("specification", def.getSpecification());
doWriteAttribute("disabled", def.getDisabled());
- doWriteAttribute("requestValidationEnabled",
def.getRequestValidationEnabled());
doWriteElement("apiContextPath", def.getApiContextPath(),
this::doWriteString);
endElement(name);
}
diff --git
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
index 2228cd84047..eecb2246f2d 100644
---
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
+++
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
@@ -4424,7 +4424,6 @@ public class ModelWriter extends BaseWriter {
doWriteAttribute("routeId", def.getRouteId());
doWriteAttribute("specification", def.getSpecification());
doWriteAttribute("disabled", def.getDisabled());
- doWriteAttribute("requestValidationEnabled",
def.getRequestValidationEnabled());
doWriteElement("apiContextPath", def.getApiContextPath(),
this::doWriteString);
endElement(name);
}
diff --git
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RestOpenapiComponentBuilderFactory.java
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RestOpenapiComponentBuilderFactory.java
index 5d7fd6f6288..8af8ff7d58e 100644
---
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RestOpenapiComponentBuilderFactory.java
+++
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RestOpenapiComponentBuilderFactory.java
@@ -65,23 +65,6 @@ public interface RestOpenapiComponentBuilderFactory {
doSetProperty("basePath", basePath);
return this;
}
- /**
- * Enable validation of requests against the configured OpenAPI
- * specification.
- *
- * The option is a: <code>boolean</code> type.
- *
- * Default: false
- * Group: common
- *
- * @param requestValidationEnabled the value to set
- * @return the dsl builder
- */
- default RestOpenapiComponentBuilder requestValidationEnabled(
- boolean requestValidationEnabled) {
- doSetProperty("requestValidationEnabled",
requestValidationEnabled);
- return this;
- }
/**
* Path to the OpenApi specification file. The scheme, host base path
* are taken from this specification, but these can be overridden with
@@ -281,6 +264,23 @@ public interface RestOpenapiComponentBuilderFactory {
doSetProperty("lazyStartProducer", lazyStartProducer);
return this;
}
+ /**
+ * Enable validation of requests against the configured OpenAPI
+ * specification.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: producer
+ *
+ * @param requestValidationEnabled the value to set
+ * @return the dsl builder
+ */
+ default RestOpenapiComponentBuilder requestValidationEnabled(
+ boolean requestValidationEnabled) {
+ doSetProperty("requestValidationEnabled",
requestValidationEnabled);
+ return this;
+ }
/**
* Name of the Camel component that will perform the requests. The
* component must be present in Camel registry and it must implement
@@ -357,6 +357,23 @@ public interface RestOpenapiComponentBuilderFactory {
doSetProperty("autowiredEnabled", autowiredEnabled);
return this;
}
+ /**
+ * Whether to enable validation of the client request to check if the
+ * incoming request is valid according to the OpenAPI specification.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumes
+ *
+ * @param clientRequestValidation the value to set
+ * @return the dsl builder
+ */
+ default RestOpenapiComponentBuilder clientRequestValidation(
+ boolean clientRequestValidation) {
+ doSetProperty("clientRequestValidation", clientRequestValidation);
+ return this;
+ }
/**
* Customize TLS parameters used by the component. If not set defaults
* to the TLS parameters set in the Camel context.
@@ -408,7 +425,6 @@ public interface RestOpenapiComponentBuilderFactory {
Object value) {
switch (name) {
case "basePath": ((RestOpenApiComponent)
component).setBasePath((java.lang.String) value); return true;
- case "requestValidationEnabled": ((RestOpenApiComponent)
component).setRequestValidationEnabled((boolean) value); return true;
case "specificationUri": ((RestOpenApiComponent)
component).setSpecificationUri((java.lang.String) value); return true;
case "requestValidationCustomizer": ((RestOpenApiComponent)
component).setRequestValidationCustomizer((org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer)
value); return true;
case "apiContextPath": ((RestOpenApiComponent)
component).setApiContextPath((java.lang.String) value); return true;
@@ -419,10 +435,12 @@ public interface RestOpenapiComponentBuilderFactory {
case "restOpenapiProcessorStrategy": ((RestOpenApiComponent)
component).setRestOpenapiProcessorStrategy((org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy)
value); return true;
case "host": ((RestOpenApiComponent)
component).setHost((java.lang.String) value); return true;
case "lazyStartProducer": ((RestOpenApiComponent)
component).setLazyStartProducer((boolean) value); return true;
+ case "requestValidationEnabled": ((RestOpenApiComponent)
component).setRequestValidationEnabled((boolean) value); return true;
case "componentName": ((RestOpenApiComponent)
component).setComponentName((java.lang.String) value); return true;
case "consumes": ((RestOpenApiComponent)
component).setConsumes((java.lang.String) value); return true;
case "produces": ((RestOpenApiComponent)
component).setProduces((java.lang.String) value); return true;
case "autowiredEnabled": ((RestOpenApiComponent)
component).setAutowiredEnabled((boolean) value); return true;
+ case "clientRequestValidation": ((RestOpenApiComponent)
component).setClientRequestValidation((boolean) value); return true;
case "sslContextParameters": ((RestOpenApiComponent)
component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters)
value); return true;
case "useGlobalSslContextParameters": ((RestOpenApiComponent)
component).setUseGlobalSslContextParameters((boolean) value); return true;
default: return false;
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
index 64f42d8e8d1..4b1bf3a9a06 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
@@ -44,41 +44,6 @@ public interface RestOpenApiEndpointBuilderFactory {
default AdvancedRestOpenApiEndpointConsumerBuilder advanced() {
return (AdvancedRestOpenApiEndpointConsumerBuilder) this;
}
- /**
- * Enable validation of requests against the configured OpenAPI
- * specification.
- *
- * The option is a: <code>boolean</code> type.
- *
- * Default: false
- * Group: common
- *
- * @param requestValidationEnabled the value to set
- * @return the dsl builder
- */
- default RestOpenApiEndpointConsumerBuilder requestValidationEnabled(
- boolean requestValidationEnabled) {
- doSetProperty("requestValidationEnabled",
requestValidationEnabled);
- return this;
- }
- /**
- * Enable validation of requests against the configured OpenAPI
- * specification.
- *
- * The option will be converted to a <code>boolean</code>
- * type.
- *
- * Default: false
- * Group: common
- *
- * @param requestValidationEnabled the value to set
- * @return the dsl builder
- */
- default RestOpenApiEndpointConsumerBuilder requestValidationEnabled(
- String requestValidationEnabled) {
- doSetProperty("requestValidationEnabled",
requestValidationEnabled);
- return this;
- }
/**
* Sets the context-path to use for servicing the OpenAPI
specification.
*
@@ -111,6 +76,41 @@ public interface RestOpenApiEndpointBuilderFactory {
doSetProperty("missingOperation", missingOperation);
return this;
}
+ /**
+ * Whether to enable validation of the client request to check if the
+ * incoming request is valid according to the OpenAPI specification.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumes
+ *
+ * @param clientRequestValidation the value to set
+ * @return the dsl builder
+ */
+ default RestOpenApiEndpointConsumerBuilder clientRequestValidation(
+ boolean clientRequestValidation) {
+ doSetProperty("clientRequestValidation", clientRequestValidation);
+ return this;
+ }
+ /**
+ * Whether to enable validation of the client request to check if the
+ * incoming request is valid according to the OpenAPI specification.
+ *
+ * The option will be converted to a <code>boolean</code>
+ * type.
+ *
+ * Default: false
+ * Group: consumes
+ *
+ * @param clientRequestValidation the value to set
+ * @return the dsl builder
+ */
+ default RestOpenApiEndpointConsumerBuilder clientRequestValidation(
+ String clientRequestValidation) {
+ doSetProperty("clientRequestValidation", clientRequestValidation);
+ return this;
+ }
}
/**
@@ -409,41 +409,6 @@ public interface RestOpenApiEndpointBuilderFactory {
default AdvancedRestOpenApiEndpointProducerBuilder advanced() {
return (AdvancedRestOpenApiEndpointProducerBuilder) this;
}
- /**
- * Enable validation of requests against the configured OpenAPI
- * specification.
- *
- * The option is a: <code>boolean</code> type.
- *
- * Default: false
- * Group: common
- *
- * @param requestValidationEnabled the value to set
- * @return the dsl builder
- */
- default RestOpenApiEndpointProducerBuilder requestValidationEnabled(
- boolean requestValidationEnabled) {
- doSetProperty("requestValidationEnabled",
requestValidationEnabled);
- return this;
- }
- /**
- * Enable validation of requests against the configured OpenAPI
- * specification.
- *
- * The option will be converted to a <code>boolean</code>
- * type.
- *
- * Default: false
- * Group: common
- *
- * @param requestValidationEnabled the value to set
- * @return the dsl builder
- */
- default RestOpenApiEndpointProducerBuilder requestValidationEnabled(
- String requestValidationEnabled) {
- doSetProperty("requestValidationEnabled",
requestValidationEnabled);
- return this;
- }
/**
* API basePath, for example /v3. Default is unset, if set overrides
the
* value present in OpenApi specification and in the component
@@ -515,6 +480,76 @@ public interface RestOpenApiEndpointBuilderFactory {
doSetProperty("produces", produces);
return this;
}
+ /**
+ * Enable validation of requests against the configured OpenAPI
+ * specification.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: producer
+ *
+ * @param requestValidationEnabled the value to set
+ * @return the dsl builder
+ */
+ default RestOpenApiEndpointProducerBuilder requestValidationEnabled(
+ boolean requestValidationEnabled) {
+ doSetProperty("requestValidationEnabled",
requestValidationEnabled);
+ return this;
+ }
+ /**
+ * Enable validation of requests against the configured OpenAPI
+ * specification.
+ *
+ * The option will be converted to a <code>boolean</code>
+ * type.
+ *
+ * Default: false
+ * Group: producer
+ *
+ * @param requestValidationEnabled the value to set
+ * @return the dsl builder
+ */
+ default RestOpenApiEndpointProducerBuilder requestValidationEnabled(
+ String requestValidationEnabled) {
+ doSetProperty("requestValidationEnabled",
requestValidationEnabled);
+ return this;
+ }
+ /**
+ * Whether to enable validation of the client request to check if the
+ * incoming request is valid according to the OpenAPI specification.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumes
+ *
+ * @param clientRequestValidation the value to set
+ * @return the dsl builder
+ */
+ default RestOpenApiEndpointProducerBuilder clientRequestValidation(
+ boolean clientRequestValidation) {
+ doSetProperty("clientRequestValidation", clientRequestValidation);
+ return this;
+ }
+ /**
+ * Whether to enable validation of the client request to check if the
+ * incoming request is valid according to the OpenAPI specification.
+ *
+ * The option will be converted to a <code>boolean</code>
+ * type.
+ *
+ * Default: false
+ * Group: consumes
+ *
+ * @param clientRequestValidation the value to set
+ * @return the dsl builder
+ */
+ default RestOpenApiEndpointProducerBuilder clientRequestValidation(
+ String clientRequestValidation) {
+ doSetProperty("clientRequestValidation", clientRequestValidation);
+ return this;
+ }
}
/**
@@ -689,38 +724,38 @@ public interface RestOpenApiEndpointBuilderFactory {
return (AdvancedRestOpenApiEndpointBuilder) this;
}
/**
- * Enable validation of requests against the configured OpenAPI
- * specification.
+ * Whether to enable validation of the client request to check if the
+ * incoming request is valid according to the OpenAPI specification.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
- * Group: common
+ * Group: consumes
*
- * @param requestValidationEnabled the value to set
+ * @param clientRequestValidation the value to set
* @return the dsl builder
*/
- default RestOpenApiEndpointBuilder requestValidationEnabled(
- boolean requestValidationEnabled) {
- doSetProperty("requestValidationEnabled",
requestValidationEnabled);
+ default RestOpenApiEndpointBuilder clientRequestValidation(
+ boolean clientRequestValidation) {
+ doSetProperty("clientRequestValidation", clientRequestValidation);
return this;
}
/**
- * Enable validation of requests against the configured OpenAPI
- * specification.
+ * Whether to enable validation of the client request to check if the
+ * incoming request is valid according to the OpenAPI specification.
*
* The option will be converted to a <code>boolean</code>
* type.
*
* Default: false
- * Group: common
+ * Group: consumes
*
- * @param requestValidationEnabled the value to set
+ * @param clientRequestValidation the value to set
* @return the dsl builder
*/
- default RestOpenApiEndpointBuilder requestValidationEnabled(
- String requestValidationEnabled) {
- doSetProperty("requestValidationEnabled",
requestValidationEnabled);
+ default RestOpenApiEndpointBuilder clientRequestValidation(
+ String clientRequestValidation) {
+ doSetProperty("clientRequestValidation", clientRequestValidation);
return this;
}
}
diff --git
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
index 74e3bbd5f5c..606f3bc4a12 100644
---
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
+++
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
@@ -69,20 +69,6 @@ public class RestOpenapiUriDsl(
it.url("$specificationUri#$operationId")
}
- /**
- * Enable validation of requests against the configured OpenAPI specification
- */
- public fun requestValidationEnabled(requestValidationEnabled: String) {
- it.property("requestValidationEnabled", requestValidationEnabled)
- }
-
- /**
- * Enable validation of requests against the configured OpenAPI specification
- */
- public fun requestValidationEnabled(requestValidationEnabled: Boolean) {
- it.property("requestValidationEnabled",
requestValidationEnabled.toString())
- }
-
/**
* Sets the context-path to use for servicing the OpenAPI specification
*/
@@ -207,6 +193,20 @@ public class RestOpenapiUriDsl(
it.property("produces", produces)
}
+ /**
+ * Enable validation of requests against the configured OpenAPI specification
+ */
+ public fun requestValidationEnabled(requestValidationEnabled: String) {
+ it.property("requestValidationEnabled", requestValidationEnabled)
+ }
+
+ /**
+ * Enable validation of requests against the configured OpenAPI specification
+ */
+ public fun requestValidationEnabled(requestValidationEnabled: Boolean) {
+ it.property("requestValidationEnabled",
requestValidationEnabled.toString())
+ }
+
/**
* Name of the Camel component that will perform the requests. The component
must be present in
* Camel registry and it must implement RestProducerFactory service provider
interface. If not set
@@ -258,4 +258,20 @@ public class RestOpenapiUriDsl(
public fun requestValidationLevels(requestValidationLevels: String) {
it.property("requestValidationLevels", requestValidationLevels)
}
+
+ /**
+ * Whether to enable validation of the client request to check if the
incoming request is valid
+ * according to the OpenAPI specification
+ */
+ public fun clientRequestValidation(clientRequestValidation: String) {
+ it.property("clientRequestValidation", clientRequestValidation)
+ }
+
+ /**
+ * Whether to enable validation of the client request to check if the
incoming request is valid
+ * according to the OpenAPI specification
+ */
+ public fun clientRequestValidation(clientRequestValidation: Boolean) {
+ it.property("clientRequestValidation", clientRequestValidation.toString())
+ }
}
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index a987d4bdd4b..53d3374a1d2 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -10362,7 +10362,6 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
@YamlProperty(name = "id", type = "string", description =
"Sets the id of this node", displayName = "Id"),
@YamlProperty(name = "missingOperation", type =
"enum:fail,ignore,mock", defaultValue = "fail", description = "Whether to fail,
ignore or return a mock response for OpenAPI operations that are not mapped to
a corresponding route.", displayName = "Missing Operation"),
@YamlProperty(name = "mockIncludePattern", type =
"string", defaultValue = "classpath:camel-mock/**", description = "Used for
inclusive filtering of mock data from directories. The pattern is using
Ant-path style pattern. Multiple patterns can be specified separated by
comma.", displayName = "Mock Include Pattern"),
- @YamlProperty(name = "requestValidationEnabled", type =
"boolean", description = "Whether to enable validation of the client request to
check that the request contains valid and expected data.", displayName =
"Request Validation Enabled"),
@YamlProperty(name = "routeId", type = "string",
description = "Sets the id of the route", displayName = "Route Id"),
@YamlProperty(name = "specification", type = "string",
required = true, description = "Path to the OpenApi specification file.",
displayName = "Specification")
}
@@ -10397,11 +10396,6 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
target.setMockIncludePattern(val);
break;
}
- case "requestValidationEnabled": {
- String val = asText(node);
- target.setRequestValidationEnabled(val);
- break;
- }
case "routeId": {
String val = asText(node);
target.setRouteId(val);
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index c790de79194..e03199e5b61 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -14702,11 +14702,6 @@
"description" : "Used for inclusive filtering of mock data from
directories. The pattern is using Ant-path style pattern. Multiple patterns can
be specified separated by comma.",
"default" : "classpath:camel-mock/**"
},
- "requestValidationEnabled" : {
- "type" : "boolean",
- "title" : "Request Validation Enabled",
- "description" : "Whether to enable validation of the client
request to check that the request contains valid and expected data."
- },
"routeId" : {
"type" : "string",
"title" : "Route Id",