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/11/12 17:31:32 UTC
(camel) branch camel-4.8.x updated: CAMEL-21430 Generated produces string now includes media types from all responses. (#16242)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.8.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.8.x by this push:
new b87aba34d8b CAMEL-21430 Generated produces string now includes media types from all responses. (#16242)
b87aba34d8b is described below
commit b87aba34d8bedfd09141ee191e5bd273dda7a4bb
Author: Calle <ca...@users.noreply.github.com>
AuthorDate: Tue Nov 12 18:31:24 2024 +0100
CAMEL-21430 Generated produces string now includes media types from all responses. (#16242)
---
.../apache/camel/component/rest/openapi/RestOpenApiProcessor.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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 45d3b8e48b8..a947a2505cb 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
@@ -226,12 +226,17 @@ public class RestOpenApiProcessor extends DelegateAsyncProcessor implements Came
}
// the operation may have specific information what it can produce
if (o.getResponses() != null) {
+ HashSet<String> mediaTypes = new HashSet<>();
for (var a : o.getResponses().values()) {
Content c = a.getContent();
if (c != null) {
- produces = c.keySet().stream().sorted().collect(Collectors.joining(","));
+ mediaTypes.addAll(c.keySet());
}
}
+
+ if (!mediaTypes.isEmpty()) {
+ produces = mediaTypes.stream().sorted().collect(Collectors.joining(","));
+ }
}
bc.setConsumes(consumes);
bc.setProduces(produces);