private List<ValidationEvent> validateEndpointPatterns(
            ServiceShape serviceShape,
            FromSourceLocation location,
            String endpoint
    ) {
        List<ValidationEvent> events = new ArrayList<>();

        Matcher m = PATTERN.matcher(endpoint);
        List<String> unsupportedPatterns = new ArrayList<>();
        while (m.find()) {
            if (!SUPPORTED_PATTERNS.contains(m.group())) {
                unsupportedPatterns.add(m.group());
            }
        }

        if (!unsupportedPatterns.isEmpty()) {
            events.add(danger(
                    serviceShape,
                    location,
                    String.format("Endpoint `%s` contains unsupported patterns: %s",
                            endpoint,
                            String.join(", ", unsupportedPatterns)),
                    "UnsupportedEndpointPattern"));
        }

        if (!(endpoint.startsWith("http://") || endpoint.startsWith("https://"))) {
            events.add(danger(
                    serviceShape,
                    location,
                    String.format("Endpoint `%s` should start with scheme `http://` or `https://`",
                            endpoint),
                    "InvalidEndpointPatternScheme"));
        }

        if (!isValidUrl(endpoint)) {
            events.add(error(
                    serviceShape,
                    location,
                    String.format("Endpoint `%s` should be a valid URL.",
                            endpoint),
                    "InvalidEndpointPatternUrl"));
        }

        return events;
    }
Validate special case endpoints from endpoint traits that are applied on a service.
smithy-aws-endpoints/src/main/java/software/amazon/smithy/rulesengine/aws/validators/AwsSpecialCaseEndpointValidator.java