private boolean isAllowableConflict(
            Model model,
            SmithyPattern pattern,
            OperationShape operation,
            SmithyPattern otherPattern,
            OperationShape otherOperation,
            BiFunction<Model, OperationShape, Map<String, Pattern>> getLabelPatterns
    ) {

        Map<Segment, Segment> conflictingLabelSegments = pattern.getConflictingLabelSegmentsMap(otherPattern);

        // If there aren't any conflicting label segments that means the uris are identical, which is not allowable.
        if (conflictingLabelSegments.isEmpty()) {
            return false;
        }

        Map<String, Pattern> labelPatterns = getLabelPatterns.apply(model, operation);
        Map<String, Pattern> otherLabelPatterns = getLabelPatterns.apply(model, otherOperation);

        return conflictingLabelSegments.entrySet()
                .stream()
                // Only allow conflicts in cases where one of the segments is static and the other is a label.
                .filter(conflict -> conflict.getKey().isLabel() != conflict.getValue().isLabel())
                // Only allow the uris to conflict if every conflicting segment is allowable.
                .allMatch(conflict -> {
                    Pattern p;
                    String staticSegment;

                    if (conflict.getKey().isLabel()) {
                        p = labelPatterns.get(conflict.getKey().getContent());
                        staticSegment = conflict.getValue().getContent();
                    } else {
                        p = otherLabelPatterns.get(conflict.getValue().getContent());
                        staticSegment = conflict.getKey().getContent();
                    }

                    if (p == null) {
                        return false;
                    }

                    // If the pattern on the label segment does not match the static segment, then this segment's
                    // conflict is allowable.
                    return !p.matcher(staticSegment).find();
                });
    }
Validates that no two URIs in a service conflict with each other.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HttpUriConflictValidator.java