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 2024/03/28 14:40:46 UTC

(camel) 32/38: CAMEL-20557: Rest DSL to use openapi spec directly

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

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

commit e40d5caa3d5573199057070e7783c4de2a28e71b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Mar 27 10:54:02 2024 +0100

    CAMEL-20557: Rest DSL to use openapi spec directly
---
 .../org/apache/camel/catalog/models/openApi.json   |   5 +-
 .../apache/camel/catalog/schemas/camel-spring.xsd  |  39 +++++++-
 ...PlatformHttpRestOpenApiConsumerRestDslTest.java |  32 ++-----
 .../org/apache/camel/model/rest/openApi.json       |   5 +-
 .../apache/camel/model/rest/OpenApiDefinition.java | 106 ++++++++++++++++++++-
 .../apache/camel/model/rest/RestDefinition.java    |  31 ++++--
 .../java/org/apache/camel/xml/in/ModelParser.java  |   3 +
 .../java/org/apache/camel/xml/out/ModelWriter.java |   3 +
 .../org/apache/camel/yaml/out/ModelWriter.java     |   3 +
 .../dsl/yaml/deserializers/ModelDeserializers.java |  20 +++-
 .../generated/resources/schema/camelYamlDsl.json   |  21 +++-
 11 files changed, 231 insertions(+), 37 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
index 2fec558b620..f1292c7c300 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
@@ -15,6 +15,9 @@
     "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" },
     "description": { "index": 1, "kind": "element", "displayName": "Description", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" },
     "disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to disable all the REST services from the OpenAPI contract from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
-    "specification": { "index": 3, "kind": "attribute", "displayName": "Specification", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false }
+    "specification": { "index": 3, "kind": "attribute", "displayName": "Specification", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path to the OpenApi specification file." },
+    "routeId": { "index": 4, "kind": "attribute", "displayName": "Route Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of the route" },
+    "missingOperation": { "index": 5, "kind": "attribute", "displayName": "Missing Operation", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "fail", "description": "Whether to fail, ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route." },
+    "mockIncludePattern": { "index": 6, "kind": "attribute", "displayName": "Mock Include Pattern", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma." }
   }
 }
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 53195be2296..d800a098830 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
@@ -16388,13 +16388,50 @@ The flow used by the OAuth2 security scheme. Valid values are implicit, password
     <xs:complexContent>
       <xs:extension base="tns:optionalIdentifiedDefinition">
         <xs:sequence/>
-        <xs:attribute name="specification" type="xs:string" use="required"/>
+        <xs:attribute name="specification" type="xs:string" use="required">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+<![CDATA[
+Path to the OpenApi specification file.
+]]>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="routeId" type="xs:string">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+<![CDATA[
+Sets the id of the route.
+]]>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
         <xs:attribute name="disabled" type="xs:string">
           <xs:annotation>
             <xs:documentation xml:lang="en">
 <![CDATA[
 Whether to disable all the REST services from the OpenAPI contract from the route during build time. Once an REST
 service has been disabled then it cannot be enabled later at runtime. Default value: false
+]]>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="missingOperation" type="xs:string">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+<![CDATA[
+Whether to fail, ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route.
+Default value: fail
+]]>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="mockIncludePattern" type="xs:string">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+<![CDATA[
+Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple
+patterns can be specified separated by comma. Default value: classpath:camel-mock/**
 ]]>
             </xs:documentation>
           </xs:annotation>
diff --git a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java
index f91954d1ceb..db51da21007 100644
--- a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java
+++ b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.platform.http.vertx;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.rest.openapi.RestOpenApiComponent;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
@@ -37,10 +36,7 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() {
-                    RestOpenApiComponent c = context.getComponent("rest-openapi", RestOpenApiComponent.class);
-                    c.setMissingOperation("ignore");
-
-                    rest().openApi("openapi-v3.json");
+                    rest().openApi().specification("openapi-v3.json").missingOperation("ignore");
 
                     from("direct:getPetById")
                             .setBody().constant("{\"pet\": \"tony the tiger\"}");
@@ -99,10 +95,7 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() {
-                    RestOpenApiComponent c = context.getComponent("rest-openapi", RestOpenApiComponent.class);
-                    c.setMissingOperation("mock");
-
-                    rest().openApi("openapi-v3.json");
+                    rest().openApi().specification("openapi-v3.json").missingOperation("mock");
 
                     from("direct:getPetById")
                             .setBody().constant("{\"pet\": \"tony the tiger\"}");
@@ -163,10 +156,7 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() {
-                    RestOpenApiComponent c = context.getComponent("rest-openapi", RestOpenApiComponent.class);
-                    c.setMissingOperation("ignore");
-
-                    rest().openApi("openapi-v3.json");
+                    rest().openApi().specification("openapi-v3.json").missingOperation("ignore");
 
                     from("direct:getPetById")
                             .setBody().constant("{\"pet\": \"tony the tiger\"}");
@@ -193,10 +183,7 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() {
-                    RestOpenApiComponent c = context.getComponent("rest-openapi", RestOpenApiComponent.class);
-                    c.setMissingOperation("ignore");
-
-                    rest().openApi("openapi-v3.json");
+                    rest().openApi().specification("openapi-v3.json").missingOperation("ignore");
 
                     from("direct:getPetById")
                             .setBody().constant("{\"pet\": \"tony the tiger\"}");
@@ -223,10 +210,8 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() {
-                    RestOpenApiComponent c = context.getComponent("rest-openapi", RestOpenApiComponent.class);
-                    c.setMissingOperation("ignore");
-
-                    rest().clientRequestValidation(true).openApi("openapi-v3.json");
+                    rest().clientRequestValidation(true)
+                            .openApi().specification("openapi-v3.json").missingOperation("ignore");
 
                     from("direct:updatePet")
                             .setBody().constant("{\"pet\": \"tony the tiger\"}");
@@ -253,10 +238,7 @@ public class PlatformHttpRestOpenApiConsumerRestDslTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() {
-                    RestOpenApiComponent c = context.getComponent("rest-openapi", RestOpenApiComponent.class);
-                    c.setMissingOperation("mock");
-
-                    rest().openApi("openapi-v3.json");
+                    rest().openApi().specification("openapi-v3.json").missingOperation("mock");
                 }
             });
 
diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json
index 2fec558b620..f1292c7c300 100644
--- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json
+++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/rest/openApi.json
@@ -15,6 +15,9 @@
     "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" },
     "description": { "index": 1, "kind": "element", "displayName": "Description", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" },
     "disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to disable all the REST services from the OpenAPI contract from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime." },
-    "specification": { "index": 3, "kind": "attribute", "displayName": "Specification", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false }
+    "specification": { "index": 3, "kind": "attribute", "displayName": "Specification", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path to the OpenApi specification file." },
+    "routeId": { "index": 4, "kind": "attribute", "displayName": "Route Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of the route" },
+    "missingOperation": { "index": 5, "kind": "attribute", "displayName": "Missing Operation", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "fail", "description": "Whether to fail, ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route." },
+    "mockIncludePattern": { "index": 6, "kind": "attribute", "displayName": "Mock Include Pattern", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma." }
   }
 }
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java
index f2d34c56d81..1eefdff7728 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/OpenApiDefinition.java
@@ -39,8 +39,20 @@ public class OpenApiDefinition extends OptionalIdentifiedDefinition<OpenApiDefin
     @XmlAttribute(required = true)
     private String specification;
     @XmlAttribute
+    private String routeId;
+    @XmlAttribute
     @Metadata(label = "advanced", javaType = "java.lang.Boolean")
     private String disabled;
+    @XmlAttribute
+    @Metadata(enums = "fail,ignore,mock", defaultValue = "fail")
+    private String missingOperation;
+    @XmlAttribute
+    @Metadata(label = "advanced", defaultValue = "classpath:camel-mock/**")
+    private String mockIncludePattern;
+
+    public void setRest(RestDefinition rest) {
+        this.rest = rest;
+    }
 
     @Override
     public String getShortName() {
@@ -72,11 +84,103 @@ public class OpenApiDefinition extends OptionalIdentifiedDefinition<OpenApiDefin
         this.disabled = disabled;
     }
 
+    public String getMissingOperation() {
+        return missingOperation;
+    }
+
+    /**
+     * Whether to fail, ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route.
+     */
+    public void setMissingOperation(String missingOperation) {
+        this.missingOperation = missingOperation;
+    }
+
+    public String getMockIncludePattern() {
+        return mockIncludePattern;
+    }
+
+    /**
+     * Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern.
+     * Multiple patterns can be specified separated by comma.
+     */
+    public void setMockIncludePattern(String mockIncludePattern) {
+        this.mockIncludePattern = mockIncludePattern;
+    }
+
+    public String getRouteId() {
+        return routeId;
+    }
+
+    /**
+     * Sets the id of the route
+     */
+    public void setRouteId(String routeId) {
+        this.routeId = routeId;
+    }
+
     // Fluent API
     // -------------------------------------------------------------------------
 
-    public RestDefinition specification(String specification) {
+    /**
+     * Path to the OpenApi specification file.
+     */
+    public OpenApiDefinition specification(String specification) {
         this.specification = specification;
+        return this;
+    }
+
+    /**
+     * Whether to disable the OpenAPI entirely. Once the OpenAPI has been disabled then it cannot be
+     * enabled later at runtime.
+     */
+    public OpenApiDefinition disabled(String disabled) {
+        this.disabled = disabled;
+        return this;
+    }
+
+    /**
+     * Whether to disable the OpenAPI entirely. Once the OpenAPI has been disabled then it cannot be
+     * enabled later at runtime.
+     */
+    public OpenApiDefinition disabled(boolean disabled) {
+        this.disabled = disabled ? "true" : "false";
+        return this;
+    }
+
+    /**
+     * Whether to disable the OpenAPI entirely. Once the OpenAPI has been disabled then it cannot be
+     * enabled later at runtime.
+     */
+    public OpenApiDefinition disabled() {
+        return disabled(true);
+    }
+
+    /**
+     * Whether to fail, ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route.
+     */
+    public OpenApiDefinition missingOperation(String missingOperation) {
+        this.missingOperation = missingOperation;
+        return this;
+    }
+
+    /**
+     * Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern.
+     * Multiple patterns can be specified separated by comma.
+     */
+    public OpenApiDefinition mockIncludePattern(String mockIncludePattern) {
+        this.mockIncludePattern = mockIncludePattern;
+        return this;
+    }
+
+    /**
+     * Sets the id of the route
+     */
+    public OpenApiDefinition routeId(String routeId) {
+        this.routeId = routeId;
+        return this;
+    }
+
+    public RestDefinition end() {
         return rest;
     }
 
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 379d5f46cde..6f1406b8caf 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
@@ -238,7 +238,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
 
     /**
      * Whether to enable validation of the client request to check:
-     *
+     * <p>
      * 1) Content-Type header matches what the Rest DSL consumes; returns HTTP Status 415 if validation error. 2) Accept
      * header matches what the Rest DSL produces; returns HTTP Status 406 if validation error. 3) Missing required data
      * (query parameters, HTTP headers, body); returns HTTP Status 400 if validation error. 4) Parsing error of the
@@ -311,12 +311,23 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
     // Fluent API
     // -------------------------------------------------------------------------
 
+    /**
+     * To use an existing OpenAPI specification as contract-first for Camel Rest DSL.
+     */
+    public OpenApiDefinition openApi() {
+        openApi = new OpenApiDefinition();
+        openApi.setRest(this);
+        return openApi;
+    }
+
     /**
      * To use an existing OpenAPI specification as contract-first for Camel Rest DSL.
      */
     public RestDefinition openApi(String specification) {
         openApi = new OpenApiDefinition();
-        return openApi.specification(specification);
+        openApi.setRest(this);
+        openApi.specification(specification);
+        return this;
     }
 
     /**
@@ -750,8 +761,8 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
      * The Camel endpoint this REST service will call, such as a direct endpoint to link to an existing route that
      * handles this REST call.
      *
-     * @param  uri the uri of the endpoint
-     * @return     this builder
+     * @param uri the uri of the endpoint
+     * @return this builder
      */
     public RestDefinition to(String uri) {
         // add to last verb
@@ -961,6 +972,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
             String component, String producerComponent) {
 
         RouteDefinition route = new RouteDefinition();
+        if (openApi.getRouteId() != null) {
+            route.routeId(parseText(camelContext, openApi.getRouteId()));
+        }
         // add dummy empty stop
         route.getOutputs().add(new StopDefinition());
 
@@ -983,7 +997,6 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         binding.setClientRequestValidation(getClientRequestValidation());
         binding.setEnableCORS(getEnableCORS());
         binding.setEnableNoContentResponse(getEnableNoContentResponse());
-
         route.setRestBindingDefinition(binding);
 
         // append options
@@ -1004,6 +1017,12 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         if (validate != null && validate) {
             options.put("requestValidationEnabled", "true");
         }
+        if (openApi.getMissingOperation() != null) {
+            options.put("missingOperation", openApi.getMissingOperation());
+        }
+        if (openApi.getMockIncludePattern() != null) {
+            options.put("mockIncludePattern", openApi.getMockIncludePattern());
+        }
 
         // include optional description
         String description = openApi.getDescription();
@@ -1119,7 +1138,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
                 // register all the default values for the query and header parameters
                 RestParamType type = param.getType();
                 if ((RestParamType.query == type || RestParamType.header == type)
-                        && ObjectHelper.isNotEmpty(param.getDefaultValue())) {
+                    && ObjectHelper.isNotEmpty(param.getDefaultValue())) {
                     binding.addDefaultValue(param.getName(), parseText(camelContext, param.getDefaultValue()));
                 }
                 // register which parameters are required
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 754fdcd576c..3d97bfcbcbb 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
@@ -3303,6 +3303,9 @@ public class ModelParser extends BaseParser {
         return doParse(new OpenApiDefinition(), (def, key, val) -> {
             switch (key) {
                 case "disabled": def.setDisabled(val); break;
+                case "missingOperation": def.setMissingOperation(val); break;
+                case "mockIncludePattern": def.setMockIncludePattern(val); break;
+                case "routeId": def.setRouteId(val); break;
                 case "specification": def.setSpecification(val); break;
                 default: return optionalIdentifiedDefinitionAttributeHandler().accept(def, key, val);
             }
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 86c297846c1..c889b477c4f 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -4419,6 +4419,9 @@ public class ModelWriter extends BaseWriter {
             throws IOException {
         startElement(name);
         doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("mockIncludePattern", def.getMockIncludePattern());
+        doWriteAttribute("missingOperation", def.getMissingOperation());
+        doWriteAttribute("routeId", def.getRouteId());
         doWriteAttribute("specification", def.getSpecification());
         doWriteAttribute("disabled", def.getDisabled());
         endElement(name);
diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
index 00ba07c5722..4630515246d 100644
--- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
+++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
@@ -4419,6 +4419,9 @@ public class ModelWriter extends BaseWriter {
             throws IOException {
         startElement(name);
         doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("mockIncludePattern", def.getMockIncludePattern());
+        doWriteAttribute("missingOperation", def.getMissingOperation());
+        doWriteAttribute("routeId", def.getRouteId());
         doWriteAttribute("specification", def.getSpecification());
         doWriteAttribute("disabled", def.getDisabled());
         endElement(name);
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 2080a28405f..3aaddb6953b 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
@@ -10360,7 +10360,10 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     @YamlProperty(name = "description", type = "string", description = "Sets the description of this node", displayName = "Description"),
                     @YamlProperty(name = "disabled", type = "boolean", description = "Whether to disable all the REST services from the OpenAPI contract from the route during build time. Once an REST service has been disabled then it cannot be enabled later at runtime.", displayName = "Disabled"),
                     @YamlProperty(name = "id", type = "string", description = "Sets the id of this node", displayName = "Id"),
-                    @YamlProperty(name = "specification", type = "string", required = true, displayName = "Specification")
+                    @YamlProperty(name = "missingOperation", type = "enum:fail,ignore,mock", defaultValue = "fail", description = "Whether to fail, ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route.", displayName = "Missing Operation"),
+                    @YamlProperty(name = "mockIncludePattern", type = "string", defaultValue = "classpath:camel-mock/**", description = "Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma.", displayName = "Mock Include Pattern"),
+                    @YamlProperty(name = "routeId", type = "string", description = "Sets the id of the route", displayName = "Route Id"),
+                    @YamlProperty(name = "specification", type = "string", required = true, description = "Path to the OpenApi specification file.", displayName = "Specification")
             }
     )
     public static class OpenApiDefinitionDeserializer extends YamlDeserializerBase<OpenApiDefinition> {
@@ -10383,6 +10386,21 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     target.setDisabled(val);
                     break;
                 }
+                case "missingOperation": {
+                    String val = asText(node);
+                    target.setMissingOperation(val);
+                    break;
+                }
+                case "mockIncludePattern": {
+                    String val = asText(node);
+                    target.setMockIncludePattern(val);
+                    break;
+                }
+                case "routeId": {
+                    String val = asText(node);
+                    target.setRouteId(val);
+                    break;
+                }
                 case "specification": {
                     String val = asText(node);
                     target.setSpecification(val);
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index 00d55240b25..06660fe71d7 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
@@ -14689,9 +14689,28 @@
             "title" : "Id",
             "description" : "Sets the id of this node"
           },
+          "missingOperation" : {
+            "type" : "string",
+            "title" : "Missing Operation",
+            "description" : "Whether to fail, ignore or return a mock response for OpenAPI operations that are not mapped to a corresponding route.",
+            "default" : "fail",
+            "enum" : [ "fail", "ignore", "mock" ]
+          },
+          "mockIncludePattern" : {
+            "type" : "string",
+            "title" : "Mock Include Pattern",
+            "description" : "Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma.",
+            "default" : "classpath:camel-mock/**"
+          },
+          "routeId" : {
+            "type" : "string",
+            "title" : "Route Id",
+            "description" : "Sets the id of the route"
+          },
           "specification" : {
             "type" : "string",
-            "title" : "Specification"
+            "title" : "Specification",
+            "description" : "Path to the OpenApi specification file."
           }
         },
         "required" : [ "specification" ]