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

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

commit f76aaf6825e9e7b9fe5c588d4dd4198cfe1a32d9
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon Mar 25 14:18:14 2024 +0100

    CAMEL-20557: Rest DSL to use openapi spec directly
---
 .../camel/catalog/components/rest-openapi.json     | 30 +++++------
 .../openapi/RestOpenApiComponentConfigurer.java    |  4 +-
 .../camel/component/rest/openapi/rest-openapi.json | 30 +++++------
 .../src/main/docs/rest-openapi-component.adoc      |  2 +-
 .../rest/openapi/RestOpenApiComponent.java         | 44 ++++++++--------
 .../rest/openapi/RestOpenApiEndpoint.java          | 60 +++++++++-------------
 .../camel/component/rest/openapi/HttpsV3Test.java  |  3 +-
 .../rest/openapi/RestOpenApiComponentV3Test.java   |  6 ++-
 .../openapi/RestOpenApiComponentV3YamlTest.java    |  7 +--
 .../RestOpenApiCustomValidatorCustomizerTest.java  |  3 +-
 .../rest/openapi/RestOpenApiEndpointV3Test.java    |  8 ++-
 .../openapi/RestOpenApiRequestValidationTest.java  |  3 +-
 .../ROOT/pages/camel-4x-upgrade-guide-4_6.adoc     |  6 +++
 .../dsl/RestOpenapiComponentBuilderFactory.java    |  6 +--
 14 files changed, 99 insertions(+), 113 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 d6b3784e2d9..e4b0b0ac3fb 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
@@ -23,25 +23,25 @@
     "remote": true
   },
   "componentProperties": {
-    "requestValidationEnabled": { "index": 0, "kind": "property", 
"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" },
-    "bridgeErrorHandler": { "index": 1, "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": 2, "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": 3, "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 [...]
-    "restOpenapiProcessorStrategy": { "index": 4, "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" },
-    "basePath": { "index": 5, "kind": "property", "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 \/v2. Default is 
unset, if set overrides the value present in OpenApi specification." },
-    "host": { "index": 6, "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": 7, "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 fail [...]
-    "specificationUri": { "index": 8, "kind": "property", "displayName": 
"Specification Uri", "group": "producer", "label": "producer", "required": 
false, "type": "string", "javaType": "java.net.URI", "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  [...]
-    "componentName": { "index": 9, "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": 10, "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": 11, "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": 12, "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  [...]
-    "requestValidationCustomizer": { "index": 13, "kind": "property", 
"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 u [...]
+    "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 [...]
+    "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 [...]
+    "restOpenapiProcessorStrategy": { "index": 7, "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": 8, "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": 9, "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 fail [...]
+    "componentName": { "index": 10, "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": 11, "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": 12, "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": 13, "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": 14, "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": 15, "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.net.URI", "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 give [...]
+    "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" },
     "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." },
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 96dd8f657ec..ae6772faf9a 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
@@ -45,7 +45,7 @@ public class RestOpenApiComponentConfigurer extends 
PropertyConfigurerSupport im
         case "restopenapiprocessorstrategy":
         case "restOpenapiProcessorStrategy": 
target.setRestOpenapiProcessorStrategy(property(camelContext, 
org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy.class, 
value)); return true;
         case "specificationuri":
-        case "specificationUri": 
target.setSpecificationUri(property(camelContext, java.net.URI.class, value)); 
return true;
+        case "specificationUri": 
target.setSpecificationUri(property(camelContext, java.lang.String.class, 
value)); return true;
         case "sslcontextparameters":
         case "sslContextParameters": 
target.setSslContextParameters(property(camelContext, 
org.apache.camel.support.jsse.SSLContextParameters.class, value)); return true;
         case "useglobalsslcontextparameters":
@@ -81,7 +81,7 @@ public class RestOpenApiComponentConfigurer extends 
PropertyConfigurerSupport im
         case "restopenapiprocessorstrategy":
         case "restOpenapiProcessorStrategy": return 
org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy.class;
         case "specificationuri":
-        case "specificationUri": return java.net.URI.class;
+        case "specificationUri": return java.lang.String.class;
         case "sslcontextparameters":
         case "sslContextParameters": return 
org.apache.camel.support.jsse.SSLContextParameters.class;
         case "useglobalsslcontextparameters":
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 d6b3784e2d9..e4b0b0ac3fb 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
@@ -23,25 +23,25 @@
     "remote": true
   },
   "componentProperties": {
-    "requestValidationEnabled": { "index": 0, "kind": "property", 
"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" },
-    "bridgeErrorHandler": { "index": 1, "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": 2, "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": 3, "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 [...]
-    "restOpenapiProcessorStrategy": { "index": 4, "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" },
-    "basePath": { "index": 5, "kind": "property", "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 \/v2. Default is 
unset, if set overrides the value present in OpenApi specification." },
-    "host": { "index": 6, "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": 7, "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 fail [...]
-    "specificationUri": { "index": 8, "kind": "property", "displayName": 
"Specification Uri", "group": "producer", "label": "producer", "required": 
false, "type": "string", "javaType": "java.net.URI", "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  [...]
-    "componentName": { "index": 9, "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": 10, "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": 11, "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": 12, "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  [...]
-    "requestValidationCustomizer": { "index": 13, "kind": "property", 
"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 u [...]
+    "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 [...]
+    "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 [...]
+    "restOpenapiProcessorStrategy": { "index": 7, "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": 8, "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": 9, "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 fail [...]
+    "componentName": { "index": 10, "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": 11, "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": 12, "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": 13, "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": 14, "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": 15, "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.net.URI", "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 give [...]
+    "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" },
     "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." },
diff --git 
a/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc 
b/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc
index e521f8767d0..f650a421368 100644
--- a/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc
+++ b/components/camel-rest-openapi/src/main/docs/rest-openapi-component.adoc
@@ -147,7 +147,7 @@ Start by defining a _RestOpenApiComponent_ bean:
 @Bean
 public Component petstore(CamelContext camelContext) {
     RestOpenApiComponent petstore = new RestOpenApiComponent(camelContext);
-    petstore.setSpecificationUri(new 
URI("https://petstore3.swagger.io/api/v3/openapi.json";));
+    
petstore.setSpecificationUri("https://petstore3.swagger.io/api/v3/openapi.json";);
     petstore.setHost("https://petstore3.swagger.io";);
     return petstore;
 }
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 07dfb4556f1..05858566d23 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
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.rest.openapi;
 
-import java.net.URI;
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
@@ -33,7 +32,6 @@ import org.apache.camel.util.PropertiesHelper;
 
 import static 
org.apache.camel.component.rest.openapi.RestOpenApiHelper.isHostParam;
 import static 
org.apache.camel.component.rest.openapi.RestOpenApiHelper.isMediaRange;
-import static org.apache.camel.util.ObjectHelper.notNull;
 import static org.apache.camel.util.StringHelper.notEmpty;
 
 /**
@@ -82,12 +80,18 @@ public final class RestOpenApiComponent extends 
DefaultComponent implements SSLC
 
     public static final String DEFAULT_BASE_PATH = "/";
 
-    static final URI DEFAULT_SPECIFICATION_URI = 
URI.create(RestOpenApiComponent.DEFAULT_SPECIFICATION_URI_STR);
-
-    static final String DEFAULT_SPECIFICATION_URI_STR = "openapi.json";
+    static final String DEFAULT_SPECIFICATION_URI = "openapi.json";
 
+    @Metadata(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"
+                            + " given the component tries to load 
`openapi.json` resource. Note that the `host` defined on the"
+                            + " component and endpoint of this Component 
should contain the scheme, hostname and optionally the"
+                            + " port in the URI syntax (i.e. 
`https://api.example.com:8080`). Can be overridden in endpoint"
+                            + " configuration.",
+              defaultValue = DEFAULT_SPECIFICATION_URI, label = "common")
+    private String specificationUri;
     @Metadata(description = "API basePath, for example \"`/v2`\". Default is 
unset, if set overrides the value present in OpenApi specification.",
-              label = "producer")
+              label = "common")
     private String basePath = "";
     @Metadata(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"
@@ -120,30 +124,22 @@ 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(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"
-                            + " given the component tries to load 
`openapi.json` resource. Note that the `host` defined on the"
-                            + " component and endpoint of this Component 
should contain the scheme, hostname and optionally the"
-                            + " port in the URI syntax (i.e. 
`https://api.example.com:8080`). Can be overridden in endpoint"
-                            + " configuration.",
-              defaultValue = DEFAULT_SPECIFICATION_URI_STR, label = "producer")
-    private URI specificationUri;
-    @Metadata(description = "Enable validation of requests against the 
configured OpenAPI specification")
+    @Metadata(label = "common", 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.",
-              label = "advanced")
+              label = "common,advanced")
     private RequestValidationCustomizer requestValidationCustomizer = new 
DefaultRequestValidationCustomizer();
+    @Metadata(description = "Whether the consumer should fail,ignore or return 
a mock response for OpenAPI operations that are not mapped to a corresponding 
route.",
+              label = "consumer", enums = "fail,ignore,mock", defaultValue = 
"fail")
+    private String missingOperation;
+    @Metadata(description = "To use a custom strategy for how to process Rest 
DSL requests", label = "consumer,advanced")
+    private RestOpenapiProcessorStrategy restOpenapiProcessorStrategy = new 
DefaultRestOpenapiProcessorStrategy();
     @Metadata(description = "Enable usage of global SSL context parameters.", 
label = "security")
     private boolean useGlobalSslContextParameters;
     @Metadata(description = "Customize TLS parameters used by the component. 
If not set defaults to the TLS parameters set in the Camel context ",
               label = "security")
     private SSLContextParameters sslContextParameters;
-    @Metadata(description = "To use a custom strategy for how to process Rest 
DSL requests", label = "consumer,advanced")
-    private RestOpenapiProcessorStrategy restOpenapiProcessorStrategy = new 
DefaultRestOpenapiProcessorStrategy();
-    @Metadata(description = "Whether the consumer should fail,ignore or return 
a mock response for OpenAPI operations that are not mapped to a corresponding 
route.",
-              enums = "fail,ignore,mock", label = "consumer", defaultValue = 
"fail")
-    private String missingOperation;
 
     public RestOpenApiComponent() {
     }
@@ -189,7 +185,7 @@ public final class RestOpenApiComponent extends 
DefaultComponent implements SSLC
         return produces;
     }
 
-    public URI getSpecificationUri() {
+    public String getSpecificationUri() {
         return specificationUri;
     }
 
@@ -242,8 +238,8 @@ public final class RestOpenApiComponent extends 
DefaultComponent implements SSLC
         this.produces = isMediaRange(produces, "produces");
     }
 
-    public void setSpecificationUri(final URI specificationUri) {
-        this.specificationUri = notNull(specificationUri, "specificationUri");
+    public void setSpecificationUri(String specificationUri) {
+        this.specificationUri = specificationUri;
     }
 
     public void setSslContextParameters(final SSLContextParameters 
sslContextParameters) {
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 df8eeafa072..90cf95b83b5 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
@@ -150,9 +150,9 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
                            + " Support for https is limited to using the JDK 
installed UrlHandler, and as such it can be cumbersome to setup"
                            + " TLS/SSL certificates for https (such as setting 
a number of javax.net.ssl JVM system properties)."
                            + " How to do that consult the JDK documentation 
for UrlHandler.",
-             defaultValue = RestOpenApiComponent.DEFAULT_SPECIFICATION_URI_STR,
+             defaultValue = RestOpenApiComponent.DEFAULT_SPECIFICATION_URI,
              defaultValueNote = "By default loads `openapi.json` file", label 
= "common")
-    private URI specificationUri;
+    private String specificationUri;
     @UriParam(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"
@@ -181,11 +181,11 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
             operationId = after(remaining, "#");
             String spec = before(remaining, "#");
             if (spec != null && !spec.isEmpty()) {
-                specificationUri = URI.create(spec);
+                specificationUri = spec;
             }
         } else {
             if (remaining.endsWith(".json") || remaining.endsWith(".yaml") || 
remaining.endsWith(".yml")) {
-                specificationUri = URI.create(remaining);
+                specificationUri = remaining;
             } else {
                 operationId = remaining;
             }
@@ -376,7 +376,7 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
         return produces;
     }
 
-    public URI getSpecificationUri() {
+    public String getSpecificationUri() {
         return specificationUri;
     }
 
@@ -413,7 +413,7 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
         this.produces = produces;
     }
 
-    public void setSpecificationUri(final URI specificationUri) {
+    public void setSpecificationUri(String specificationUri) {
         this.specificationUri = specificationUri;
     }
 
@@ -676,7 +676,7 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
         URI relativeURI = null;
         Set<URI> operationURIs = getURIs(operation.getServers());
         // Check if at least one of them is absolute:
-        Optional<URI> opURI = operationURIs.stream().filter(uri -> 
uri.isAbsolute()).findFirst();
+        Optional<URI> opURI = 
operationURIs.stream().filter(URI::isAbsolute).findFirst();
         if (opURI.isEmpty()) {
             // look for absolute at api level + possible relative URI for the 
operation
             Set<URI> apiURIs = getURIs(openApi.getServers());
@@ -713,17 +713,18 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
             return globalConfigurationHost;
         }
 
-        final String specificationScheme = specificationUri.getScheme();
-        // Perform a case insensitive "startsWith" check that works for 
different locales
-        String prefix = "http";
-        if (specificationUri.isAbsolute() && 
specificationScheme.regionMatches(true, 0, prefix, 0, prefix.length())) {
-            try {
+        try {
+            final URI uri = new URI(specificationUri);
+            final String specificationScheme = uri.getScheme();
+            // Perform a case-insensitive "startsWith" check that works for 
different locales
+            String prefix = "http";
+            if (uri.isAbsolute() && specificationScheme.regionMatches(true, 0, 
prefix, 0, prefix.length())) {
                 return new URI(
-                        specificationUri.getScheme(), 
specificationUri.getUserInfo(), specificationUri.getHost(),
-                        specificationUri.getPort(), null, null, 
null).toString();
-            } catch (final URISyntaxException e) {
-                throw new IllegalStateException("Unable to create a new URI 
from: " + specificationUri, e);
+                        uri.getScheme(), uri.getUserInfo(), uri.getHost(),
+                        uri.getPort(), null, null, null).toString();
             }
+        } catch (Exception e) {
+            throw new IllegalStateException("Unable to create a new URI from: 
" + specificationUri, e);
         }
 
         throw new IllegalStateException(
@@ -916,23 +917,22 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
      * Loads the OpenApi definition model from the given path. This delegates 
directly to the OpenAPI parser. If the
      * specification can't be read there is no OpenAPI object in the result.
      *
-     * @param  uri          URI of the specification
+     * @param  uri          the specification uri
      * @param  camelContext context to use
      * @return              the specification
      */
-    static OpenAPI loadSpecificationFrom(final CamelContext camelContext, 
final URI uri) {
-        final String uriAsString = uri.toString();
+    static OpenAPI loadSpecificationFrom(final CamelContext camelContext, 
final String uri) {
         final OpenAPIParser openApiParser = new OpenAPIParser();
         final ParseOptions options = new ParseOptions();
         options.setResolveFully(true);
 
         File tmpFileToDelete = null;
         try {
-            Resource resource = 
ResourceHelper.resolveMandatoryResource(camelContext, uriAsString);
+            Resource resource = 
ResourceHelper.resolveMandatoryResource(camelContext, uri);
             //if location can not be used in Swagger API (e.g. in case of 
"bean;")
             // the content of the resource has to be copied into a tmp file 
for swagger API.
             String locationToSearch;
-            if ("bean:".equals(ResourceHelper.getScheme(uriAsString))) {
+            if ("bean:".equals(ResourceHelper.getScheme(uri))) {
                 Path tmpFile = Files.createTempFile(null, null);
                 tmpFileToDelete = tmpFile.toFile();
                 tmpFileToDelete.deleteOnExit();
@@ -945,32 +945,20 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
             final SwaggerParseResult openApi = 
openApiParser.readLocation(locationToSearch, null, options);
 
             if (openApi != null && openApi.getOpenAPI() != null) {
-                checkV2specification(openApi.getOpenAPI(), uri);
                 return openApi.getOpenAPI();
             }
         } catch (Exception e) {
             throw new IllegalArgumentException(
-                    "The given OpenApi specification could not be loaded from 
`" + uri + "`.", e);
+                    "The given OpenApi specification cannot be loaded from: " 
+ uri, e);
         } finally {
             if (tmpFileToDelete != null) {
                 FileUtil.deleteFile(tmpFileToDelete);
             }
         }
 
-        // In theory there should be a message in the parse result but it has 
disappeared...
+        // In theory there should be a message in the parse result, but it has 
disappeared...
         throw new IllegalArgumentException(
-                "The given OpenApi specification could not be loaded from `" + 
uri + "`.");
-    }
-
-    private static void checkV2specification(OpenAPI openAPI, final URI uri) {
-        if (openAPI.getExtensions() != null) {
-            Object swaggerVersion = 
openAPI.getExtensions().get("x-original-swagger-version");
-            if (swaggerVersion != null) {
-                LoggerFactory.getLogger(RestOpenApiEndpoint.class).info(
-                        "The specification {} was upgraded from {} to OpenAPI 
{}",
-                        uri, swaggerVersion, openAPI.getSpecVersion());
-            }
-        }
+                "The given OpenApi specification cannot be loaded from: " + 
uri);
     }
 
     static String pickBestScheme(final String specificationScheme, final 
List<String> schemes) {
diff --git 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java
 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java
index 3c2078401fe..e822a25b850 100644
--- 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java
+++ 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/HttpsV3Test.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.rest.openapi;
 
 import java.io.IOException;
 import java.net.HttpURLConnection;
-import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -123,7 +122,7 @@ public abstract class HttpsV3Test extends CamelTestSupport {
         final String host = "https://localhost:"; + petstore.httpsPort();
         component.setHost(host);
         // Workaround bug resolving relative references with file URLs in 
swagger parser
-        component.setSpecificationUri(new URI(host + getSpecName()));
+        component.setSpecificationUri(host + getSpecName());
         //        
component.setSpecificationUri(HttpsV3Test.class.getResource(getSpecName()).toURI());
         camelContext.addComponent("petStore", component);
 
diff --git 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3Test.java
 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3Test.java
index cf383bdc32f..b2632cbbcaf 100644
--- 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3Test.java
+++ 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3Test.java
@@ -25,6 +25,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 
 import jakarta.xml.bind.JAXBContext;
 import jakarta.xml.bind.Marshaller;
@@ -200,14 +201,15 @@ public class RestOpenApiComponentV3Test extends 
CamelTestSupport {
         final RestOpenApiComponent component = new RestOpenApiComponent();
         component.setComponentName(componentName);
         component.setHost("http://localhost:"; + petstore.port());
-        
component.setSpecificationUri(RestOpenApiComponentV3Test.class.getResource("/openapi-v3.json").toURI());
+        component.setSpecificationUri(
+                
Objects.requireNonNull(RestOpenApiComponentV3Test.class.getResource("/openapi-v3.json")).toString());
 
         camelContext.addComponent("petStore", component);
 
         final RestOpenApiComponent altPetStore = new RestOpenApiComponent();
         altPetStore.setComponentName(componentName);
         altPetStore.setHost("http://localhost:"; + petstore.port());
-        
altPetStore.setSpecificationUri(RestOpenApiComponentV3Test.class.getResource("/alt-openapi.json").toURI());
+        
altPetStore.setSpecificationUri(RestOpenApiComponentV3Test.class.getResource("/alt-openapi.json").toString());
 
         camelContext.addComponent("altPetStore", altPetStore);
 
diff --git 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3YamlTest.java
 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3YamlTest.java
index 0ae7fcd3775..38e9537907d 100644
--- 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3YamlTest.java
+++ 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiComponentV3YamlTest.java
@@ -200,14 +200,14 @@ public class RestOpenApiComponentV3YamlTest extends 
CamelTestSupport {
         final RestOpenApiComponent component = new RestOpenApiComponent();
         component.setComponentName(componentName);
         component.setHost("http://localhost:"; + petstore.port());
-        
component.setSpecificationUri(RestOpenApiComponentV3YamlTest.class.getResource("/openapi-v3.yaml").toURI());
+        
component.setSpecificationUri(RestOpenApiComponentV3YamlTest.class.getResource("/openapi-v3.yaml").toString());
 
         camelContext.addComponent("petStore", component);
 
         final RestOpenApiComponent altPetStore = new RestOpenApiComponent();
         altPetStore.setComponentName(componentName);
         altPetStore.setHost("http://localhost:"; + petstore.port());
-        
altPetStore.setSpecificationUri(RestOpenApiComponentV3YamlTest.class.getResource("/alt-openapi.yaml").toURI());
+        
altPetStore.setSpecificationUri(RestOpenApiComponentV3YamlTest.class.getResource("/alt-openapi.yaml").toString());
 
         camelContext.addComponent("altPetStore", altPetStore);
 
@@ -243,7 +243,8 @@ public class RestOpenApiComponentV3YamlTest extends 
CamelTestSupport {
     @BeforeAll
     public static void setupStubs() throws IOException, URISyntaxException {
         
petstore.stubFor(get(urlEqualTo("/openapi-v3.yaml")).willReturn(aResponse().withBody(
-                
Files.readAllBytes(Paths.get(RestOpenApiComponentV3YamlTest.class.getResource("/openapi-v3.yaml").toURI())))));
+                Files.readAllBytes(
+                        
Paths.get(RestOpenApiComponentV3YamlTest.class.getResource("/openapi-v3.yaml").getPath())))));
 
         petstore.stubFor(post(urlEqualTo("/api/v3/pet"))
                 .withRequestBody(equalTo(
diff --git 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiCustomValidatorCustomizerTest.java
 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiCustomValidatorCustomizerTest.java
index 07a300facf4..7371d4cca36 100644
--- 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiCustomValidatorCustomizerTest.java
+++ 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiCustomValidatorCustomizerTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.rest.openapi;
 
-import java.net.URI;
 import java.util.Set;
 
 import javax.annotation.Nonnull;
@@ -89,7 +88,7 @@ public class RestOpenApiCustomValidatorCustomizerTest extends 
CamelTestSupport {
         component.setComponentName("http");
         component.setConsumes("application/json");
         component.setProduces("application/json");
-        component.setSpecificationUri(URI.create("classpath:openapi-v3.json"));
+        component.setSpecificationUri("classpath:openapi-v3.json");
         component.setRequestValidationCustomizer(new 
CustomRequestValidationCustomizer("Test validation error from component"));
         camelContext.addComponent("petStore", component);
 
diff --git 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java
 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java
index 75276640e1f..1661583aea3 100644
--- 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java
+++ 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.rest.openapi;
 
-import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -51,9 +50,9 @@ import static org.mockito.Mockito.when;
 
 public class RestOpenApiEndpointV3Test {
 
-    URI componentJsonUri = URI.create("component.json");
+    String componentJsonUri = "component.json";
 
-    URI endpointUri = URI.create("endpoint.json");
+    String endpointUri = "endpoint.json";
 
     @Test
     public void shouldComplainForUnknownOperations() {
@@ -381,9 +380,8 @@ public class RestOpenApiEndpointV3Test {
         final CamelContext camelContext = mock(CamelContext.class);
         when(camelContext.getClassResolver()).thenReturn(new 
DefaultClassResolver());
 
-        final URI uri = URI.create("non-existant.json");
         assertThrows(IllegalArgumentException.class,
-                () -> RestOpenApiEndpoint.loadSpecificationFrom(camelContext, 
uri));
+                () -> RestOpenApiEndpoint.loadSpecificationFrom(camelContext, 
"non-existant.json"));
     }
 
     @Test
diff --git 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java
 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java
index cf2cf854e58..0ce95972885 100644
--- 
a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java
+++ 
b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiRequestValidationTest.java
@@ -22,7 +22,6 @@ import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.net.HttpURLConnection;
-import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.Iterator;
@@ -550,7 +549,7 @@ public class RestOpenApiRequestValidationTest extends 
CamelTestSupport {
     private RestOpenApiComponent createRestOpenApiComponent(String 
specificationUri) {
         RestOpenApiComponent component = new RestOpenApiComponent();
         component.setComponentName("http");
-        component.setSpecificationUri(URI.create("classpath:" + 
specificationUri));
+        component.setSpecificationUri("classpath:" + specificationUri);
         component.setConsumes("application/json");
         component.setProduces("application/json");
         component.setHost("http://localhost:"; + wireMockServer.port());
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc
index d297df9c99e..27d2fe89a48 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc
@@ -14,3 +14,9 @@ For example calling a route that fails due to an exception 
being thrown (even if
 then the variable is no longer set. Also, if the route is marked for rollback, 
or to stop continue routing with `.stop()`.
 
 This is the same logic that the routing engine uses, whether to continue 
routing the `Exchange` or not.
+
+=== camel-rest-openapi
+
+The `specifciationUri` in the `rest-api` component has changed from being a 
`java.net.URI` to a `String` type
+, as it uses Camels `ResourceLoader` to load from pluggable resources and also 
more tooling friendly.
+
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 064b5f66d51..a44a3419edd 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
@@ -217,8 +217,6 @@ public interface RestOpenapiComponentBuilderFactory {
          * syntax (i.e. https://api.example.com:8080). Can be overridden in
          * endpoint configuration.
          * 
-         * The option is a: &lt;code&gt;java.net.URI&lt;/code&gt; type.
-         * 
          * Default: openapi.json
          * Group: producer
          * 
@@ -226,7 +224,7 @@ public interface RestOpenapiComponentBuilderFactory {
          * @return the dsl builder
          */
         default RestOpenapiComponentBuilder specificationUri(
-                java.net.URI specificationUri) {
+                String specificationUri) {
             doSetProperty("specificationUri", specificationUri);
             return this;
         }
@@ -382,7 +380,7 @@ public interface RestOpenapiComponentBuilderFactory {
             case "basePath": ((RestOpenApiComponent) 
component).setBasePath((java.lang.String) value); return true;
             case "host": ((RestOpenApiComponent) 
component).setHost((java.lang.String) value); return true;
             case "lazyStartProducer": ((RestOpenApiComponent) 
component).setLazyStartProducer((boolean) value); return true;
-            case "specificationUri": ((RestOpenApiComponent) 
component).setSpecificationUri((java.net.URI) value); return true;
+            case "specificationUri": ((RestOpenApiComponent) 
component).setSpecificationUri((java.lang.String) 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;

Reply via email to