[ONOS-3406] change consumes type in SwaggerUI for REST post method to octet_stream
Change-Id: I1c4917eb743c1d5dfe8e276074f0c8f484c75ed2
diff --git a/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java b/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
index a75127a..5d5c591 100644
--- a/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
+++ b/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
@@ -66,6 +66,7 @@
private static final String PRODUCES = "javax.ws.rs.Produces";
private static final String CONSUMES = "javax.ws.rs.Consumes";
private static final String JSON = "MediaType.APPLICATION_JSON";
+ private static final String OCTET_STREAM = "MediaType.APPLICATION_OCTET_STREAM";
/**
* The directory where the generated catalogue file will be put.
@@ -327,7 +328,6 @@
}
// Temporary solution to add responses to a method
- // TODO Provide annotations in the web resources for responses and parse them
private void addResponses(ObjectNode methodNode, DocletTag tag, boolean responseJson) {
ObjectNode responses = mapper.createObjectNode();
methodNode.set("responses", responses);
@@ -352,6 +352,8 @@
private String getIOType(JavaAnnotation annotation) {
if (annotation.getNamedParameter("value").toString().equals(JSON)) {
return "application/json";
+ } else if (annotation.getNamedParameter("value").toString().equals(OCTET_STREAM)){
+ return "application/octet_stream";
}
return "";
}