- nnWriter = createNormalizedNodeWriter(context,
- ((ActionDefinition) context.getSchemaNode()).getOutput().getPath(), jsonWriter, depth, fields);
+ final ActionDefinition actDef = (ActionDefinition) context.getSchemaNode();
+ final List<QName> qNames = context.getInstanceIdentifier().getPathArguments().stream()
+ .filter(arg -> !(arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates))
+ .filter(arg -> !(arg instanceof YangInstanceIdentifier.AugmentationIdentifier))
+ .map(PathArgument::getNodeType)
+ .collect(Collectors.toList());
+ qNames.add(actDef.getQName());
+ qNames.add(actDef.getOutput().getQName());
+ final SchemaPath actPath = SchemaPath.of(Absolute.of(qNames));
+ nnWriter = createNormalizedNodeWriter(context, actPath, jsonWriter, depth, fields);