andrea
Committed by Gerrit Code Review

[ONOS-3406] change consumes type in SwaggerUI for REST post method to octet_stream

Change-Id: I1c4917eb743c1d5dfe8e276074f0c8f484c75ed2
...@@ -66,6 +66,7 @@ public class OnosSwaggerMojo extends AbstractMojo { ...@@ -66,6 +66,7 @@ public class OnosSwaggerMojo extends AbstractMojo {
66 private static final String PRODUCES = "javax.ws.rs.Produces"; 66 private static final String PRODUCES = "javax.ws.rs.Produces";
67 private static final String CONSUMES = "javax.ws.rs.Consumes"; 67 private static final String CONSUMES = "javax.ws.rs.Consumes";
68 private static final String JSON = "MediaType.APPLICATION_JSON"; 68 private static final String JSON = "MediaType.APPLICATION_JSON";
69 + private static final String OCTET_STREAM = "MediaType.APPLICATION_OCTET_STREAM";
69 70
70 /** 71 /**
71 * The directory where the generated catalogue file will be put. 72 * The directory where the generated catalogue file will be put.
...@@ -327,7 +328,6 @@ public class OnosSwaggerMojo extends AbstractMojo { ...@@ -327,7 +328,6 @@ public class OnosSwaggerMojo extends AbstractMojo {
327 } 328 }
328 329
329 // Temporary solution to add responses to a method 330 // Temporary solution to add responses to a method
330 - // TODO Provide annotations in the web resources for responses and parse them
331 private void addResponses(ObjectNode methodNode, DocletTag tag, boolean responseJson) { 331 private void addResponses(ObjectNode methodNode, DocletTag tag, boolean responseJson) {
332 ObjectNode responses = mapper.createObjectNode(); 332 ObjectNode responses = mapper.createObjectNode();
333 methodNode.set("responses", responses); 333 methodNode.set("responses", responses);
...@@ -352,6 +352,8 @@ public class OnosSwaggerMojo extends AbstractMojo { ...@@ -352,6 +352,8 @@ public class OnosSwaggerMojo extends AbstractMojo {
352 private String getIOType(JavaAnnotation annotation) { 352 private String getIOType(JavaAnnotation annotation) {
353 if (annotation.getNamedParameter("value").toString().equals(JSON)) { 353 if (annotation.getNamedParameter("value").toString().equals(JSON)) {
354 return "application/json"; 354 return "application/json";
355 + } else if (annotation.getNamedParameter("value").toString().equals(OCTET_STREAM)){
356 + return "application/octet_stream";
355 } 357 }
356 return ""; 358 return "";
357 } 359 }
......