Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageServer variable keys should not exceed 50 characters.
CodeOPENAPI3CODEGEN_L097
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Servers
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagscode 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.

For More Information