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
The following commit(s) were added to refs/heads/main by this push:
new 3839b8830f9 Remove duplicated code in Rest OpenAPI (#18514)
3839b8830f9 is described below
commit 3839b8830f9f4ba53fd9a3c562293cfb1d64f02c
Author: Federico Mariani <[email protected]>
AuthorDate: Wed Jul 2 07:07:41 2025 +0200
Remove duplicated code in Rest OpenAPI (#18514)
* Remove duplicated code in Rest OpenAPI
* Consider Upgrade Recipes micro releases
---
.../component/rest/openapi/RestOpenApiComponent.java | 1 -
.../component/rest/openapi/RestOpenApiProcessor.java | 1 -
.../camel/dsl/jbang/core/commands/update/UpdateList.java | 15 ++++++++++++++-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
index 9c06f57b0a0..095fdfd48d3 100644
---
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
+++
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiComponent.java
@@ -172,7 +172,6 @@ public final class RestOpenApiComponent extends
DefaultComponent implements SSLC
}
endpoint.setProduces(getProduces());
endpoint.setRequestValidationEnabled(isRequestValidationEnabled());
-
endpoint.setRestOpenapiProcessorStrategy(getRestOpenapiProcessorStrategy());
if (getSpecificationUri() != null) {
endpoint.setSpecificationUri(getSpecificationUri());
}
diff --git
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
index 1f7218b7f32..61ea55d6ef6 100644
---
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
+++
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
@@ -175,7 +175,6 @@ public class RestOpenApiProcessor extends
DelegateAsyncProcessor implements Came
bc.getProduces(), bc.getType(), bc.getOutType(),
routeId, desc);
RestBindingAdvice binding =
RestBindingAdviceFactory.build(camelContext, bc);
- RestBindingAdviceFactory.build(camelContext, bc);
ServiceHelper.buildService(binding);
paths.add(new RestOpenApiConsumerPath(v, path, o.getValue(),
binding));
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/update/UpdateList.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/update/UpdateList.java
index 9939869ddb5..f5ae2408d71 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/update/UpdateList.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/update/UpdateList.java
@@ -124,8 +124,21 @@ public class UpdateList extends CamelCommand {
l[0], "Camel", "",
"Migrates Apache Camel 4 application to
Apache Camel " + l[0])));
recipesVersions.camelSpringBootRecipesVersion().forEach(l -> {
+
String[] runtimeVersion
- = recipesVersions.sbVersions().stream().filter(v ->
v[0].equals(l[0])).findFirst().orElseThrow();
+ = recipesVersions.sbVersions().stream().filter(v ->
v[0].equals(l[0])).findFirst().orElse(null);
+
+ // There may be Camel recipes releases that do not follow
Camel Spring Boot micro version, for example
+ // upgrade recipes 4.12.1 was released, but only Camel 4.12.0
is released, in this case,
+ // consider the major.minor only
+ if (runtimeVersion == null) {
+ String majorMinorVersion = l[0].substring(0,
l[0].lastIndexOf("."));
+ runtimeVersion
+ = recipesVersions.sbVersions().stream()
+ .filter(v -> v[0].substring(0,
v[0].lastIndexOf(".")).equals(majorMinorVersion)).findFirst()
+ .orElseThrow(
+ () -> new
IllegalStateException("No version found for " + l[0]));
+ }
rows.add(new Row(
l[0], "Camel Spring Boot", runtimeVersion[1],