This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.14.x by this push:
     new bae5d97a7088 CAMEL-22790: Fix multiple produces (xml, json) in REST 
for OpenApi (#20514)
bae5d97a7088 is described below

commit bae5d97a7088d27acc2cea03241d37e32c3cebc1
Author: Darius <[email protected]>
AuthorDate: Fri Dec 19 02:23:56 2025 -0500

    CAMEL-22790: Fix multiple produces (xml, json) in REST for OpenApi (#20514)
---
 .../java/org/apache/camel/openapi/RestOpenApiReader.java  | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git 
a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
 
b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
index 6c60b4ef4dc0..a180bd29c79b 100644
--- 
a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
+++ 
b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java
@@ -693,19 +693,18 @@ public class RestOpenApiReader {
                 op.setResponses(new ApiResponses());
             }
 
-            String[] parts;
             if (produces != null) {
-                parts = produces.split(",");
+                ApiResponse response = new ApiResponse().description("OK");
+                Content responseContent = new Content();
+                Schema<?> model = modelTypeAsProperty(getValue(camelContext, 
verb.getOutType()), openApi);
+                String[] parts = produces.split(",");
                 for (String produce : parts) {
-                    ApiResponse response = new 
ApiResponse().description("Output type"); // ??
-                    Content responseContent = new Content();
                     MediaType contentType = new MediaType();
-                    responseContent.addMediaType(produce, contentType);
-                    Schema<?> model = 
modelTypeAsProperty(getValue(camelContext, verb.getOutType()), openApi);
                     contentType.setSchema(model);
-                    response.setContent(responseContent);
-                    op.getResponses().addApiResponse("200", response);
+                    responseContent.addMediaType(produce, contentType);
                 }
+                response.setContent(responseContent);
+                op.getResponses().addApiResponse("200", response);
             }
         }
 

Reply via email to