Documentation ¶
Index ¶
- func GetHostFromURL(url string) string
- func GetMultiRegionHost(overrideHost string, region string) (string, error)
- func GetSchemaDefinition(definitions map[string]spec.Schema, ref string) (*spec.Schema, error)
- func IsMultiRegionHost(overrideHost string) (bool, *regexp.Regexp)
- func IsValidHost(url string) bool
- func StringExtensionExists(extensions spec.Extensions, key string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHostFromURL ¶
GetHostFromURL returns the fqdn of a given string (localhost including port number is also handled). Example domains that would match: - http://domain.com/ - domain.com/parameter - domain.com?anything - example.domain.com - example.domain-hyphen.com - www.domain.com - localhost - localhost:8080 - 127.0.0.1 - 127.0.0.1:8080 - 127.0.0.1 - http://127.0.0.1:8080/swagger.com
func GetMultiRegionHost ¶
GetMultiRegionHost builds a final fqdn based on the given host that is parameterised (${1}%s$4) and injects the given region in it
func GetSchemaDefinition ¶
GetSchemaDefinition queries the definitions and tries to find the schema definition for the given ref. If the schema definition the ref value is pointing at does not exist and error is returned. Otherwise, the corresponding schema definition is returned.
func IsMultiRegionHost ¶
IsMultiRegionHost checks whether the override host is parameterised following the format expected
func IsValidHost ¶
IsValidHost checks whether the given string is a valid host. A valid host is considered a FQDN or IP. The latter may include also non starndar ports in the strings e,g: - domain.com - domain.com:8080 - localhost - localhost:8443 - 127.0.0.1 - 127.0.0.1:8080 Note that if custom ports are used, the protocol used would still be the one defined in the swagger doc. Hence, if https is the default protocol as specified in swagger, a host like www.domain.com:8080 would still use https protocol.
func StringExtensionExists ¶
func StringExtensionExists(extensions spec.Extensions, key string) (string, bool)
StringExtensionExists tries to find a match using the built-in extensions GetString method and if there is no match it will try to find a match without converting the key lower case (as done behind the scenes by GetString method). Context: The Extensions look up methods tweaks the given key making it lower case and then trying to match against the keys in the map. However this may not always work as the Extensions might have been added without going through the Add method which lower cases the key, though in situations where the struct was un-marshaled directly instead this translation would not have happened and therefore the look up queiry will not find matches
Types ¶
This section is empty.