maximum-server-variables-key-length
Overview
This rule belongs to the openapi-v3-codegen-linting
ruleset and states that:
The keys used for server variables in an OpenAPI specification should not exceed 50 characters in length. Server variables are used to define variables in the server URL, and their names should be concise and meaningful to ensure that they are easily understandable by developers. Exceeding the limit of 50 characters can make the server variables difficult to read and understand, and can cause issues in Code Generation, Portal Generation or Transformations.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Server variable keys should not exceed 50 characters. |
Code | OPENAPI3CODEGEN_L097 |
Type | Linting |
Rule System | Semantic |
Broad Category | OpenAPI Servers |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | code generation sdks openapi3 openapi semantic linting apimatic server variable name key length |
Suggested Fixes
- Check the variables property of the server definition to ensure that the keys used for the server variables do not exceed 50 characters in length.
- If any server variable key exceeds the limit, rename it to a more concise and meaningful name that is no longer than 50 characters.
- Ensure that the new server variable names are consistent with the naming conventions used in the OpenAPI specification.