base-path-starts-with-leading-slash
Overview
This rule belongs to the swagger-v2-syntax-validation ruleset and states that:
In Swagger 2.0, the basePath field is used to specify the common path prefix for all API endpoints. The violation occurs when the basePath value does not begin with a leading slash (/), which is required according to the Swagger 2.0 specification.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Base path does not begin with a leading slash. |
| Code | SWAGGER20SYNTAX_V002 |
| Type | Validation |
| Rule System | Syntax |
| Broad Category | API Server |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | swagger2 swagger syntax validation base path leading slash |
Suggested Fixes
- Add a leading slash to the base path: Review the value of the
basePathfield in your Swagger 2.0 specification. Ensure that it starts with a leading slash (/). For example, if your base path is currently defined asapi/v1, modify it to/api/v1.