Define & Validate APIsValidation RulesetsAPIMatic Rulesets

APIMatic Preliminary Linting

APIMatic performs some preliminary linting checks on the user-provided API specification to ensure that the API specification document produces desired output in any of the APIMatic products including API Transformer, SDK/Portal generation, etc.

PropertyValue
Ruleset IDapimatic-preliminary-linting
Code prefixAPIMATICPRE_L
TypeLinting
Default severityWarning
Rule systemSemantic
Rules24

API

CodeRuleSeverityWhat it checks
APIMATICPRE_L001valid-api-versionWarningThe API version must be non-null, non-empty and follow semantic versioning rules.
APIMATICPRE_L002valid-contact-url-formatWarningString value should be in the format of a proper URL.

Server Configuration

CodeRuleSeverityWhat it checks
APIMATICPRE_L011atleast-one-server-template-parameter-referenceWarningTemplate parameters defined in the server configuration must be referenced by at least one or more server URLs.

Authentication

CodeRuleSeverityWhat it checks
APIMATICPRE_L021no-oauth-2-parameter-paramformatsWarningThe OAuth 2.0 parameter has no record for allowed formats indicating how it must be sent, therefore, the currently specified formats will not be taken into consideration.
APIMATICPRE_L022api-authentication-mechanism-definedInformationAPIs almost always require only authorized users to make requests to the API server. For this, a particular authentication mechanism is required to be followed. If the API requires authentication, the authentication mechanism must be defined globally in the authentication section of the relevant API description format. Endpoints not requiring any authentication can be excluded as required.
APIMATICPRE_L023unique-authentication-optionsWarningAn authentication option in a list of options must be unique. The uniqueness of an authentication option is determined by uniqueness of the authentication schemes that need to be applied as part of this option, required scope values, etc.
APIMATICPRE_L024unique-authentication-schemes-in-group-auth-optionWarningA group authentication option is one that makes use of multiple authentication schemes to complete the authentication. It must not consist of any duplicate authentication schemes.
APIMATICPRE_L025two-or-more-authentication-schemes-in-group-auth-optionWarningA group authentication option is expected to make use of multiple authentication schemes to complete the authentication. Therefore, it must consist of at least two or more authentication schemes. If only a single authentication scheme is present, it is recommended to change the authentication option type to single.

Endpoints

CodeRuleSeverityWhat it checks
APIMATICPRE_L041endpoint-group-globally-definedWarningAn endpoint can only be placed inside an endpoint group which is pre-defined under the API level endpoint groups definition.
APIMATICPRE_L042optional-template-path-parametersWarningPath/template parameters used in the endpoint relative path/route should not be defined as optional parameters in the endpoint.
APIMATICPRE_L043atleast-one-template-parameter-referenceWarningIf a template parameter is defined in an endpoint, it must also be part of one or more path segments of the endpoint's relative path/route.
APIMATICPRE_L044no-endpoint-authorization-headerInformationA declaration of Authorization header at endpoint level is not recommended. Alternatively, make use of the appropriate authentication scheme for the API which will automatically enable the authentication globally for all your endpoints except those that do not require authentication.
APIMATICPRE_L045concrete-response-typeInformationIf 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.

Types/Models

CodeRuleSeverityWhat it checks
APIMATICPRE_L101no-base-type-field-redeclarationWarningFields/properties must not be re-declared in a model if they have already been defined in the model's base type or type hierarchy.
APIMATICPRE_L102no-model-circular-dependencyWarningA model containing one or more required fields (whether inherited or not) which reference the same model either directly or indirectly indicates presence of a circular dependency. Referencing a model (say A) indirectly means the field(s) references another model (say B) which may contain one or more fields that directly or indirectly reference the model under consideration (A).
APIMATICPRE_L103valid-number-type-restriction-attributeWarningThe value of a numeric type restriction attribute must be an integer greater than, or equal to zero.
APIMATICPRE_L104maximum-limit-greater-or-equal-minimum-limitWarningThe value of maximum limit set by a numeric type restriction attribute cannot be less than the specified minimum limit. In other words, the minimum value set by a numeric type restriction attribute cannot exceed the specified maximum limit
APIMATICPRE_L105no-inline-model-definitionWarningIt is recommended that a model definition is added globally with a unique name and then referenced throughout the API description with that name. Inline definitions of models with components are not recommended as the names of such models are generated from the components in which they are declared. This can result in duplicate names which are handled by appending a number at the end. This behavior can affect your output quality.
APIMATICPRE_L106no-redundant-modelInformationTo get a good quality output, it is recommended to avoid redundant models. A redundant model can be one which has exactly the same properties as another model or which is a subset of another model so that it can be easily replaced by its superset model instead.
APIMATICPRE_L107atleast-one-or-more-modelInformationComplex data like JSON objects, arrays or enumerations must be defined using the global models/custom types in the API description file and then referenced in the request parameters or responses as required. This gives you better control over your API data as you can then easily serialize and deserialize the data when making API calls via our products like SDKs, etc.
APIMATICPRE_L108non-zero-multiple-of-restriction-attributeWarningThe value of the 'multipleOf' numeric type restriction attribute must be a number strictly greater than zero.
APIMATICPRE_L195non-empty-type-combinator-metadataWarningWhen a metadata is specified for each of the type combinator cases, it is expected to add more information to the cases like assigning a user-friendly name to the case, adding additional descriptive content, etc. If, however, the metadata provides none of these details, it is considered redundant.
APIMATICPRE_L196atleast-one-type-combinator-set-in-global-type-combinatorsWarningA global type combinators definition expects at least one type combinator definition e.g. anyOf, oneOf, not. This means that the type cases in a type combinator must contain at least one type case.

Miscellaneous

CodeRuleSeverityWhat it checks
APIMATICPRE_L201supported-vendor-extensionsInformationAPIMatic supports certain vendor extensions which are loaded at the time of importing API description files containing these extensions. These include APIMatic specific extensions as well that are used for configuring products like Code Generation, Transformer, etc. All other extensions will be ignored or may not work as expected.

On this page