Fix wrong path reference - schema for actions 17/110017/2
authorlubos-cicut <lubos.cicut@pantheon.tech>
Fri, 26 Jan 2024 12:38:20 +0000 (13:38 +0100)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Mon, 29 Jan 2024 13:31:09 +0000 (13:31 +0000)
Last patch lost pre-rewrite logic. This patch applies old logic again.

JIRA: NETCONF-938
Change-Id: I76c960d324b487a8de101a0949ba3214685f34e4
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/PathsStream.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PostEntity.java

index 01ed0346e8affac94a571b8e2422e4a0b972d67e..9f5671168bab167961680ad234e677487a1ba39f 100644 (file)
@@ -152,7 +152,7 @@ public final class PathsStream extends InputStream {
                     final var localName = moduleName + ":" + nodeLocalName;
                     final var path = urlPrefix + "/" + processPath(node, pathParams, localName);
                     processChildNode(node, pathParams, moduleName, result, path, nodeLocalName, isConfig, schemaContext,
-                        deviceName, basePath, node);
+                        deviceName, basePath, null);
                 }
             }
         }
index 309cf3cfa6341216f5dc2e667e73ebfe4af02fa1..1864793adef201326c28aabc2cfab39ac612bc6e 100644 (file)
@@ -210,13 +210,14 @@ public final class PostEntity extends OperationEntity {
     }
 
     private String processOperationsRef(final OperationDefinition def, final String operationName, final String suf) {
-        final var ref = COMPONENTS_PREFIX + moduleName() + "_" + operationName + suf;
         if (def instanceof ActionDefinition && parentNode != null) {
             final var parentName = ((DataSchemaNode) parentNode).getQName().getLocalName();
-            if (!operationName.contains(parentName)) {
+            final boolean hasChildNodes = suf.equals(INPUT_SUFFIX) ? !def.getInput().getChildNodes().isEmpty()
+                    : !def.getOutput().getChildNodes().isEmpty();
+            if (hasChildNodes) {
                 return COMPONENTS_PREFIX + moduleName() + "_" + parentName + "_" + operationName + suf;
             }
         }
-        return ref;
+        return COMPONENTS_PREFIX + moduleName() + "_" + operationName + suf;
     }
 }