Package org.openapitools.codegen.utils
Class URLPathUtils
- java.lang.Object
-
- org.openapitools.codegen.utils.URLPathUtils
-
public class URLPathUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
LOCAL_HOST
static Pattern
VARIABLE_PATTERN
-
Constructor Summary
Constructors Constructor Description URLPathUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getHost(io.swagger.v3.oas.models.OpenAPI openAPI, Map<String,String> userDefinedVariables)
Return the first complete URL from the OpenAPI specificationstatic String
getPath(URL url, String defaultPath)
Return the path, example value/abcdef/xyz
static String
getPort(URL url, int defaultPort)
Return the port, example value8080
static String
getPort(URL url, String defaultPort)
Return the port, example value8080
static String
getProtocolAndHost(URL url)
Get the protocol and the host, example valuehttps://www.abcdef.xyz
static String
getScheme(io.swagger.v3.oas.models.OpenAPI openAPI, CodegenConfig config)
static String
getScheme(URL url, CodegenConfig config)
static URL
getServerURL(io.swagger.v3.oas.models.OpenAPI openAPI, Map<String,String> userDefinedVariables)
static URL
getServerURL(io.swagger.v3.oas.models.servers.Server server, Map<String,String> userDefinedVariables)
static boolean
isRelativeUrl(List<io.swagger.v3.oas.models.servers.Server> servers)
-
-
-
Field Detail
-
LOCAL_HOST
public static final String LOCAL_HOST
- See Also:
- Constant Field Values
-
VARIABLE_PATTERN
public static final Pattern VARIABLE_PATTERN
-
-
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)
-
getScheme
public static String getScheme(URL url, CodegenConfig config)
-
getPort
public static String getPort(URL url, int defaultPort)
Return the port, example value8080
- Parameters:
url
- server urldefaultPort
- if the port is not set- Returns:
- port
-
getPort
public static String getPort(URL url, String defaultPort)
Return the port, example value8080
- Parameters:
url
- server urldefaultPort
- 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 urldefaultPath
- if the path is not empty- Returns:
- path
-
getProtocolAndHost
public static String getProtocolAndHost(URL url)
Get the protocol and the host, example valuehttps://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 specificationuserDefinedVariables
- User overrides for server variable templating- Returns:
- host
-
isRelativeUrl
public static boolean isRelativeUrl(List<io.swagger.v3.oas.models.servers.Server> servers)
-
-