Class URLPathUtils


  • public class URLPathUtils
    extends Object
    • Constructor Detail

      • URLPathUtils

        public URLPathUtils()
    • Method Detail

      • getServerURL

        public static URL getServerURL​(io.swagger.v3.oas.models.OpenAPI openAPI,
                                       Map<String,​String> userDefinedVariables)
      • getServerURL

        public static URL getServerURL​(io.swagger.v3.oas.models.servers.Server server,
                                       Map<String,​String> userDefinedVariables)
      • getScheme

        public static String getScheme​(io.swagger.v3.oas.models.OpenAPI openAPI,
                                       CodegenConfig config)
      • getPort

        public static String getPort​(URL url,
                                     int defaultPort)
        Return the port, example value 8080
        Parameters:
        url - server url
        defaultPort - if the port is not set
        Returns:
        port
      • getPort

        public static String getPort​(URL url,
                                     String defaultPort)
        Return the port, example value 8080
        Parameters:
        url - server url
        defaultPort - if the port is not set
        Returns:
        port
      • getPath

        public static String getPath​(URL url,
                                     String defaultPath)
        Return the path, example value /abcdef/xyz
        Parameters:
        url - server url
        defaultPath - if the path is not empty
        Returns:
        path
      • getProtocolAndHost

        public static String getProtocolAndHost​(URL url)
        Get the protocol and the host, example value https://www.abcdef.xyz
        Parameters:
        url - server url
        Returns:
        protocolAndHost
      • getHost

        public static String getHost​(io.swagger.v3.oas.models.OpenAPI openAPI,
                                     Map<String,​String> userDefinedVariables)
        Return the first complete URL from the OpenAPI specification
        Parameters:
        openAPI - current OpenAPI specification
        userDefinedVariables - User overrides for server variable templating
        Returns:
        host
      • isRelativeUrl

        public static boolean isRelativeUrl​(List<io.swagger.v3.oas.models.servers.Server> servers)