public Shape getEndShape() {
            Relationship last = tail();
            return last.getNeighborShape()
                    .orElseThrow(() -> new SourceException(
                            "Relationship points to a shape that is invalid: " + last,
                            last.getShape()));
        }
Gets the ending shape of the {@code Path} that
matched the selector and is connected to the
starting shape.

@return Returns the ending shape of the Path.
@throws SourceException if the last relationship is invalid.
smithy-model/src/main/java/software/amazon/smithy/model/selector/PathFinder.java