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:20 UTC
(camel) 06/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 bed697b46fd8b63f41210442a52d1130e533dd95
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Mar 24 13:53:44 2024 +0100
CAMEL-20557: Rest DSL to use openapi spec directly
---
.../component/platform/http/PlatformHttpComponent.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
index d57d96a76f1..7dfa58a4d02 100644
--- a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
+++ b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
@@ -34,6 +34,7 @@ import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.RestApiConsumerFactory;
import org.apache.camel.spi.RestConfiguration;
import org.apache.camel.spi.RestConsumerFactory;
+import org.apache.camel.spi.RestOpenApiConsumerFactory;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.DefaultComponent;
@@ -48,7 +49,8 @@ import org.slf4j.LoggerFactory;
* Exposes HTTP endpoints leveraging the given platform's (SpringBoot, WildFly, Quarkus, ...) HTTP server.
*/
@Component("platform-http")
-public class PlatformHttpComponent extends DefaultComponent implements RestConsumerFactory, RestApiConsumerFactory {
+public class PlatformHttpComponent extends DefaultComponent
+ implements RestConsumerFactory, RestApiConsumerFactory, RestOpenApiConsumerFactory {
private static final Logger LOG = LoggerFactory.getLogger(PlatformHttpComponent.class);
@@ -101,6 +103,15 @@ public class PlatformHttpComponent extends DefaultComponent implements RestConsu
parameters, false);
}
+ @Override
+ public Consumer createConsumer(
+ CamelContext camelContext, Processor processor, String contextPath, RestConfiguration configuration,
+ Map<String, Object> parameters)
+ throws Exception {
+ return doCreateConsumer(camelContext, processor, null, contextPath, null, null, null, configuration,
+ parameters, true);
+ }
+
/**
* Adds a known http endpoint managed by this component.
*/
@@ -224,8 +235,9 @@ public class PlatformHttpComponent extends DefaultComponent implements RestConsu
if (api) {
map.put("matchOnUriPrefix", "true");
}
-
- RestComponentHelper.addHttpRestrictParam(map, verb, cors);
+ if (verb != null) {
+ RestComponentHelper.addHttpRestrictParam(map, verb, cors);
+ }
String url = RestComponentHelper.createRestConsumerUrl("platform-http", path, map);