You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/11/23 06:45:09 UTC

[camel] branch main updated (ad7a9cd3601 -> 2096e03aef6)

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

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


    from ad7a9cd3601 Revert "CAMEL-18707: Upgrade to Jandex 3.0.3 (#8735)"
     new 2f14ff941fa CAMEL-18628: REST DSL: Add option to disable REST endpoints.
     new 4dd276c164d CAMEL-18628: REST DSL: Add option to disable REST endpoints.
     new 2096e03aef6 polished

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/camel/catalog/models/delete.json    |  1 +
 .../org/apache/camel/catalog/models/get.json       |  1 +
 .../org/apache/camel/catalog/models/head.json      |  1 +
 .../org/apache/camel/catalog/models/patch.json     |  1 +
 .../org/apache/camel/catalog/models/post.json      |  1 +
 .../org/apache/camel/catalog/models/put.json       |  1 +
 .../org/apache/camel/catalog/models/rest.json      |  1 +
 .../apache/camel/catalog/schemas/camel-spring.xsd  | 24 +++++++
 .../apache/camel/openapi/RestOpenApiReader.java    | 15 +++-
 ...est.java => RestOpenApiReaderDisabledTest.java} | 39 +++++-----
 .../apache/camel/swagger/RestSwaggerReader.java    | 19 ++++-
 ...est.java => RestSwaggerReaderDisabledTest.java} | 28 ++++----
 .../apache/camel/spi/RestApiProcessorFactory.java  |  4 +-
 .../org/apache/camel/spi/RestConfiguration.java    |  5 +-
 .../java/org/apache/camel/spi/RestRegistry.java    |  5 +-
 .../org/apache/camel/model/rest/delete.json        |  1 +
 .../resources/org/apache/camel/model/rest/get.json |  1 +
 .../org/apache/camel/model/rest/head.json          |  1 +
 .../org/apache/camel/model/rest/patch.json         |  1 +
 .../org/apache/camel/model/rest/post.json          |  1 +
 .../resources/org/apache/camel/model/rest/put.json |  1 +
 .../org/apache/camel/model/rest/rest.json          |  1 +
 .../apache/camel/model/rest/RestDefinition.java    | 84 +++++++++++++++++++---
 .../apache/camel/model/rest/VerbDefinition.java    | 17 ++++-
 ...ptionTest.java => FromRestDisabledAllTest.java} | 26 +++----
 ...nterceptTest.java => FromRestDisabledTest.java} | 30 ++++----
 .../camel-main-configuration-metadata.json         |  2 +-
 core/camel-main/src/main/docs/main.adoc            |  2 +-
 .../camel/main/RestConfigurationProperties.java    |  5 +-
 .../management/mbean/ManagedRestRegistryMBean.java |  2 +-
 .../camel/management/ManagedRestRegistryTest.java  |  2 +-
 .../java/org/apache/camel/xml/in/ModelParser.java  |  2 +
 docs/user-manual/modules/ROOT/pages/rest-dsl.adoc  | 36 ++++++++++
 .../dsl/yaml/deserializers/ModelDeserializers.java | 42 +++++++++++
 .../generated/resources/schema/camel-yaml-dsl.json | 21 ++++++
 .../generated/resources/schema/camelYamlDsl.json   | 21 ++++++
 36 files changed, 354 insertions(+), 91 deletions(-)
 copy components/camel-openapi-java/src/test/java/org/apache/camel/openapi/{RestOpenApiReaderContextPathTest.java => RestOpenApiReaderDisabledTest.java} (82%)
 copy components/camel-swagger-java/src/test/java/org/apache/camel/swagger/{RestSwaggerReaderTest.java => RestSwaggerReaderDisabledTest.java} (81%)
 copy core/camel-core/src/test/java/org/apache/camel/component/rest/{FromRestGetOnExceptionTest.java => FromRestDisabledAllTest.java} (68%)
 copy core/camel-core/src/test/java/org/apache/camel/component/rest/{FromRestGetInterceptTest.java => FromRestDisabledTest.java} (65%)


[camel] 02/03: CAMEL-18628: REST DSL: Add option to disable REST endpoints.

Posted by da...@apache.org.
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

commit 4dd276c164d6019a495e93d155c405b67c4ba892
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Nov 23 07:37:26 2022 +0100

    CAMEL-18628: REST DSL: Add option to disable REST endpoints.
---
 .../apache/camel/openapi/RestOpenApiReader.java    |  15 +-
 .../openapi/RestOpenApiReaderDisabledTest.java     | 151 +++++++++++++++++++++
 .../apache/camel/swagger/RestSwaggerReader.java    |  19 ++-
 .../swagger/RestSwaggerReaderDisabledTest.java     | 106 +++++++++++++++
 4 files changed, 286 insertions(+), 5 deletions(-)

diff --git a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
index c9f259abc5e..767bb043a6f 100644
--- a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
+++ b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
@@ -157,7 +157,10 @@ public class RestOpenApiReader {
         }
 
         for (RestDefinition rest : rests) {
-            parse(camelContext, openApi, rest, camelContextId, classResolver);
+            Boolean disabled = CamelContextHelper.parseBoolean(camelContext, rest.getDisabled());
+            if (disabled == null || !disabled) {
+                parse(camelContext, openApi, rest, camelContextId, classResolver);
+            }
         }
 
         shortenClassNames(openApi);
@@ -191,7 +194,15 @@ public class RestOpenApiReader {
             ClassResolver classResolver)
             throws ClassNotFoundException {
 
-        List<VerbDefinition> verbs = new ArrayList<>(rest.getVerbs());
+        // only include enabled verbs
+        List<VerbDefinition> filter = new ArrayList<>();
+        for (VerbDefinition verb : rest.getVerbs()) {
+            Boolean disabled = CamelContextHelper.parseBoolean(camelContext, verb.getDisabled());
+            if (disabled == null || !disabled) {
+                filter.add(verb);
+            }
+        }
+        List<VerbDefinition> verbs = new ArrayList<>(filter);
         // must sort the verbs by uri so we group them together when an uri has multiple operations
         verbs.sort(new VerbOrdering(camelContext));
 
diff --git a/components/camel-openapi-java/src/test/java/org/apache/camel/openapi/RestOpenApiReaderDisabledTest.java b/components/camel-openapi-java/src/test/java/org/apache/camel/openapi/RestOpenApiReaderDisabledTest.java
new file mode 100644
index 00000000000..38b16c86903
--- /dev/null
+++ b/components/camel-openapi-java/src/test/java/org/apache/camel/openapi/RestOpenApiReaderDisabledTest.java
@@ -0,0 +1,151 @@
+/*
+ * 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.openapi;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import io.apicurio.datamodels.Library;
+import io.apicurio.datamodels.openapi.models.OasDocument;
+import io.apicurio.datamodels.openapi.v2.models.Oas20Info;
+import io.apicurio.datamodels.openapi.v3.models.Oas30Info;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.engine.DefaultClassResolver;
+import org.apache.camel.model.rest.RestParamType;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class RestOpenApiReaderDisabledTest extends CamelTestSupport {
+
+    private Logger log = LoggerFactory.getLogger(getClass());
+
+    @BindToRegistry("dummy-rest")
+    private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                rest("/hello").consumes("application/json").produces("application/json").get("/hi/{name}")
+                        .description("Saying hi").param().name("name").type(RestParamType.path)
+                        .dataType("string").description("Who is it").example("Donald Duck").endParam()
+                        .param().name("filter").description("Filters to apply to the entity.").type(RestParamType.query)
+                        .dataType("array").arrayType("date-time").endParam().to("log:hi")
+                        .get("/bye/{name}").disabled().description("Saying bye").param().name("name")
+                        .type(RestParamType.path).dataType("string").description("Who is it").example("Donald Duck").endParam()
+                        .responseMessage().code(200).message("A reply number")
+                        .responseModel(float.class).example("success", "123").example("error", "-1").endResponseMessage()
+                        .to("log:bye").post("/bye").disabled("true")
+                        .description("To update the greeting message").consumes("application/xml").produces("application/xml")
+                        .param().name("greeting").type(RestParamType.body)
+                        .dataType("string").description("Message to use as greeting")
+                        .example("application/xml", "<hello>Hi</hello>").endParam().to("log:bye");
+            }
+        };
+    }
+
+    @Test
+    public void testReaderRead() throws Exception {
+        BeanConfig config = new BeanConfig();
+        config.setHost("localhost:8080");
+        config.setSchemes(new String[] { "http" });
+        config.setBasePath("/api");
+        Oas20Info info = new Oas20Info();
+        config.setInfo(info);
+        config.setVersion("2.0");
+        RestOpenApiReader reader = new RestOpenApiReader();
+
+        OasDocument openApi = reader.read(context, context.getRestDefinitions(), config, context.getName(),
+                new DefaultClassResolver());
+        assertNotNull(openApi);
+
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.enable(SerializationFeature.INDENT_OUTPUT);
+        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+        Object dump = Library.writeNode(openApi);
+        String json = mapper.writeValueAsString(dump);
+
+        log.info(json);
+
+        assertTrue(json.contains("\"host\" : \"localhost:8080\""));
+        assertTrue(json.contains("\"basePath\" : \"/api\""));
+        assertFalse(json.contains("\"/hello/bye\""));
+        assertFalse(json.contains("\"summary\" : \"To update the greeting message\""));
+        assertFalse(json.contains("\"/hello/bye/{name}\""));
+        assertFalse(json.contains("\"/api/hello/bye/{name}\""));
+        assertTrue(json.contains("\"/hello/hi/{name}\""));
+        assertFalse(json.contains("\"/api/hello/hi/{name}\""));
+        assertFalse(json.contains("\"type\" : \"number\""));
+        assertFalse(json.contains("\"format\" : \"float\""));
+        assertFalse(json.contains("\"application/xml\" : \"<hello>Hi</hello>\""));
+        assertTrue(json.contains("\"x-example\" : \"Donald Duck\""));
+        assertFalse(json.contains("\"success\" : \"123\""));
+        assertFalse(json.contains("\"error\" : \"-1\""));
+        assertTrue(json.contains("\"type\" : \"array\""));
+
+        context.stop();
+    }
+
+    @Test
+    public void testReaderReadV3() throws Exception {
+        BeanConfig config = new BeanConfig();
+        config.setHost("localhost:8080");
+        config.setSchemes(new String[] { "http" });
+        config.setBasePath("/api");
+        Oas30Info info = new Oas30Info();
+        config.setInfo(info);
+        RestOpenApiReader reader = new RestOpenApiReader();
+
+        OasDocument openApi = reader.read(context, context.getRestDefinitions(), config, context.getName(),
+                new DefaultClassResolver());
+        assertNotNull(openApi);
+
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.enable(SerializationFeature.INDENT_OUTPUT);
+        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+        Object dump = Library.writeNode(openApi);
+        String json = mapper.writeValueAsString(dump);
+
+        log.info(json);
+
+        assertTrue(json.contains("\"url\" : \"http://localhost:8080/api\""));
+        assertFalse(json.contains("\"/hello/bye\""));
+        assertFalse(json.contains("\"summary\" : \"To update the greeting message\""));
+        assertFalse(json.contains("\"/hello/bye/{name}\""));
+        assertFalse(json.contains("\"/api/hello/bye/{name}\""));
+        assertTrue(json.contains("\"/hello/hi/{name}\""));
+        assertFalse(json.contains("\"/api/hello/hi/{name}\""));
+        assertFalse(json.contains("\"type\" : \"number\""));
+        assertFalse(json.contains("\"format\" : \"float\""));
+        assertFalse(json.contains("\"application/xml\" : \"<hello>Hi</hello>\""));
+        assertTrue(json.contains("\"x-example\" : \"Donald Duck\""));
+        assertFalse(json.contains("\"success\" : \"123\""));
+        assertFalse(json.contains("\"error\" : \"-1\""));
+        assertTrue(json.contains("\"type\" : \"array\""));
+
+        context.stop();
+    }
+
+}
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
index 0a4e6389fb8..5de65ccde4b 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
@@ -74,6 +74,7 @@ import org.apache.camel.model.rest.RestSecurityDefinition;
 import org.apache.camel.model.rest.SecurityDefinition;
 import org.apache.camel.model.rest.VerbDefinition;
 import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.ObjectHelper;
 import org.apache.camel.util.FileUtil;
 
@@ -94,7 +95,7 @@ public class RestSwaggerReader {
      * @param  config                 the swagger configuration
      * @param  classResolver          class resolver to use
      * @return                        the swagger model
-     * @throws ClassNotFoundException
+     * @throws ClassNotFoundException is thrown if error loading class
      */
     public Swagger read(
             CamelContext camelContext,
@@ -103,7 +104,10 @@ public class RestSwaggerReader {
         Swagger swagger = new Swagger();
 
         for (RestDefinition rest : rests) {
-            parse(camelContext, swagger, rest, camelContextId, classResolver);
+            Boolean disabled = CamelContextHelper.parseBoolean(camelContext, rest.getDisabled());
+            if (disabled == null || !disabled) {
+                parse(camelContext, swagger, rest, camelContextId, classResolver);
+            }
         }
 
         // configure before returning
@@ -114,7 +118,16 @@ public class RestSwaggerReader {
     private void parse(
             CamelContext camelContext, Swagger swagger, RestDefinition rest, String camelContextId, ClassResolver classResolver)
             throws ClassNotFoundException {
-        List<VerbDefinition> verbs = new ArrayList<>(rest.getVerbs());
+
+        // only include enabled verbs
+        List<VerbDefinition> filter = new ArrayList<>();
+        for (VerbDefinition verb : rest.getVerbs()) {
+            Boolean disabled = CamelContextHelper.parseBoolean(camelContext, verb.getDisabled());
+            if (disabled == null || !disabled) {
+                filter.add(verb);
+            }
+        }
+        List<VerbDefinition> verbs = new ArrayList<>(filter);
         // must sort the verbs by uri so we group them together when an uri has multiple operations
         verbs.sort(new VerbOrdering());
 
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderDisabledTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderDisabledTest.java
new file mode 100644
index 00000000000..5332f2811e6
--- /dev/null
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderDisabledTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.swagger;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import io.swagger.jaxrs.config.BeanConfig;
+import io.swagger.models.Swagger;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.engine.DefaultClassResolver;
+import org.apache.camel.model.rest.RestParamType;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class RestSwaggerReaderDisabledTest extends CamelTestSupport {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderDisabledTest.class);
+
+    @BindToRegistry("dummy-rest")
+    private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                rest("/hello").consumes("application/json").produces("application/json").get("/hi/{name}")
+                    .description("Saying hi").deprecated().param().name("name").type(RestParamType.path)
+                    .dataType("string").description("Who is it").example("Donald Duck").endParam().to("log:hi")
+                    .get("/bye/{name}").disabled().description("Saying bye").deprecated().param().name("name")
+                    .type(RestParamType.path).dataType("string").description("Who is it").example("Donald Duck").endParam()
+                    .responseMessage().code(200).message("A reply number")
+                    .responseModel(float.class).example("success", "123").example("error", "-1").endResponseMessage()
+                    .to("log:bye").post("/bye").disabled("true")
+                    .description("To update the greeting message").consumes("application/xml").produces("application/xml")
+                    .param().name("greeting").type(RestParamType.body)
+                    .dataType("string").description("Message to use as greeting")
+                    .example("application/xml", "<hello>Hi</hello>").endParam().to("log:bye");
+            }
+        };
+    }
+
+    @Test
+    public void testReaderRead() throws Exception {
+        BeanConfig config = new BeanConfig();
+        config.setHost("localhost:8080");
+        config.setSchemes(new String[] { "http" });
+        config.setBasePath("/api");
+        RestSwaggerReader reader = new RestSwaggerReader();
+
+        Swagger swagger
+                = reader.read(context, context.getRestDefinitions(), config, context.getName(), new DefaultClassResolver());
+        assertNotNull(swagger);
+
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.enable(SerializationFeature.INDENT_OUTPUT);
+        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+        String json = mapper.writeValueAsString(swagger);
+
+        LOG.info(json);
+
+        assertTrue(json.contains("\"host\" : \"localhost:8080\""));
+        assertTrue(json.contains("\"basePath\" : \"/api\""));
+        assertFalse(json.contains("\"/hello/bye\""));
+        assertFalse(json.contains("\"summary\" : \"To update the greeting message\""));
+        assertFalse(json.contains("\"/hello/bye/{name}\""));
+        assertTrue(json.contains("\"/hello/hi/{name}\""));
+        assertFalse(json.contains("\"type\" : \"number\""));
+        assertFalse(json.contains("\"format\" : \"float\""));
+        assertFalse(json.contains("\"application/xml\" : \"<hello>Hi</hello>\""));
+        assertTrue(json.contains("\"x-example\" : \"Donald Duck\""));
+        assertFalse(json.contains("\"success\" : \"123\""));
+        assertFalse(json.contains("\"error\" : \"-1\""));
+        assertTrue(json.contains("\"type\" : \"string\""));
+        assertTrue(json.contains("\"deprecated\" : true"));
+
+        JsonNode jsonNode = new ObjectMapper().readValue(json, JsonNode.class);
+        assertNotNull(jsonNode.get("paths").get("/hello/hi/{name}").get("get").get("deprecated"));
+        assertTrue(jsonNode.get("paths").get("/hello/hi/{name}").get("get").get("deprecated").asBoolean());
+
+        context.stop();
+    }
+}


[camel] 01/03: CAMEL-18628: REST DSL: Add option to disable REST endpoints.

Posted by da...@apache.org.
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

commit 2f14ff941faf27e51652e999e34dc486555f2c2c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Nov 22 13:03:07 2022 +0100

    CAMEL-18628: REST DSL: Add option to disable REST endpoints.
---
 .../org/apache/camel/catalog/models/delete.json    |  1 +
 .../org/apache/camel/catalog/models/get.json       |  1 +
 .../org/apache/camel/catalog/models/head.json      |  1 +
 .../org/apache/camel/catalog/models/patch.json     |  1 +
 .../org/apache/camel/catalog/models/post.json      |  1 +
 .../org/apache/camel/catalog/models/put.json       |  1 +
 .../org/apache/camel/catalog/models/rest.json      |  1 +
 .../apache/camel/catalog/schemas/camel-spring.xsd  | 24 +++++++
 .../org/apache/camel/model/rest/delete.json        |  1 +
 .../resources/org/apache/camel/model/rest/get.json |  1 +
 .../org/apache/camel/model/rest/head.json          |  1 +
 .../org/apache/camel/model/rest/patch.json         |  1 +
 .../org/apache/camel/model/rest/post.json          |  1 +
 .../resources/org/apache/camel/model/rest/put.json |  1 +
 .../org/apache/camel/model/rest/rest.json          |  1 +
 .../apache/camel/model/rest/RestDefinition.java    | 84 +++++++++++++++++++---
 .../apache/camel/model/rest/VerbDefinition.java    | 17 ++++-
 .../component/rest/FromRestDisabledAllTest.java    | 60 ++++++++++++++++
 .../camel/component/rest/FromRestDisabledTest.java | 62 ++++++++++++++++
 .../java/org/apache/camel/xml/in/ModelParser.java  |  2 +
 docs/user-manual/modules/ROOT/pages/rest-dsl.adoc  | 36 ++++++++++
 .../dsl/yaml/deserializers/ModelDeserializers.java | 42 +++++++++++
 .../generated/resources/schema/camel-yaml-dsl.json | 21 ++++++
 .../generated/resources/schema/camelYamlDsl.json   | 21 ++++++
 24 files changed, 372 insertions(+), 11 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/delete.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/delete.json
index 66f60b9b4e2..b5d8e1b317b 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/delete.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/delete.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/get.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/get.json
index 366df91903a..362baa2836f 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/get.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/get.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/head.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/head.json
index af317c58e3d..dd1cea15080 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/head.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/head.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/patch.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/patch.json
index c013951b98f..ad2510f50cc 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/patch.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/patch.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/post.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/post.json
index 8dbaaa36c1e..bcb41b6a890 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/post.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/post.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/put.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/put.json
index 728d0d886f6..c3704027850 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/put.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/put.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/rest.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/rest.json
index 7f5f3afd5ef..de761541a56 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/rest.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/rest.json
@@ -15,6 +15,7 @@
     "path": { "kind": "attribute", "displayName": "Path", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path of the rest service, such as \/foo" },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is auto" },
     "skipBindingOnErrorCode": { "kind": "attribute", "displayName": "Skip Binding On Error Code", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip binding on output if there is a custom HTTP error code header. This allows to build custom error messages that do not bind to json \/ xml etc, as success messages otherwise will do. This op [...]
     "clientRequestValidation": { "kind": "attribute", "displayName": "Client Request Validation", "label": "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 matches what the Rest D [...]
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 59f46d616db..d50e518ee0d 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
@@ -21282,6 +21282,18 @@ be configured on a parent level.
           </xs:annotation>
         </xs:attribute>
                 
+        <xs:attribute name="disabled" type="xs:string">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+              <![CDATA[
+Whether to disable this REST service 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="type" type="xs:string">
           <xs:annotation>
             <xs:documentation xml:lang="en">
@@ -22444,6 +22456,18 @@ be configured on a parent level.
           </xs:annotation>
         </xs:attribute>
                 
+        <xs:attribute name="disabled" type="xs:string">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+              <![CDATA[
+Whether to disable this REST service 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="bindingMode" type="xs:string">
           <xs:annotation>
             <xs:documentation xml:lang="en">
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/delete.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/delete.json
index 66f60b9b4e2..b5d8e1b317b 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/delete.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/delete.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/get.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/get.json
index 366df91903a..362baa2836f 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/get.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/get.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/head.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/head.json
index af317c58e3d..dd1cea15080 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/head.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/head.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/patch.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/patch.json
index c013951b98f..ad2510f50cc 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/patch.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/patch.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/post.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/post.json
index 8dbaaa36c1e..bcb41b6a890 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/post.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/post.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/put.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/put.json
index 728d0d886f6..c3704027850 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/put.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/put.json
@@ -16,6 +16,7 @@
     "to": { "kind": "element", "displayName": "To", "required": true, "type": "object", "javaType": "org.apache.camel.model.ToDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that handles this REST call." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "type": { "kind": "attribute", "displayName": "Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from input to POJO for the incoming data This option will override what may be configured on a parent level. The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class name to use for binding from POJO to output for the outgoing data This option will override what may be configured on a parent level The name of the class of the input data. Append a to the end of the name if you want the input to be an array type." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is off" },
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json
index 7f5f3afd5ef..de761541a56 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json
@@ -15,6 +15,7 @@
     "path": { "kind": "attribute", "displayName": "Path", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path of the rest service, such as \/foo" },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service consumes (accept as input), such as application\/xml or application\/json. This option will override what may be configured on a parent level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To define the content type what the REST service produces (uses for output), such as application\/xml or application\/json This option will override what may be configured on a parent level" },
+    "disabled": { "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 this REST service from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
     "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "off", "description": "Sets the binding mode to use. This option will override what may be configured on a parent level The default value is auto" },
     "skipBindingOnErrorCode": { "kind": "attribute", "displayName": "Skip Binding On Error Code", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip binding on output if there is a custom HTTP error code header. This allows to build custom error messages that do not bind to json \/ xml etc, as success messages otherwise will do. This op [...]
     "clientRequestValidation": { "kind": "attribute", "displayName": "Client Request Validation", "label": "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 matches what the Rest D [...]
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 5d55d3a43d9..57c7acad82f 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
@@ -40,6 +40,7 @@ import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.model.ToDefinition;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StringHelper;
@@ -60,6 +61,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
     @XmlAttribute
     private String produces;
     @XmlAttribute
+    @Metadata(label = "advanced", javaType = "java.lang.Boolean")
+    protected String disabled;
+    @XmlAttribute
     @Metadata(defaultValue = "off", enums = "off,auto,json,xml,json_xml")
     private String bindingMode;
     @XmlAttribute
@@ -142,6 +146,18 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         this.produces = produces;
     }
 
+    public String getDisabled() {
+        return disabled;
+    }
+
+    /**
+     * Whether to disable this REST service from the route during build time. Once an REST service has been disabled
+     * then it cannot be enabled later at runtime.
+     */
+    public void setDisabled(String disabled) {
+        this.disabled = disabled;
+    }
+
     public String getBindingMode() {
         return bindingMode;
     }
@@ -256,6 +272,40 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         return this;
     }
 
+    /**
+     * Disables this REST service from the route during build time. Once an REST service has been disabled then it
+     * cannot be enabled later at runtime.
+     */
+    public RestDefinition disabled() {
+        disabled("true");
+        return this;
+    }
+
+    /**
+     * Whether to disable this REST service from the route during build time. Once an REST service has been disabled
+     * then it cannot be enabled later at runtime.
+     */
+    public RestDefinition disabled(boolean disabled) {
+        disabled(disabled ? "true" : "false");
+        return this;
+    }
+
+    /**
+     * Whether to disable this REST service from the route during build time. Once an REST service has been disabled
+     * then it cannot be enabled later at runtime.
+     */
+    public RestDefinition disabled(String disabled) {
+        if (getVerbs().isEmpty()) {
+            this.disabled = disabled;
+        } else {
+            // add on last verb as that is how the Java DSL works
+            VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
+            verb.setDisabled(disabled);
+        }
+
+        return this;
+    }
+
     /**
      * To set the tag to use of this REST service
      */
@@ -684,23 +734,36 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
     public List<RouteDefinition> asRouteDefinition(CamelContext camelContext) {
         ObjectHelper.notNull(camelContext, "CamelContext");
 
-        // sanity check this rest definition do not have duplicates
-        validateUniquePaths();
-
         List<RouteDefinition> answer = new ArrayList<>();
 
+        Boolean disabled = CamelContextHelper.parseBoolean(camelContext, this.disabled);
+        if (disabled != null && disabled) {
+            return answer; // all rest services are disabled
+        }
+
+        // only include enabled verbs
+        List<VerbDefinition> filter = new ArrayList<>();
+        for (VerbDefinition verb : verbs) {
+            disabled = CamelContextHelper.parseBoolean(camelContext, verb.disabled);
+            if (disabled == null || !disabled) {
+                filter.add(verb);
+            }
+        }
+
+        // sanity check this rest definition do not have duplicates
+        validateUniquePaths(filter);
+
         RestConfiguration config = camelContext.getRestConfiguration();
         if (config.isInlineRoutes()) {
             // sanity check this rest definition do not have duplicates linked routes via direct endpoints
-            validateUniqueDirects();
+            validateUniqueDirects(filter);
         }
-
-        addRouteDefinition(camelContext, answer, config.getComponent(), config.getProducerComponent());
+        addRouteDefinition(camelContext, filter, answer, config.getComponent(), config.getProducerComponent());
 
         return answer;
     }
 
-    protected void validateUniquePaths() {
+    protected void validateUniquePaths(List<VerbDefinition> verbs) {
         Set<String> paths = new HashSet<>();
         for (VerbDefinition verb : verbs) {
             String path = verb.asVerb();
@@ -713,7 +776,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         }
     }
 
-    protected void validateUniqueDirects() {
+    protected void validateUniqueDirects(List<VerbDefinition> verbs) {
         Set<String> directs = new HashSet<>();
         for (VerbDefinition verb : verbs) {
             ToDefinition to = verb.getTo();
@@ -794,8 +857,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
 
     @SuppressWarnings("rawtypes")
     private void addRouteDefinition(
-            CamelContext camelContext, List<RouteDefinition> answer, String component, String producerComponent) {
-        for (VerbDefinition verb : getVerbs()) {
+            CamelContext camelContext, List<VerbDefinition> verbs, List<RouteDefinition> answer,
+            String component, String producerComponent) {
+        for (VerbDefinition verb : verbs) {
             // use a route as facade for this REST service
             RouteDefinition route = new RouteDefinition();
             if (verb.getTo() == null) {
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index d30177c3e9f..b6fcdb5c427 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -53,7 +53,10 @@ public abstract class VerbDefinition extends OptionalIdentifiedDefinition<VerbDe
     private String consumes;
     @XmlAttribute
     private String produces;
-    @XmlAttribute()
+    @XmlAttribute
+    @Metadata(label = "advanced", javaType = "java.lang.Boolean")
+    protected String disabled;
+    @XmlAttribute
     @Metadata(label = "advanced")
     private String type;
     @XmlTransient
@@ -191,6 +194,18 @@ public abstract class VerbDefinition extends OptionalIdentifiedDefinition<VerbDe
         this.produces = produces;
     }
 
+    public String getDisabled() {
+        return disabled;
+    }
+
+    /**
+     * Whether to disable this REST service from the route during build time. Once an REST service has been disabled
+     * then it cannot be enabled later at runtime.
+     */
+    public void setDisabled(String disabled) {
+        this.disabled = disabled;
+    }
+
     public String getBindingMode() {
         return bindingMode;
     }
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestDisabledAllTest.java b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestDisabledAllTest.java
new file mode 100644
index 00000000000..95c64b9c16a
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestDisabledAllTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.component.rest;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.Registry;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class FromRestDisabledAllTest extends ContextTestSupport {
+
+    @Override
+    protected Registry createRegistry() throws Exception {
+        Registry jndi = super.createRegistry();
+        jndi.bind("dummy-rest", new DummyRestConsumerFactory());
+        return jndi;
+    }
+
+    @Test
+    public void testDisabled() throws Exception {
+        getMockEndpoint("mock:translate").expectedBodiesReceived("Hello World");
+        template.sendBody("seda:get-translate", "Hello World");
+        assertMockEndpointsSatisfied();
+
+        // should only be 1 route
+        Assertions.assertEquals(1, context.getRoutes().size());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().host("localhost");
+
+                rest("/say").disabled(true)
+                    .post("/hi").to("mock:hi")
+                    .get("/bye").to("mock:bye");
+
+                rest("/translate")
+                    .get().to("mock:translate");
+            }
+        };
+    }
+}
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestDisabledTest.java b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestDisabledTest.java
new file mode 100644
index 00000000000..0e212d60b6b
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestDisabledTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.component.rest;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.CamelContextHelper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class FromRestDisabledTest extends ContextTestSupport {
+
+    @Override
+    protected Registry createRegistry() throws Exception {
+        Registry jndi = super.createRegistry();
+        jndi.bind("dummy-rest", new DummyRestConsumerFactory());
+        return jndi;
+    }
+
+    @Test
+    public void testDisabled() throws Exception {
+        getMockEndpoint("mock:bye").expectedBodiesReceived("Hello World");
+        template.sendBody("seda:get-say-bye", "Hello World");
+        assertMockEndpointsSatisfied();
+
+        // should only be 2 route as 1 is disabled
+        Assertions.assertEquals(2, context.getRoutes().size());
+
+        // should NOT have mock://hi endpoint
+        Assertions.assertEquals(0, CamelContextHelper.getEndpoints(context, e -> e.getEndpointUri().contains("hi")).size());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().host("localhost");
+
+                rest("/say")
+                    .post("/hi").to("mock:hi").disabled()
+                    .get("/bye").to("mock:bye")
+                    .get("/translate").to("mock:translate");
+            }
+        };
+    }
+}
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 9919c38d885..2f30cff942d 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
@@ -1074,6 +1074,7 @@ public class ModelParser extends BaseParser {
                 case "bindingMode": def.setBindingMode(val); break;
                 case "clientRequestValidation": def.setClientRequestValidation(val); break;
                 case "consumes": def.setConsumes(val); break;
+                case "disabled": def.setDisabled(val); break;
                 case "enableCORS": def.setEnableCORS(val); break;
                 case "path": def.setPath(val); break;
                 case "produces": def.setProduces(val); break;
@@ -2950,6 +2951,7 @@ public class ModelParser extends BaseParser {
                 case "clientRequestValidation": def.setClientRequestValidation(val); break;
                 case "consumes": def.setConsumes(val); break;
                 case "deprecated": def.setDeprecated(val); break;
+                case "disabled": def.setDisabled(val); break;
                 case "enableCORS": def.setEnableCORS(val); break;
                 case "outType": def.setOutType(val); break;
                 case "path": def.setPath(val); break;
diff --git a/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc b/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc
index 0161e3ac1fc..1e11846bba1 100644
--- a/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc
+++ b/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc
@@ -233,6 +233,42 @@ If you use Camel Main / Spring Boot / Quarkus / or Camel JBang you can also enab
 camel.rest.inline-routes = true
 ----
 
+== Disabling REST services
+
+While developing REST services using Rest DSL, you may want to temporary disabled some REST endpoints,
+which you can do using `disabled` as shown in the following.
+
+[source,java]
+----
+rest("/customers/")
+    .get("/{id}").to("direct:customerDetail")
+    .get("/{id}/orders").to("direct:customerOrders").disabled("{{ordersEnabled}}")
+    .post("/neworder").to("direct:customerNewOrder").disabled();
+----
+
+And in XML:
+
+[source,xml]
+----
+<rest>
+  <get path="/customers/{id}">
+    <to uri="direct:customerDetail"/>
+  </get>
+  <get path="/customers/{id}/orders" disabled="{{ordersEnabled}}">
+    <to uri="direct:customerOrders"/>
+  </get>
+  <post path="/customers/neworder" disabled="true">
+    <to uri="direct:customerNewOrder"/>
+  </post>
+</rest>
+----
+
+In this example the last two REST endpoints are configured with `disabled`.
+You can use xref:manual:ROOT:using-propertyplaceholder.adoc[Property Placeholder] to
+let a external configuration determine if the REST endpoint is disabled or not.
+In this example the `/customers/{id}/orders` endpoint is disabled via a placeholder.
+The last REST endpoint is hardcoded to be disabled.
+
 == Binding to POJOs using
 
 The Rest DSL supports automatic binding json/xml contents to/from POJOs
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 56ae69f0acd..f8548a4ff97 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
@@ -4164,6 +4164,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "consumes", type = "string"),
                     @YamlProperty(name = "deprecated", type = "boolean"),
                     @YamlProperty(name = "description", type = "string"),
+                    @YamlProperty(name = "disabled", type = "boolean"),
                     @YamlProperty(name = "enable-cors", type = "boolean"),
                     @YamlProperty(name = "id", type = "string"),
                     @YamlProperty(name = "out-type", type = "string"),
@@ -4217,6 +4218,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setDeprecated(val);
                     break;
                 }
+                case "disabled": {
+                    String val = asText(node);
+                    target.setDisabled(val);
+                    break;
+                }
                 case "enable-cors": {
                     String val = asText(node);
                     target.setEnableCORS(val);
@@ -5528,6 +5534,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "consumes", type = "string"),
                     @YamlProperty(name = "deprecated", type = "boolean"),
                     @YamlProperty(name = "description", type = "string"),
+                    @YamlProperty(name = "disabled", type = "boolean"),
                     @YamlProperty(name = "enable-cors", type = "boolean"),
                     @YamlProperty(name = "id", type = "string"),
                     @YamlProperty(name = "out-type", type = "string"),
@@ -5581,6 +5588,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setDeprecated(val);
                     break;
                 }
+                case "disabled": {
+                    String val = asText(node);
+                    target.setDisabled(val);
+                    break;
+                }
                 case "enable-cors": {
                     String val = asText(node);
                     target.setEnableCORS(val);
@@ -5943,6 +5955,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "consumes", type = "string"),
                     @YamlProperty(name = "deprecated", type = "boolean"),
                     @YamlProperty(name = "description", type = "string"),
+                    @YamlProperty(name = "disabled", type = "boolean"),
                     @YamlProperty(name = "enable-cors", type = "boolean"),
                     @YamlProperty(name = "id", type = "string"),
                     @YamlProperty(name = "out-type", type = "string"),
@@ -5996,6 +6009,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setDeprecated(val);
                     break;
                 }
+                case "disabled": {
+                    String val = asText(node);
+                    target.setDisabled(val);
+                    break;
+                }
                 case "enable-cors": {
                     String val = asText(node);
                     target.setEnableCORS(val);
@@ -10070,6 +10088,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "consumes", type = "string"),
                     @YamlProperty(name = "deprecated", type = "boolean"),
                     @YamlProperty(name = "description", type = "string"),
+                    @YamlProperty(name = "disabled", type = "boolean"),
                     @YamlProperty(name = "enable-cors", type = "boolean"),
                     @YamlProperty(name = "id", type = "string"),
                     @YamlProperty(name = "out-type", type = "string"),
@@ -10123,6 +10142,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setDeprecated(val);
                     break;
                 }
+                case "disabled": {
+                    String val = asText(node);
+                    target.setDisabled(val);
+                    break;
+                }
                 case "enable-cors": {
                     String val = asText(node);
                     target.setEnableCORS(val);
@@ -10508,6 +10532,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "consumes", type = "string"),
                     @YamlProperty(name = "deprecated", type = "boolean"),
                     @YamlProperty(name = "description", type = "string"),
+                    @YamlProperty(name = "disabled", type = "boolean"),
                     @YamlProperty(name = "enable-cors", type = "boolean"),
                     @YamlProperty(name = "id", type = "string"),
                     @YamlProperty(name = "out-type", type = "string"),
@@ -10561,6 +10586,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setDeprecated(val);
                     break;
                 }
+                case "disabled": {
+                    String val = asText(node);
+                    target.setDisabled(val);
+                    break;
+                }
                 case "enable-cors": {
                     String val = asText(node);
                     target.setEnableCORS(val);
@@ -10995,6 +11025,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "consumes", type = "string"),
                     @YamlProperty(name = "deprecated", type = "boolean"),
                     @YamlProperty(name = "description", type = "string"),
+                    @YamlProperty(name = "disabled", type = "boolean"),
                     @YamlProperty(name = "enable-cors", type = "boolean"),
                     @YamlProperty(name = "id", type = "string"),
                     @YamlProperty(name = "out-type", type = "string"),
@@ -11048,6 +11079,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setDeprecated(val);
                     break;
                 }
+                case "disabled": {
+                    String val = asText(node);
+                    target.setDisabled(val);
+                    break;
+                }
                 case "enable-cors": {
                     String val = asText(node);
                     target.setEnableCORS(val);
@@ -12604,6 +12640,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "consumes", type = "string"),
                     @YamlProperty(name = "delete", type = "array:org.apache.camel.model.rest.DeleteDefinition"),
                     @YamlProperty(name = "description", type = "string"),
+                    @YamlProperty(name = "disabled", type = "boolean"),
                     @YamlProperty(name = "enable-cors", type = "boolean"),
                     @YamlProperty(name = "get", type = "array:org.apache.camel.model.rest.GetDefinition"),
                     @YamlProperty(name = "head", type = "array:org.apache.camel.model.rest.HeadDefinition"),
@@ -12653,6 +12690,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setConsumes(val);
                     break;
                 }
+                case "disabled": {
+                    String val = asText(node);
+                    target.setDisabled(val);
+                    break;
+                }
                 case "enable-cors": {
                     String val = asText(node);
                     target.setEnableCORS(val);
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json
index beb1a4929cc..d390d3d2c52 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json
@@ -7030,6 +7030,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enable-cors" : {
             "type" : "boolean"
           },
@@ -7099,6 +7102,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enable-cors" : {
             "type" : "boolean"
           },
@@ -7168,6 +7174,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enable-cors" : {
             "type" : "boolean"
           },
@@ -7342,6 +7351,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enable-cors" : {
             "type" : "boolean"
           },
@@ -7411,6 +7423,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enable-cors" : {
             "type" : "boolean"
           },
@@ -7480,6 +7495,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enable-cors" : {
             "type" : "boolean"
           },
@@ -7761,6 +7779,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enable-cors" : {
             "type" : "boolean"
           },
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 464783519a7..6e8d050fd1d 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
@@ -6931,6 +6931,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enableCors" : {
             "type" : "boolean"
           },
@@ -7000,6 +7003,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enableCors" : {
             "type" : "boolean"
           },
@@ -7069,6 +7075,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enableCors" : {
             "type" : "boolean"
           },
@@ -7243,6 +7252,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enableCors" : {
             "type" : "boolean"
           },
@@ -7312,6 +7324,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enableCors" : {
             "type" : "boolean"
           },
@@ -7381,6 +7396,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enableCors" : {
             "type" : "boolean"
           },
@@ -7662,6 +7680,9 @@
           "description" : {
             "type" : "string"
           },
+          "disabled" : {
+            "type" : "boolean"
+          },
           "enableCors" : {
             "type" : "boolean"
           },


[camel] 03/03: polished

Posted by da...@apache.org.
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

commit 2096e03aef6980fd6707c272f7faedc28c026d93
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Nov 23 07:44:56 2022 +0100

    polished
---
 .../src/main/java/org/apache/camel/spi/RestApiProcessorFactory.java  | 4 ++--
 .../src/main/java/org/apache/camel/spi/RestConfiguration.java        | 5 +++--
 core/camel-api/src/main/java/org/apache/camel/spi/RestRegistry.java  | 5 +++--
 .../resources/META-INF/camel-main-configuration-metadata.json        | 2 +-
 core/camel-main/src/main/docs/main.adoc                              | 2 +-
 .../main/java/org/apache/camel/main/RestConfigurationProperties.java | 5 +++--
 .../apache/camel/api/management/mbean/ManagedRestRegistryMBean.java  | 2 +-
 .../java/org/apache/camel/management/ManagedRestRegistryTest.java    | 2 +-
 8 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/RestApiProcessorFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/RestApiProcessorFactory.java
index a66554a78a1..f4c2bc80137 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/RestApiProcessorFactory.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/RestApiProcessorFactory.java
@@ -25,8 +25,8 @@ import org.apache.camel.Processor;
  * Allows SPI to plugin a {@link RestApiProcessorFactory} that creates the Camel {@link Processor} responsible for
  * servicing and generating the REST API documentation.
  * <p/>
- * For example the <tt>camel-swagger-java</tt> component provides such a factory that uses Swagger to generate the
- * documentation.
+ * For example the <tt>camel-openapi-java</tt> or <tt>camel-swagger-java</tt> component provides such a factory that
+ * uses OpenAPI/Swagger to generate the documentation.
  */
 public interface RestApiProcessorFactory {
 
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/RestConfiguration.java b/core/camel-api/src/main/java/org/apache/camel/spi/RestConfiguration.java
index 2f9d04f1ca8..bbe203d6f54 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/RestConfiguration.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/RestConfiguration.java
@@ -142,8 +142,9 @@ public class RestConfiguration {
 
     /**
      * 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-swagger-java to the classpath,
-     * and any miss configuration will let Camel fail on startup and report the error(s).
+     * parameters are valid accordingly to the api document. This requires adding camel-openapi-java, or
+     * camel-swagger-java to the classpath, and any miss configuration will let Camel fail on startup and report the
+     * error(s).
      * <p/>
      * The location of the api document is loaded from classpath by default, but you can use <tt>file:</tt> or
      * <tt>http:</tt> to refer to resources to load from file or http url.
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistry.java b/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistry.java
index 74a54b94c78..b3efbc8ba73 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistry.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistry.java
@@ -141,9 +141,10 @@ public interface RestRegistry extends Service {
     int size();
 
     /**
-     * Outputs the Rest services API documentation in JSON (requires camel-swagger-java on classpath)
+     * Outputs the Rest services API documentation in JSON (requires camel-openapi-java, or camel-swagger-java on
+     * classpath)
      *
-     * @return the API docs in JSon, or <tt>null</tt> if camel-swagger-java is not on classpath
+     * @return the API docs in JSon, or <tt>null</tt> if camel-openapi-java and camel-swagger-java is not on classpath
      */
     String apiDocAsJson();
 
diff --git a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index e5a838745fd..b9836b00584 100644
--- a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -196,7 +196,7 @@
     { "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.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-swagger-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 [...]
+    { "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, or camel-swagger-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:  [...]
     { "name": "camel.rest.producerComponent", "description": "Sets the name of the Camel component to use as the REST producer", "sourceType": "org.apache.camel.spi.RestConfiguration", "type": "string", "javaType": "java.lang.String" },
     { "name": "camel.rest.scheme", "description": "Sets the scheme to use by the REST consumer", "sourceType": "org.apache.camel.spi.RestConfiguration", "type": "string", "javaType": "java.lang.String" },
     { "name": "camel.rest.skipBindingOnErrorCode", "description": "Whether to skip binding output if there is a custom HTTP error code, and instead use the response body as-is. This option is default true.", "sourceType": "org.apache.camel.spi.RestConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": true },
diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc
index 238da3a0b8c..044462aaf6c 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -202,7 +202,7 @@ The camel.rest supports 27 options, which are listed below.
 | *camel.rest.inlineRoutes* | 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. | false | boolean
 | *camel.rest.jsonDataFormat* | 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. |  | String
 | *camel.rest.port* | Sets the port to use by the REST consumer |  | int
-| *camel.rest.producerApiDoc* | 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-swagger-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 to load from file or http ur [...]
+| *camel.rest.producerApiDoc* | 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, or camel-swagger-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 to lo [...]
 | *camel.rest.producerComponent* | Sets the name of the Camel component to use as the REST producer |  | String
 | *camel.rest.scheme* | Sets the scheme to use by the REST consumer |  | String
 | *camel.rest.skipBindingOnError{zwsp}Code* | Whether to skip binding output if there is a custom HTTP error code, and instead use the response body as-is. This option is default true. | true | boolean
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/RestConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/RestConfigurationProperties.java
index 82dc8337817..2e6b2a192eb 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/RestConfigurationProperties.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/RestConfigurationProperties.java
@@ -137,8 +137,9 @@ public class RestConfigurationProperties extends RestConfiguration implements Bo
 
     /**
      * 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-swagger-java to the classpath,
-     * and any miss configuration will let Camel fail on startup and report the error(s).
+     * parameters are valid accordingly to the api document. This requires adding camel-openapi-java, or
+     * camel-swagger-java to the classpath, and any miss configuration will let Camel fail on startup and report the
+     * error(s).
      * <p/>
      * The location of the api document is loaded from classpath by default, but you can use <tt>file:</tt> or
      * <tt>http:</tt> to refer to resources to load from file or http url.
diff --git a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRestRegistryMBean.java b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRestRegistryMBean.java
index d0b8ce43b27..d3f3d22ffb0 100644
--- a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRestRegistryMBean.java
+++ b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRestRegistryMBean.java
@@ -29,7 +29,7 @@ public interface ManagedRestRegistryMBean extends ManagedServiceMBean {
     @ManagedOperation(description = "Lists all the Rest services in the registry (url, path, verb, consumes, produces)")
     TabularData listRestServices();
 
-    @ManagedOperation(description = "Outputs the Rest services API documentation in JSON (requires camel-swagger-java on classpath)")
+    @ManagedOperation(description = "Outputs the Rest services API documentation in JSON (requires camel-openapi-java, or camel-swagger-java on classpath)")
     String apiDocAsJson();
 
 }
diff --git a/core/camel-management/src/test/java/org/apache/camel/management/ManagedRestRegistryTest.java b/core/camel-management/src/test/java/org/apache/camel/management/ManagedRestRegistryTest.java
index 16ba651efa1..7cac95e194a 100644
--- a/core/camel-management/src/test/java/org/apache/camel/management/ManagedRestRegistryTest.java
+++ b/core/camel-management/src/test/java/org/apache/camel/management/ManagedRestRegistryTest.java
@@ -69,7 +69,7 @@ public class ManagedRestRegistryTest extends ManagementTestSupport {
         TabularData data = (TabularData) mbeanServer.invoke(name, "listRestServices", null, null);
         assertEquals(3, data.size());
 
-        // should not be enabled as api-doc is not enabled or camel-swagger-java is not on classpath
+        // should not be enabled as api-doc is not enabled or camel-openapi-java/camel-swagger-java is not on classpath
         String json = (String) mbeanServer.invoke(name, "apiDocAsJson", null, null);
         assertNull(json);