private Optional<Path> createPathTo(ToShapeId operationId, String memberName, RelationshipType rel) {
        OperationShape operation = model.getShape(operationId.toShapeId())
                .flatMap(Shape::asOperationShape)
                .orElse(null);

        if (operation == null) {
            return Optional.empty();
        }

        ShapeId structId = rel == RelationshipType.INPUT ? operation.getInputShape() : operation.getOutputShape();
        StructureShape struct = model.getShape(structId).flatMap(Shape::asStructureShape).orElse(null);

        if (struct == null) {
            return Optional.empty();
        }

        MemberShape member = struct.getMember(memberName).orElse(null);

        if (member == null) {
            return Optional.empty();
        }

        Shape target = model.getShape(member.getTarget()).orElse(null);

        if (target == null) {
            return Optional.empty();
        }

        Path path = new Path(Relationship.create(member, RelationshipType.MEMBER_TARGET, target), null);
        path = new Path(Relationship.create(struct, RelationshipType.STRUCTURE_MEMBER, member), path);
        path = new Path(Relationship.create(operation, rel, struct), path);
        return Optional.of(path);
    }
Creates a {@code Path} to an operation output member if it exists.

@param operationId Operation to start from.
@param memberName Output member name to find in the operation output.
@return Returns the optionally found {@code Path} to the member.
smithy-model/src/main/java/software/amazon/smithy/model/selector/PathFinder.java