Server object variable used in the server URL is not defined in the server object variables

Description

The variable you are using in the URL is not defined in the server variables in your API. All variables used in the url property must be defined as a key in the variables property map of the server object.

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 username is used in the URL, but it has not been defined in the variables map:

1servers:
2  - url: https://{username}.gigantic-server.com:{port}/{basePath}
3    description: The production API server
4    variables:
5      port:
6        enum:
7          - "8443"
8          - "443"
9        default: "8443"
10      basePath:
11        default: v2
12

Remediation

Make sure that you have defined all variables used in URLs in the variables map of a server object.

1servers:
2  - url: https://{user-name}.gigantic-server.com:{port}/{basePath}
3    description: The production API server
4    variables:
5      username:
6        default: demo
7        description: this value is assigned by the service provider, in this example
8          `gigantic-server.com`
9      port:
10        enum:
11          - "8443"
12          - "443"
13        default: "8443"
14      basePath:
15        default: v2
16

Copyright 42Crunch 2021