From 186d26b1a7efe5f97cc7c2c1caffeffd02871df3 Mon Sep 17 00:00:00 2001 From: lubos-cicut Date: Fri, 26 Jan 2024 13:38:20 +0100 Subject: [PATCH] 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 --- .../opendaylight/restconf/openapi/impl/PathsStream.java | 2 +- .../opendaylight/restconf/openapi/model/PostEntity.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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; } } -- 2.36.6