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:17 UTC
(camel) 03/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 50d3a0bf492774b22658a7c89e75eac537b9b019
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Mar 24 12:29:31 2024 +0100
CAMEL-20557: Rest DSL to use openapi spec directly
---
.../camel/catalog/components/platform-http.json | 4 +-
.../component/platform/http/platform-http.json | 4 +-
.../platform/http/PlatformHttpEndpoint.java | 10 ++---
.../dsl/PlatformHttpEndpointBuilderFactory.java | 32 ++++++++-------
.../camel/kotlin/components/RestOpenapiUriDsl.kt | 48 +++++++++++-----------
5 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
index 9f2fb17af36..1ad05ba7677 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/platform-http.json
@@ -41,8 +41,8 @@
"matchOnUriPrefix": { "index": 9, "kind": "parameter", "displayName": "Match On Uri Prefix", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found." },
"muteException": { "index": 10, "kind": "parameter", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace." },
"produces": { "index": 11, "kind": "parameter", "displayName": "Produces", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The content type this endpoint produces, such as application\/xml or application\/json." },
- "useCookieHandler": { "index": 12, "kind": "parameter", "displayName": "Use Cookie Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the Cookie Handler that allows Cookie addition, expiry, and retrieval (currently only supported by camel-platform-http-vertx)" },
- "useStreaming": { "index": 13, "kind": "parameter", "displayName": "Use Streaming", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use streaming for large requests and responses (currently only supported by camel-platform-http-vertx)" },
+ "useCookieHandler": { "index": 12, "kind": "parameter", "displayName": "Use Cookie Handler", "group": "consumer", "label": "advanced,consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the Cookie Handler that allows Cookie addition, expiry, and retrieval (currently only supported by camel-platform-http-vertx)" },
+ "useStreaming": { "index": 13, "kind": "parameter", "displayName": "Use Streaming", "group": "consumer", "label": "advanced,consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use streaming for large requests and responses (currently only supported by camel-platform-http-vertx)" },
"bridgeErrorHandler": { "index": 14, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...]
"exceptionHandler": { "index": 15, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...]
"exchangePattern": { "index": 16, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
diff --git a/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json b/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
index 9f2fb17af36..1ad05ba7677 100644
--- a/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
+++ b/components/camel-platform-http/src/generated/resources/META-INF/org/apache/camel/component/platform/http/platform-http.json
@@ -41,8 +41,8 @@
"matchOnUriPrefix": { "index": 9, "kind": "parameter", "displayName": "Match On Uri Prefix", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found." },
"muteException": { "index": 10, "kind": "parameter", "displayName": "Mute Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace." },
"produces": { "index": 11, "kind": "parameter", "displayName": "Produces", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The content type this endpoint produces, such as application\/xml or application\/json." },
- "useCookieHandler": { "index": 12, "kind": "parameter", "displayName": "Use Cookie Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the Cookie Handler that allows Cookie addition, expiry, and retrieval (currently only supported by camel-platform-http-vertx)" },
- "useStreaming": { "index": 13, "kind": "parameter", "displayName": "Use Streaming", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use streaming for large requests and responses (currently only supported by camel-platform-http-vertx)" },
+ "useCookieHandler": { "index": 12, "kind": "parameter", "displayName": "Use Cookie Handler", "group": "consumer", "label": "advanced,consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to enable the Cookie Handler that allows Cookie addition, expiry, and retrieval (currently only supported by camel-platform-http-vertx)" },
+ "useStreaming": { "index": 13, "kind": "parameter", "displayName": "Use Streaming", "group": "consumer", "label": "advanced,consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to use streaming for large requests and responses (currently only supported by camel-platform-http-vertx)" },
"bridgeErrorHandler": { "index": 14, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...]
"exceptionHandler": { "index": 15, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By de [...]
"exchangePattern": { "index": 16, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
diff --git a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
index 22597ccf8ca..7cf295a1022 100644
--- a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
+++ b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
@@ -73,15 +73,13 @@ public class PlatformHttpEndpoint extends DefaultEndpoint implements AsyncEndpoi
@UriParam(label = "advanced",
description = "To use a custom HeaderFilterStrategy to filter headers to and from Camel message.")
private HeaderFilterStrategy headerFilterStrategy = new PlatformHttpHeaderFilterStrategy();
- @UriParam(label = "consumer",
+ @UriParam(label = "advanced,consumer",
description = "Whether to use streaming for large requests and responses (currently only supported by camel-platform-http-vertx)")
private boolean useStreaming;
-
- @UriParam(label = "consumer", description = "The properties set on a Cookies when a Cookie is added via the"
- + " Cookie Handler (currently only supported by camel-platform-http-vertx)")
+ @UriParam(label = "advanced,consumer", description = "The properties set on a Cookies when a Cookie is added via the"
+ + " Cookie Handler (currently only supported by camel-platform-http-vertx)")
private CookieConfiguration cookieConfiguration = new CookieConfiguration();
-
- @UriParam(label = "consumer",
+ @UriParam(label = "advanced,consumer",
description = "Whether to enable the Cookie Handler that allows Cookie addition, expiry, and retrieval"
+ " (currently only supported by camel-platform-http-vertx)")
private boolean useCookieHandler;
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
index 9d1d899ff44..8eb2ab379d3 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PlatformHttpEndpointBuilderFactory.java
@@ -320,6 +320,17 @@ public interface PlatformHttpEndpointBuilderFactory {
doSetProperty("produces", produces);
return this;
}
+ }
+
+ /**
+ * Advanced builder for endpoint for the Platform HTTP component.
+ */
+ public interface AdvancedPlatformHttpEndpointBuilder
+ extends
+ EndpointConsumerBuilder {
+ default PlatformHttpEndpointBuilder basic() {
+ return (PlatformHttpEndpointBuilder) this;
+ }
/**
* Whether to enable the Cookie Handler that allows Cookie addition,
* expiry, and retrieval (currently only supported by
@@ -333,7 +344,7 @@ public interface PlatformHttpEndpointBuilderFactory {
* @param useCookieHandler the value to set
* @return the dsl builder
*/
- default PlatformHttpEndpointBuilder useCookieHandler(
+ default AdvancedPlatformHttpEndpointBuilder useCookieHandler(
boolean useCookieHandler) {
doSetProperty("useCookieHandler", useCookieHandler);
return this;
@@ -352,7 +363,7 @@ public interface PlatformHttpEndpointBuilderFactory {
* @param useCookieHandler the value to set
* @return the dsl builder
*/
- default PlatformHttpEndpointBuilder useCookieHandler(
+ default AdvancedPlatformHttpEndpointBuilder useCookieHandler(
String useCookieHandler) {
doSetProperty("useCookieHandler", useCookieHandler);
return this;
@@ -369,7 +380,8 @@ public interface PlatformHttpEndpointBuilderFactory {
* @param useStreaming the value to set
* @return the dsl builder
*/
- default PlatformHttpEndpointBuilder useStreaming(boolean useStreaming) {
+ default AdvancedPlatformHttpEndpointBuilder useStreaming(
+ boolean useStreaming) {
doSetProperty("useStreaming", useStreaming);
return this;
}
@@ -386,21 +398,11 @@ public interface PlatformHttpEndpointBuilderFactory {
* @param useStreaming the value to set
* @return the dsl builder
*/
- default PlatformHttpEndpointBuilder useStreaming(String useStreaming) {
+ default AdvancedPlatformHttpEndpointBuilder useStreaming(
+ String useStreaming) {
doSetProperty("useStreaming", useStreaming);
return this;
}
- }
-
- /**
- * Advanced builder for endpoint for the Platform HTTP component.
- */
- public interface AdvancedPlatformHttpEndpointBuilder
- extends
- EndpointConsumerBuilder {
- default PlatformHttpEndpointBuilder basic() {
- return (PlatformHttpEndpointBuilder) this;
- }
/**
* Allows for bridging the consumer to the Camel routing Error Handler,
* which mean any exceptions (if possible) occurred while the Camel
diff --git a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
index c5670b48869..d1bc702cc63 100644
--- a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
+++ b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
@@ -77,16 +77,6 @@ public class RestOpenapiUriDsl(
it.property("basePath", basePath)
}
- /**
- * Name of the Camel component that will perform the requests. The component must be present in
- * Camel registry and it must implement RestProducerFactory service provider interface. If not set
- * CLASSPATH is searched for single component that implements RestProducerFactory SPI. Overrides
- * component configuration.
- */
- public fun componentName(componentName: String) {
- it.property("componentName", componentName)
- }
-
/**
* What payload type this component capable of consuming. Could be one type, like application/json
* or multiple types as application/json, application/xml; q=0.5 according to the RFC7231. This
@@ -117,14 +107,6 @@ public class RestOpenapiUriDsl(
it.property("produces", produces)
}
- /**
- * If request validation is enabled, this option provides the capability to customize the creation
- * of OpenApiInteractionValidator used to validate requests.
- */
- public fun requestValidationCustomizer(requestValidationCustomizer: String) {
- it.property("requestValidationCustomizer", requestValidationCustomizer)
- }
-
/**
* Enable validation of requests against the configured OpenAPI specification
*/
@@ -140,13 +122,13 @@ public class RestOpenapiUriDsl(
}
/**
- * Levels for specific OpenAPI request validation options. Multiple options can be specified as
- * URI options prefixed by 'validation.'. For example,
- * validation.request.body=ERROR&validation.request.body.unexpected=IGNORED. Supported values are
- * INFO, ERROR, WARN & IGNORE.
+ * Name of the Camel component that will perform the requests. The component must be present in
+ * Camel registry and it must implement RestProducerFactory service provider interface. If not set
+ * CLASSPATH is searched for single component that implements RestProducerFactory SPI. Overrides
+ * component configuration.
*/
- public fun requestValidationLevels(requestValidationLevels: String) {
- it.property("requestValidationLevels", requestValidationLevels)
+ public fun componentName(componentName: String) {
+ it.property("componentName", componentName)
}
/**
@@ -172,4 +154,22 @@ public class RestOpenapiUriDsl(
public fun lazyStartProducer(lazyStartProducer: Boolean) {
it.property("lazyStartProducer", lazyStartProducer.toString())
}
+
+ /**
+ * If request validation is enabled, this option provides the capability to customize the creation
+ * of OpenApiInteractionValidator used to validate requests.
+ */
+ public fun requestValidationCustomizer(requestValidationCustomizer: String) {
+ it.property("requestValidationCustomizer", requestValidationCustomizer)
+ }
+
+ /**
+ * Levels for specific OpenAPI request validation options. Multiple options can be specified as
+ * URI options prefixed by 'validation.'. For example,
+ * validation.request.body=ERROR&validation.request.body.unexpected=IGNORED. Supported values are
+ * INFO, ERROR, WARN & IGNORE.
+ */
+ public fun requestValidationLevels(requestValidationLevels: String) {
+ it.property("requestValidationLevels", requestValidationLevels)
+ }
}