[GERONIMO-6689] use default for default responses
authorDennis Kieselhorst <mail@dekies.de>
Mon, 21 Jan 2019 10:14:10 +0000 (11:14 +0100)
committerDennis Kieselhorst <dennis.kieselhorst@eventim.de>
Mon, 21 Jan 2019 10:14:10 +0000 (11:14 +0100)
geronimo-openapi-impl/src/main/java/org/apache/geronimo/microprofile/openapi/impl/model/APIResponsesImpl.java
geronimo-openapi-impl/src/main/java/org/apache/geronimo/microprofile/openapi/impl/processor/AnnotationProcessor.java

index 55e2a4d..ea13e42 100644 (file)
@@ -40,6 +40,7 @@ public class APIResponsesImpl extends LinkedHashMap<String, APIResponse> impleme
     }
 
     @Override
+    @JsonbProperty("default")
     public APIResponse getDefault() {
         return _default;
     }
index 765a43e..0ce3eef 100644 (file)
@@ -378,10 +378,7 @@ public class AnnotationProcessor {
                 impl.setSchema(schemaProcessor.mapSchemaFromClass(api.getComponents(), m.getReturnType()));
                 produces.orElseGet(() -> singletonList("*/*")).forEach(key -> content.put(key, impl));
             }
-            responses.put(
-                    m.getReturnType() == void.class || m.getReturnType() == Void.class && normalResponse ?
-                            "204" : "200",
-                    new APIResponseImpl().content(content));
+            responses.defaultValue(new APIResponseImpl().description("default response").content(content));
         }
         return operation;
     }