Skip to main content



This rule belongs to the swagger-v2-syntax-validation ruleset and states that:

In Swagger 2.0, the host field is used to specify the hostname (and optionally the port number) where the API is hosted. The violation occurs when path templating, which is the use of variables within the host field, is detected. Path templating is not supported in the host field according to the Swagger 2.0 specification.

Maximum SeverityError
MessagePath templating found in the host which is not supported
Rule SystemSyntax
Broad CategoryAPI Server
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger2 swagger syntax validation host url path templating

Suggested Fixes

  • Remove path templating from the host: Review the host field in your Swagger 2.0 specification and ensure that it contains a static hostname (and optionally a port number) without any variables or placeholders. The host field should be a fixed value that represents the actual host where the API is hosted.
  • Use path parameters instead: If you need to include dynamic elements in the host field, consider using path parameters in the paths section of your Swagger specification instead. Path parameters allow you to define variables within the path of individual API endpoints, rather than in the host field.

For More Information