Server URL contains trailing slashes
Issue ID: v3-warning-serverurl-normalization
Description
The server URL of your API contains trailing slashes (/
). While the OpenAPI Specification (OAS) allows this, this can cause your API consumers to call wrong URLs while attempting to consume your API. In 42Crunch Platform, this can cause problems when trying to scan your API with API Conformance Scan.
For more details, see the OpenAPI Specification.
Example
The following is an example of how this issue could look in your API definition:
{
"servers": [
{
"url": "http://server.com/",
"description": "My server"
}
],
// ...
"paths": {
"/endpoint/name": {
"get": {
// ...
}
}
}
}
This could cause some API consumers to wrongly parse the URL and try to call https://server.com//endpoint/name
instead of the correct URL https://server.com/endpoint/name
.
Remediation
Make sure that you are using correct URL formatting. To avoid issues parsing the URL correctly, it is best to avoid trailing slashes in your server URLs.
{
"servers": [
{
"url": "http://server.com",
"description": "My server"
}
],
// ...
"paths": {
"/endpoint/name": {
"get": {
// ...
}
}
}
}