From: lubos-cicut Date: Fri, 26 Jan 2024 12:38:20 +0000 (+0100) Subject: Fix wrong path reference - schema for actions X-Git-Tag: v7.0.0~82 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=186d26b1a7efe5f97cc7c2c1caffeffd02871df3;p=netconf.git Fix wrong path reference - schema for actions Last patch lost pre-rewrite logic. This patch applies old logic again. JIRA: NETCONF-938 Change-Id: I76c960d324b487a8de101a0949ba3214685f34e4 Signed-off-by: lubos-cicut --- diff --git a/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/PathsStream.java b/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/PathsStream.java index 01ed0346e8..9f5671168b 100644 --- a/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/PathsStream.java +++ b/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/PathsStream.java @@ -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); } } } diff --git a/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PostEntity.java b/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PostEntity.java index 309cf3cfa6..1864793ade 100644 --- a/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PostEntity.java +++ b/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PostEntity.java @@ -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; } }