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.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Variable used in server URL is undefined. |
Code | OPENAPI3APIMATIC_L111 |
Type | Linting |
Rule System | Semantic |
Broad Category | OpenAPI Servers |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 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
- https://www.apimatic.io/
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-variable-object
- https://docs.apimatic.io/rulesets/overview/