Skip to main content

optional-parameters-placement

Overview

This rule belongs to the apimatic-post-processing-codegen-validation ruleset and states that:

For code generation purposes, it is important that optional parameters should be defined at the end of the endpoint parameters list and not before or between required parameters. If this is not the case by default, the parameters may be automatically sorted to get the required order. If the PreserveParameterOrder CodeGen setting is enabled, the original order will be relatively more preserved.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageEndpoint parameters have been sorted with respect to their optional/required properties, for code generation purposes.
CodeAPIMATICPOSTPROCESSCODEGEN_V005
TypeValidation
Rule SystemSemantic
Broad CategoryEndpoints
Products ImpactedCode Generation, Developer Experience Portal
Tagsapimatic postprocessing code generation validation order optional parameter endpoint

Suggested Fixes

  • To avoid this issue, define the optional parameters after the required ones, in the endpoint parameters list.
  • Enable PreserveParameterOrder CodeGen setting to preserve original parameter order as much as possible.

For More Information