Skip to main content

concrete-response-type

Overview

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

If your response type is set to Void or Dynamic, it may be because enough information about response type could not be deduced from your API description response information. Make sure that Void is set for only those responses where no response body is expected. And Dynamic is used where the response type information cannot be easily represented or you need to allow multiple types. In all other cases, a valid primitive or model type must be used for the response.

PropertyValue
EnabledYes
Maximum SeverityInformation
MessageResponse type is set to Void or Dynamic.
CodeAPIMATICPRE_L045
TypeLinting
Rule SystemSemantic
Broad CategoryEndpoints
Products ImpactedCode Generation, Developer Experience Portal, API Transformer
Tagspreliminary checks linting apimatic type response void dynamic

Suggested Fixes

  • If your endpoint response returns a JSON object or JSON array or an enumeration, make sure that you define a global model/custom type to represent that data and reference that model in the response type definition.
  • If your endpoint response returns a single type of primitive data, make sure to choose the appropriate primitive type in the response type definition.
  • If your endpoint response can return multiple types of data or a concrete type cannot be determined, use type Dynamic.
  • If your endpoint response does not return any data or a response body is not expected, use type Void.

For More Information