class URLPathUtils {

    private static String sanitizeUrl(String url) {
        if (url != null) {
            if (url.startsWith("//")) {
                url = "http:" + url;
                once(LOGGER).warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
            } else if (url.startsWith("/")) {
                url = LOCAL_HOST + url;
                once(LOGGER).info("'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [{}] for server URL [{}]", LOCAL_HOST, url);
            } else if (!url.matches("[a-zA-Z][0-9a-zA-Z.+\\-]+://.+")) {
                // Add http scheme for urls without a scheme.
                // 2.0 spec is restricted to the following schemes: "http", "https", "ws", "wss"
                // 3.0 spec does not have an enumerated list of schemes
                // This regex attempts to capture all schemes in IANA example schemes which
                // can have alpha-numeric characters and [.+-]. Examples are here:
                // https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
                url = "http://" + url;
                once(LOGGER).warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
            }
        }
        return url;
    }

}