The updated logic now gracefully handles optional revisions
by defaulting to an empty string ("") when the revision is not present.
This change ensures that capabilities for Yang models without
a specified revision can be retrieved successfully, aligning
with modifications in the netconf module that now require an
empty string to represent models without a revision.
JIRA: NETCONF-1263
Change-Id: I65da21f877f572cc227ac5ec1ca8c76bf66a8b77
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
final var capabilityList = capabilityMultiMap.get(moduleName);
if (revision.isPresent()) {
for (var capability : capabilityList) {
- if (capability.getRevision().orElseThrow().equals(revision.orElseThrow())) {
+ if (capability.getRevision().orElse("").equals(revision.orElseThrow())) {
return capability.getCapabilitySchema().orElseThrow();
}
}