Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityError
MessageBase path does not begin with a leading slash.
CodeSWAGGER20SYNTAX_V002
TypeValidation
Rule SystemSyntax
Broad CategoryAPI Server
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger2 swagger syntax validation base path leading slash

Suggested Fixes

  • Add a leading slash to the base path: Review the value of the basePath field in your Swagger 2.0 specification. Ensure that it starts with a leading slash (/). For example, if your base path is currently defined as api/v1, modify it to /api/v1.

For More Information