Separate logic of get root path
[netconf.git] / restconf / restconf-openapi / src / main / java / org / opendaylight / restconf / openapi / impl / PathsStream.java
index a8f8911934215bf9d8fcee96fdcab3c81a9150ec..8382614ad52948e15b5d3348de513497e5f825cb 100644 (file)
@@ -31,6 +31,7 @@ import java.util.stream.Collectors;
 import org.opendaylight.restconf.openapi.jaxrs.OpenApiBodyWriter;
 import org.opendaylight.restconf.openapi.model.DeleteEntity;
 import org.opendaylight.restconf.openapi.model.GetEntity;
+import org.opendaylight.restconf.openapi.model.GetRootEntity;
 import org.opendaylight.restconf.openapi.model.ParameterEntity;
 import org.opendaylight.restconf.openapi.model.ParameterSchemaEntity;
 import org.opendaylight.restconf.openapi.model.PatchEntity;
@@ -160,11 +161,9 @@ public final class PathsStream extends InputStream {
         final var result = new ArrayDeque<PathEntity>();
         if (includeDataStore && !hasAddedDataStore) {
             final var dataPath = basePath + DATA + urlPrefix;
-            result.add(new PathEntity(dataPath,
-                new GetEntity(null, deviceName, "data", null, null, false)));
+            result.add(new PathEntity(dataPath, new GetRootEntity(deviceName, "data")));
             final var operationsPath = basePath + OPERATIONS + urlPrefix;
-            result.add(new PathEntity(operationsPath,
-                new GetEntity(null, deviceName, "operations", null, null, false)));
+            result.add(new PathEntity(operationsPath, new GetRootEntity(deviceName, "operations")));
             hasAddedDataStore = true;
         }
         // RPC operations (via post) - RPCs have their own path