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

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

commit c5ea20ea46f76a754fe6e8f5640dde454a02d2a2
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Feb 27 14:25:04 2024 +0100

    CAMEL-20466: camel-core - Rest DSL to be inlined by default to avoid 
clutter up list of routes
---
 .../camel/catalog/main/camel-main-configuration-metadata.json    | 2 +-
 .../org/apache/camel/catalog/models/restConfiguration.json       | 2 +-
 .../resources/org/apache/camel/catalog/schemas/camel-spring.xsd  | 9 +++++----
 .../apache/camel/component/undertow/rest/RestManagementTest.java | 2 +-
 .../apache/camel/dsl/js/JavaScriptRoutesBuilderLoaderTest.java   | 3 ++-
 .../apache/camel/dsl/yaml/deserializers/ModelDeserializers.java  | 2 +-
 .../src/generated/resources/schema/camelYamlDsl.json             | 2 +-
 7 files changed, 12 insertions(+), 10 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index f1e51f670bf..f2f63e72a4a 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -228,7 +228,7 @@
     { "name": "camel.rest.endpointProperties", "description": "Sets additional 
options on endpoint level", "sourceType": 
"org.apache.camel.spi.RestConfiguration", "type": "object", "javaType": 
"java.util.Map" },
     { "name": "camel.rest.host", "description": "Sets the hostname to use by 
the REST consumer", "sourceType": "org.apache.camel.spi.RestConfiguration", 
"type": "string", "javaType": "java.lang.String" },
     { "name": "camel.rest.hostNameResolver", "description": "Sets the resolver 
to use for resolving hostname", "sourceType": 
"org.apache.camel.spi.RestConfiguration", "type": "object", "javaType": 
"org.apache.camel.spi.RestHostNameResolver", "defaultValue": 
"RestHostNameResolver.allLocalIp", "enum": [ "allLocalIp", "localIp", 
"localHostName" ] },
-    { "name": "camel.rest.inlineRoutes", "description": "Inline routes in 
rest-dsl which are linked using direct endpoints. By default, each service in 
Rest DSL is an individual route, meaning that you would have at least two 
routes per service (rest-dsl, and the route linked from rest-dsl). Enabling 
this allows Camel to optimize and inline this as a single route, however this 
requires to use direct endpoints, which must be unique per service. This option 
is default false.", "sourceType" [...]
+    { "name": "camel.rest.inlineRoutes", "description": "Inline routes in 
rest-dsl which are linked using direct endpoints. Each service in Rest DSL is 
an individual route, meaning that you would have at least two routes per 
service (rest-dsl, and the route linked from rest-dsl). By inlining (default) 
allows Camel to optimize and inline this as a single route, however this 
requires to use direct endpoints, which must be unique per service. If a route 
is not using direct endpoint then the [...]
     { "name": "camel.rest.jsonDataFormat", "description": "Sets a custom json 
data format to be used Important: This option is only for setting a custom name 
of the data format, not to refer to an existing data format instance.", 
"sourceType": "org.apache.camel.spi.RestConfiguration", "type": "string", 
"javaType": "java.lang.String" },
     { "name": "camel.rest.port", "description": "Sets the port to use by the 
REST consumer", "sourceType": "org.apache.camel.spi.RestConfiguration", "type": 
"integer", "javaType": "int" },
     { "name": "camel.rest.producerApiDoc", "description": "Sets the location 
of the api document (swagger api) the REST producer will use to validate the 
REST uri and query parameters are valid accordingly to the api document. This 
requires adding camel-openapi-java to the classpath, and any miss configuration 
will let Camel fail on startup and report the error(s). The location of the api 
document is loaded from classpath by default, but you can use file: or http: to 
refer to resources t [...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/restConfiguration.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/restConfiguration.json
index 400dbb21f9e..2fff84c90f0 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/restConfiguration.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/restConfiguration.json
@@ -31,7 +31,7 @@
     "clientRequestValidation": { "index": 16, "kind": "attribute", 
"displayName": "Client Request Validation", "label": "consumer,advanced", 
"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: 1) Content-Type header matches what the Rest DSL consumes; returns HTTP 
Status 415 if validation error. 2) Accept header m [...]
     "enableCORS": { "index": 17, "kind": "attribute", "displayName": "Enable 
CORS", "label": "consumer,advanced", "required": false, "type": "boolean", 
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Whether to enable CORS 
headers in the HTTP response. The default value is false." },
     "enableNoContentResponse": { "index": 18, "kind": "attribute", 
"displayName": "Enable No Content Response", "label": "consumer,advanced", 
"required": false, "type": "boolean", "javaType": "java.lang.Boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
false, "description": "Whether to return HTTP 204 with an empty body when a 
response contains an empty JSON object or XML root object. The default value is 
false." },
-    "inlineRoutes": { "index": 19, "kind": "attribute", "displayName": "Inline 
Routes", "label": "consumer", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Inline routes in rest-dsl which are 
linked using direct endpoints. By default, each service in Rest DSL is an 
individual route, meaning that you would have at least two routes per service 
(rest-dsl, and the route li [...]
+    "inlineRoutes": { "index": 19, "kind": "attribute", "displayName": "Inline 
Routes", "label": "consumer", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Inline routes in rest-dsl which are 
linked using direct endpoints. Each service in Rest DSL is an individual route, 
meaning that you would have at least two routes per service (rest-dsl, and the 
route linked from res [...]
     "jsonDataFormat": { "index": 20, "kind": "attribute", "displayName": "Json 
Data Format", "label": "advanced", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Name of specific json data format to use. By 
default jackson will be used. Important: This option is only for setting a 
custom name of the data format, not to refer to an existing data format 
instance." },
     "xmlDataFormat": { "index": 21, "kind": "attribute", "displayName": "Xml 
Data Format", "label": "advanced", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Name of specific XML data format to use. By 
default jaxb will be used. Important: This option is only for setting a custom 
name of the data format, not to refer to an existing data format instance." },
     "componentProperty": { "index": 22, "kind": "element", "displayName": 
"Component Property", "label": "advanced", "required": false, "type": "array", 
"javaType": 
"java.util.List<org.apache.camel.model.rest.RestPropertyDefinition>", 
"deprecated": false, "autowired": false, "secret": false, "description": 
"Allows to configure as many additional properties for the rest component in 
use." },
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 f8884754fdf..f3ad55422af 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
@@ -16760,10 +16760,11 @@ default value is false. Default value: false
       <xs:annotation>
         <xs:documentation xml:lang="en">
 <![CDATA[
-Inline routes in rest-dsl which are linked using direct endpoints. By default, 
each service in Rest DSL is an individual
-route, meaning that you would have at least two routes per service (rest-dsl, 
and the route linked from rest-dsl).
-Enabling this allows Camel to optimize and inline this as a single route, 
however this requires to use direct endpoints,
-which must be unique per service. This option is default false. Default value: 
false
+Inline routes in rest-dsl which are linked using direct endpoints. Each 
service in Rest DSL is an individual route,
+meaning that you would have at least two routes per service (rest-dsl, and the 
route linked from rest-dsl). By inlining
+(default) allows Camel to optimize and inline this as a single route, however 
this requires to use direct endpoints,
+which must be unique per service. If a route is not using direct endpoint then 
the rest-dsl is not inlined, and will
+become an individual route. This option is default true. Default value: true
 ]]>
         </xs:documentation>
       </xs:annotation>
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestManagementTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestManagementTest.java
index 961eb441eaa..853e5dfce9d 100644
--- 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestManagementTest.java
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestManagementTest.java
@@ -44,7 +44,7 @@ public class RestManagementTest extends BaseUndertowTest {
 
         Set<ObjectName> s = mbeanServer.queryNames(
                 new ObjectName("org.apache.camel:context=" + 
context.getManagementName() + ",type=endpoints,*"), null);
-        assertEquals(8, s.size(), "Could not find 8 endpoints: " + s);
+        assertEquals(6, s.size(), "Could not find 8 endpoints: " + s);
 
         // there should be 3 rest endpoints
         long count = s.stream().filter(p -> 
p.getCanonicalName().contains("rest")).count();
diff --git 
a/dsl/camel-js-dsl/src/test/java/org/apache/camel/dsl/js/JavaScriptRoutesBuilderLoaderTest.java
 
b/dsl/camel-js-dsl/src/test/java/org/apache/camel/dsl/js/JavaScriptRoutesBuilderLoaderTest.java
index b742ed8036a..3451e103669 100644
--- 
a/dsl/camel-js-dsl/src/test/java/org/apache/camel/dsl/js/JavaScriptRoutesBuilderLoaderTest.java
+++ 
b/dsl/camel-js-dsl/src/test/java/org/apache/camel/dsl/js/JavaScriptRoutesBuilderLoaderTest.java
@@ -112,7 +112,8 @@ public class JavaScriptRoutesBuilderLoaderTest {
             PluginHelper.getRoutesLoader(context).loadRoutes(resource);
 
             assertThat(context.getRestDefinitions()).hasSize(1);
-            assertThat(context.getRouteDefinitions()).hasSize(2);
+            // routes are inlined
+            assertThat(context.getRouteDefinitions()).hasSize(1);
 
             assertThat(context.getRestDefinitions()).first().satisfies(d -> {
                 assertThat(d.getProduces()).isEqualTo("text/plain");
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 1b1bea8114e..68306931efa 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
@@ -13802,7 +13802,7 @@ public final class ModelDeserializers extends 
YamlDeserializerSupport {
                     @YamlProperty(name = "endpointProperty", type = 
"array:org.apache.camel.model.rest.RestPropertyDefinition", description = 
"Allows to configure as many additional properties for the rest endpoint in 
use.", displayName = "Endpoint Property"),
                     @YamlProperty(name = "host", type = "string", description 
= "The hostname to use for exposing the REST service.", displayName = "Host"),
                     @YamlProperty(name = "hostNameResolver", type = 
"enum:allLocalIp,localHostName,localIp", defaultValue = "allLocalIp", 
description = "If no hostname has been explicit configured, then this resolver 
is used to compute the hostname the REST service will be using.", displayName = 
"Host Name Resolver"),
-                    @YamlProperty(name = "inlineRoutes", type = "boolean", 
description = "Inline routes in rest-dsl which are linked using direct 
endpoints. By default, each service in Rest DSL is an individual route, meaning 
that you would have at least two routes per service (rest-dsl, and the route 
linked from rest-dsl). Enabling this allows Camel to optimize and inline this 
as a single route, however this requires to use direct endpoints, which must be 
unique per service. This option [...]
+                    @YamlProperty(name = "inlineRoutes", type = "boolean", 
description = "Inline routes in rest-dsl which are linked using direct 
endpoints. Each service in Rest DSL is an individual route, meaning that you 
would have at least two routes per service (rest-dsl, and the route linked from 
rest-dsl). By inlining (default) allows Camel to optimize and inline this as a 
single route, however this requires to use direct endpoints, which must be 
unique per service. If a route is n [...]
                     @YamlProperty(name = "jsonDataFormat", type = "string", 
description = "Name of specific json data format to use. By default jackson 
will be used. Important: This option is only for setting a custom name of the 
data format, not to refer to an existing data format instance.", displayName = 
"Json Data Format"),
                     @YamlProperty(name = "port", type = "string", description 
= "The port number to use for exposing the REST service. Notice if you use 
servlet component then the port number configured here does not apply, as the 
port number in use is the actual port number the servlet component is using. eg 
if using Apache Tomcat its the tomcat http port, if using Apache Karaf its the 
HTTP service in Karaf that uses port 8181 by default etc. Though in those 
situations setting the port  [...]
                     @YamlProperty(name = "producerApiDoc", type = "string", 
description = "Sets the location of the api document the REST producer will use 
to validate the REST uri and query parameters are valid accordingly to the api 
document. The location of the api document is loaded from classpath by default, 
but you can use file: or http: to refer to resources to load from file or http 
url.", displayName = "Producer Api Doc"),
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 126d3f1404f..3533326fdc1 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
@@ -15301,7 +15301,7 @@
           "inlineRoutes" : {
             "type" : "boolean",
             "title" : "Inline Routes",
-            "description" : "Inline routes in rest-dsl which are linked using 
direct endpoints. By default, each service in Rest DSL is an individual route, 
meaning that you would have at least two routes per service (rest-dsl, and the 
route linked from rest-dsl). Enabling this allows Camel to optimize and inline 
this as a single route, however this requires to use direct endpoints, which 
must be unique per service. This option is default false."
+            "description" : "Inline routes in rest-dsl which are linked using 
direct endpoints. Each service in Rest DSL is an individual route, meaning that 
you would have at least two routes per service (rest-dsl, and the route linked 
from rest-dsl). By inlining (default) allows Camel to optimize and inline this 
as a single route, however this requires to use direct endpoints, which must be 
unique per service. If a route is not using direct endpoint then the rest-dsl 
is not inlined, an [...]
           },
           "jsonDataFormat" : {
             "type" : "string",

Reply via email to