GERONIMO-6689 don't loose default return type
authorRomain Manni-Bucau <rmannibucau@gmail.com>
Mon, 21 Jan 2019 10:42:43 +0000 (11:42 +0100)
committerRomain Manni-Bucau <rmannibucau@gmail.com>
Mon, 21 Jan 2019 10:42:43 +0000 (11:42 +0100)
geronimo-openapi-impl/src/main/java/org/apache/geronimo/microprofile/openapi/impl/processor/AnnotationProcessor.java

index 6f6981e..b691b7f 100644 (file)
@@ -383,7 +383,12 @@ public class AnnotationProcessor {
                 impl.setSchema(schemaProcessor.mapSchemaFromClass(api.getComponents(), m.getReturnType()));
                 produces.orElseGet(() -> singletonList("*/*")).forEach(key -> content.put(key, impl));
             }
-            responses.defaultValue(new APIResponseImpl().description("default response").content(content));
+            final org.eclipse.microprofile.openapi.models.responses.APIResponse defaultResponse =
+                    new APIResponseImpl().description("default response").content(content);
+            responses.put(
+                    m.getReturnType() == void.class || m.getReturnType() == Void.class && normalResponse ?
+                            "204" : "200", defaultResponse);
+            responses.defaultValue(defaultResponse);
         }
         return operation;
     }