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:16 UTC

(camel) 02/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 f16ac201f93820edf222cfdd9f21551ed94d96d5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Mar 24 12:19:57 2024 +0100

    CAMEL-20557: Rest DSL to use openapi spec directly
---
 .../component/rest/openapi/RestOpenApiEndpoint.java | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
index 0bd4ca6a251..bb80f463521 100644
--- a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
+++ b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
@@ -175,6 +175,11 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
         setExchangePattern(ExchangePattern.InOut);
     }
 
+    @Override
+    public RestOpenApiComponent getComponent() {
+        return (RestOpenApiComponent) super.getComponent();
+    }
+
     @Override
     public Consumer createConsumer(final Processor processor) throws Exception {
         throw new UnsupportedOperationException("Consumer not supported");
@@ -310,10 +315,6 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
         return requestValidationLevels;
     }
 
-    RestOpenApiComponent component() {
-        return (RestOpenApiComponent) getComponent();
-    }
-
     Producer createProducerFor(
             final OpenAPI openapi, final Operation operation, final String method,
             final String uriTemplate)
@@ -334,7 +335,7 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
         // let the rest endpoint configure itself
         endpoint.configureProperties(params);
 
-        RestOpenApiComponent component = component();
+        RestOpenApiComponent component = getComponent();
         RequestValidator requestValidator = null;
         if (component.isRequestValidationEnabled() || requestValidationEnabled) {
             requestValidator = configureRequestValidator(openapi, operation, method, uriTemplate);
@@ -350,7 +351,7 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
             return basePath;
         }
 
-        final String componentBasePath = component().getBasePath();
+        final String componentBasePath = getComponent().getBasePath();
         if (isNotEmpty(componentBasePath)) {
             return componentBasePath;
         }
@@ -414,7 +415,7 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
     }
 
     String determineComponentName() {
-        return Optional.ofNullable(componentName).orElse(component().getComponentName());
+        return Optional.ofNullable(componentName).orElse(getComponent().getComponentName());
     }
 
     Map<String, Object> determineEndpointParameters(final OpenAPI openapi, final Operation operation) {
@@ -430,7 +431,7 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
             parameters.put("host", host);
         }
 
-        final RestOpenApiComponent component = component();
+        final RestOpenApiComponent component = getComponent();
 
         // what we consume is what the API defined by OpenApi specification
         // produces
@@ -520,7 +521,7 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
             return host;
         }
 
-        final String componentHost = component().getHost();
+        final String componentHost = getComponent().getHost();
         if (isNotEmpty(componentHost)) {
             return componentHost;
         }
@@ -672,7 +673,7 @@ public final class RestOpenApiEndpoint extends DefaultEndpoint {
     }
 
     RequestValidator configureRequestValidator(OpenAPI openapi, Operation operation, String method, String uriTemplate) {
-        RestOpenApiComponent component = component();
+        RestOpenApiComponent component = getComponent();
         RequestValidationCustomizer validationCustomizer = requestValidationCustomizer;
         if (validationCustomizer == null) {
             validationCustomizer = component.getRequestValidationCustomizer();