Skip to main content

pre-defined-server-variable-for-server-url-template-expression

Overview

This rule belongs to the openapi-v3-apimatic-linting ruleset and states that:

Variable substitutions can be made when a variable is named within {brackets} in a server URL. Each variable declared this way mut be defined explicitly in the variables property of the Server Object.

PropertyValue
EnabledYes
Maximum SeverityError
MessageVariable used in server URL is undefined.
CodeOPENAPI3APIMATIC_L111
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Servers
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi apimatic semantic linting variable template path parameter url server

Suggested Fixes

  • If you have a variable defined in your server URL, ensure that a corresponding definition for it exists in the variables property of Server Object
  • In a URL the content used between two curly braces { } is considered a server variable name.
  • Make sure that the name assigned to the definition of variable matches the name of the variables used in the server URL. Names are compared in a case-sensitive manner.
  • If the curly braces are not intended to be treated as server variables, ensure that the specified server URL is properly escaped.

For More Information