Bug 3887 - Autogenerated API documentation doesn't show application/xml 78/24378/2
authorJan Hajnar <jhajnar@cisco.com>
Wed, 1 Jul 2015 09:03:44 +0000 (11:03 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 22 Jul 2015 08:13:28 +0000 (08:13 +0000)
as an option for RPC operations

* added xml input option for rpcs, put and post methods

Change-Id: I1f73bcb7d1127e4b4324d779aec40907ca627073
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
(cherry picked from commit e57d9461b79dedd8ef9edf8f249b066540fd0e9d)

opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java
opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/model/builder/OperationBuilder.java

index c86b89c004b645aa42e31b86320077278ff23551..c40eca00513dd005b5bed6d24335015ce36000cf 100644 (file)
@@ -372,6 +372,7 @@ public class BaseYangSwaggerGenerator {
             payload.setParamType("body");
             payload.setType("(" + rpcDefn.getQName().getLocalName() + ")input");
             operationSpec.setParameters(Collections.singletonList(payload));
             payload.setParamType("body");
             payload.setType("(" + rpcDefn.getQName().getLocalName() + ")input");
             operationSpec.setParameters(Collections.singletonList(payload));
+            operationSpec.setConsumes(OperationBuilder.CONSUMES_PUT_POST);
         }
 
         rpc.setOperations(Arrays.asList(operationSpec));
         }
 
         rpc.setOperations(Arrays.asList(operationSpec));
index 38c5f7264adf0a8551382c91b8e557d2013df0ac..88ca3bcd018c150a9c795fe7abbc7e5335a19526 100644 (file)
@@ -21,6 +21,12 @@ public final class OperationBuilder {
     public static final String OPERATIONAL = "(operational)";
     public static final String CONFIG = "(config)";
 
     public static final String OPERATIONAL = "(operational)";
     public static final String CONFIG = "(config)";
 
+    public static final List<String> CONSUMES_PUT_POST = new ArrayList<>();
+    static {
+        CONSUMES_PUT_POST.add("application/json");
+        CONSUMES_PUT_POST.add("application/xml");
+    }
+
     public static class Get {
 
         protected Operation spec;
     public static class Get {
 
         protected Operation spec;
@@ -57,6 +63,7 @@ public final class OperationBuilder {
             spec = new Operation();
             spec.setType(CONFIG + nodeName);
             spec.setNotes(description);
             spec = new Operation();
             spec.setType(CONFIG + nodeName);
             spec.setNotes(description);
+            spec.setConsumes(CONSUMES_PUT_POST);
         }
 
         public Put pathParams(List<Parameter> params) {
         }
 
         public Put pathParams(List<Parameter> params) {
@@ -85,6 +92,7 @@ public final class OperationBuilder {
             super(nodeName, description);
             this.dataNodeContainer = dataNodeContainer;
             spec.setType(CONFIG + nodeName + METHOD_NAME);
             super(nodeName, description);
             this.dataNodeContainer = dataNodeContainer;
             spec.setType(CONFIG + nodeName + METHOD_NAME);
+            spec.setConsumes(CONSUMES_PUT_POST);
         }
 
         @Override
         }
 
         @Override