Server object variable is not used in any server URLs

Issue ID: v3-semantic-server-parameter-url-undefined

Description

The variable you have defined in the server variables is not used in any URLs in your API definition. All variables defined in the variables property map of the server object must be used in an url property in the API definition.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this issue could look in your API definition. The variable foo has been defined in the variables map, but is not used in the URL:

{
    "servers": [
        {
            "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
            "description": "The production API server",
            "variables": {
                "port": {
                    "enum": [
                        "8443",
                        "443"
                    ],
                    "default": "8443"
                },
                "basePath": {
                    "default": "v2"
                },
                "foo": {
                    "default": "bar"
                }
            }
        }
    ]
}

Remediation

Make sure that all variables you have defined in the variables maps of server objects are either used in URLs or removed.

{
    "servers": [
        {
            "url": "https://{user-name}.gigantic-server.com:{port}/{basePath}",
            "description": "The production API server",
            "variables": {
                "username": {
                    "default": "demo",
                    "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
                },
                "port": {
                    "enum": [
                        "8443",
                        "443"
                    ],
                    "default": "8443"
                },
                "basePath": {
                    "default": "v2"
                }
            }
        }
    ]
}