Description
Define every {placeholder} in a server URL in that server’s variables map. Each variable needs a string default.
Potential impact
Clients need those values to construct the server address.
Remediation
Match the variable names exactly. Use enum to restrict choices when needed and check the resulting URL with the default and allowed values.
Examples
The server and base defaults produce https://development.gigant-server.com/v2. Supply the Link’s target operationId or operationRef as well.
Before
json
{
"openapi": "3.0.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"summary": "List API versions",
"responses": {
"200": {
"description": "the user being returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
}
}
}
}
},
"links": {
"address": {
"server": {
"url": "https://development.{server}.com/{base}"
}
}
}
}
},
"operationId": "listVersionsv2"
}
}
}
}
After
json
{
"openapi": "3.0.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"summary": "List API versions",
"responses": {
"200": {
"description": "the user being returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
}
}
}
}
},
"links": {
"address": {
"server": {
"url": "https://development.{server}.com/{base}",
"variables": {
"base": {
"default": "v2"
},
"server": {
"default": "gigant-server"
}
}
}
}
}
}
},
"operationId": "listVersionsv2"
}
}
}
}