Description
In OpenAPI 2.0, basePath is the path prefix shared by the API. Omit it if the API starts at the host root.
Potential impact
A missing leading slash can make validation fail or lead clients to the wrong URL.
Remediation
Start basePath with /. Combine it with host and an operation path, then check the result against the deployed endpoint.
Examples
The example changes api/incorrect to /api. If the deployed prefix is /api/incorrect, add only the leading slash.
Before
json
{
"swagger": "2.0",
"basePath": "api/incorrect"
}
After
json
{
"swagger": "2.0",
"basePath": "/api"
}