Define & Validate APIsValidation RulesetsAPIMatic Rulesets

APIMatic Validation for Code Generation

APIMatic performs some preliminary checks on the user-provided API specification document to ensure that it meets the basic requirements for generating a valid output during SDK and Portal generation.

PropertyValue
Ruleset IDapimatic-codegen-validation
Code prefixAPIMATICCODEGEN_V
TypeValidation
Default severityError
Rule systemSemantic
Rules87

Name Conventions

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V001valid-name-conventionsErrorFor successful Code Generation, the name must only use letters, numbers, underscores and dashes. It must not contain any leading/trailing white-space characters. Names are often used for naming the files generated as part of the code generation process, so, any forbidden file name characters are not allowed.
APIMATICCODEGEN_V002valid-name-length-conventionsWarningName length must not be equal to or exceed 50 characters.
APIMATICCODEGEN_V003name-exceeds-maximum-allowed-lengthErrorName length must not exceed 100 characters. Names exceeding this limit will cause failures in Code Generation, Docs Generation, and Portal Generation.

XML Attributes

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V006valid-xml-namespace-conventionsErrorAn XML namespace must be a non-null, non-empty and well-formed URI.
APIMATICCODEGEN_V007unique-element-xml-node-names-in-modelErrorThe XML node names assigned to fields marked as XML elements in a model must be unique.
APIMATICCODEGEN_V008unique-attribute-xml-node-names-in-modelErrorThe XML node names assigned to fields marked as XML attributes in a model must be unique.
APIMATICCODEGEN_V009no-dynamic-type-usage-with-xmlErrorIf API uses XML serialization/deserialization, then use of "Dynamic" type components is not supported.

Authentication

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V021no-space-in-scope-valueErrorScope values must not contain spaces.
APIMATICCODEGEN_V022oauth1-authentication-not-allowedErrorOAuth 1.0 authentication methods are deprecated and not supported. Use OAuth 2.0 or other modern authentication schemes instead.

Server Configuration

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V031valid-api-base-urlErrorThe Base URL specified for the API must be a non-empty non-null absolute URL.

Endpoints

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V041atleast-one-endpointErrorAn API must contain atleast one endpoint for Code Generation.
APIMATICCODEGEN_V042unique-endpoint-group-nameErrorEndpoint group names must be unique.
APIMATICCODEGEN_V043non-conflicting-endpoint-nameErrorEndpoint names must be unique when letter casing and symbols are ignored.
APIMATICCODEGEN_V044non-conflicting-method-nameErrorMethod names in an endpoint group must be unique when letter casing and symbols are ignored.
APIMATICCODEGEN_V045valid-method-name-conventionsErrorMethod names must use letters, numbers, spaces, underscores and dashes only. The name must start with a letter.

Endpoint Parameters

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V071unique-endpoint-parameter-nameErrorThe name of a parameter in an endpoint must be unique when all the parameter names of an endpoint are compared in a case-insensitive manner.
APIMATICCODEGEN_V073no-complex-types-in-non-body-parametersErrorUse of complex model types for non-body parameters (template, header) is currently not supported. Only enumeration or primitive types are allowed.
APIMATICCODEGEN_V074no-array-header-parametersErrorA header parameter cannot be set as an array.
APIMATICCODEGEN_V075no-array-file-form-parametersErrorAn array of "File" type parameters is currently not supported.

Endpoint Responses

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V101response-mapping-required-fieldErrorA Data Field or an Error Field must be specified in the response mapping.
APIMATICCODEGEN_V102valid-response-mapping-field-elementsErrorA response mapping field element must not be null. Only empty/whitespace strings are allowed.
APIMATICCODEGEN_V103response-mapping-data-field-value-for-complex-typesErrorA Data Field is only allowed for endpoints for which the response has a "Dynamic" type or a complex model/custom type.
APIMATICCODEGEN_V104valid-pagination-typeErrorThe pagination type defined for the response must be one of the supported types: "offset", "page", "cursor", or "link". Any other value is considered invalid.
APIMATICCODEGEN_V105non-empty-pagination-resultErrorThe result field within the pagination object must be a valid, non-empty JSON pointer string. It should point to an array field in the API response that contains the paginated results.
APIMATICCODEGEN_V106pagination-result-points-to-arrayErrorThe result field in the pagination object must be a valid JSON pointer that references an array field in the API response. Pointers targeting non-array fields aren't supported and will result in an invalid pagination configuration.
APIMATICCODEGEN_V107valid-pagination-json-pointerErrorThe JSON pointer must reference a valid location within the request or response. Examples of valid pointers include: $response.body, $response.body#/data/prop, and $request.query#/offset.
APIMATICCODEGEN_V108pagination-pointer-points-valid-fieldErrorThe JSON pointer must reference an existing field within the request or response structure. If it points to a field that doesn't exist, the pagination configuration is considered invalid.
APIMATICCODEGEN_V109non-empty-pagination-inputErrorThe input field in the pagination object must be a valid, non-empty JSON pointer string. It should reference a field in the API request that provides the pagination input, such as an offset, page number, or cursor value.
APIMATICCODEGEN_V110non-empty-pagination-outputErrorThe output field in the cursor pagination object must be a valid, non-empty JSON pointer string. It should reference a field in the API response that provides the pagination output, such as a next cursor value.
APIMATICCODEGEN_V111cursor-input-cursor-output-types-should-matchErrorThe input and output fields in a cursor-based pagination object must have matching schema types. For example, if the input field is of type string, the output field must also be of type string.
APIMATICCODEGEN_V112non-empty-pagination-nextErrorThe next field in a link-based pagination object must be a valid, non-empty JSON pointer string. It should reference a field in the API response that provides the URL to the next page of results.
APIMATICCODEGEN_V113link-pagination-next-must-be-stringErrorIn link-based pagination, the next field must be a string containing the URL to the next page of results. Any other type is considered invalid.
APIMATICCODEGEN_V114pagination-input-must-be-integerErrorFor both offset-based and page-based pagination strategies, the input field must be of type integer. This value typically represents the starting offset or page number and must be a valid integer to ensure correct pagination behavior.

Global Types/Models

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V131unique-model-namesErrorNames of globally defined custom types/models must be unique.
APIMATICCODEGEN_V132valid-enum-field-name-conventionsErrorNames assigned to fields of an enumeration model must not contain special characters.
APIMATICCODEGEN_V133non-conflicting-model-and-endpoint-group-namesErrorIf controller and model postfixing is disabled, similar model names and endpoint group names can cause conflicts in code generation, therefore, the names of both entities must be kept unique overall.
APIMATICCODEGEN_V134model-atleast-one-fieldWarningA structure/exception model must consist of at least one field/property declaration.
APIMATICCODEGEN_V135unique-field-nameErrorNames of fields in a model must be unique.
APIMATICCODEGEN_V136non-conflicting-model-and-field-nameWarningA model's name must not conflict with names of its fields. This is because some languages do not allow member names to be the same name as their enclosing type. The accessor or variable names may be changed to address this problem.

Test Cases

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V161non-conflicting-test-case-nameErrorNames of test cases of an endpoint must not contain any conflicts.
APIMATICCODEGEN_V162predefined-test-input-parameterErrorA test case input parameter must correspond to a pre-defined parameter in the endpoint in which the test case is defined.
APIMATICCODEGEN_V163valid-input-parameter-test-valueErrorThe test value provided for the input parameter in a test case must be valid and correspond with the parameter type definition.
APIMATICCODEGEN_V164input-parameter-test-value-restrictionsErrorThe test value provided for the input parameter in a test case must obey all restrictions placed in the corresponding parameter type definition.
APIMATICCODEGEN_V165optional-query-parameters-test-caseWarningTest case must not contain undeclared query parameters if endpoint does not allow optional query parameters.
APIMATICCODEGEN_V166optional-field-parameters-test-caseWarningTest case must not contain undeclared field parameters if endpoint does not allow optional field parameters.
APIMATICCODEGEN_V167valid-test-case-expected-statusErrorThe expected status of a test case must be a valid HTTP status code or range and its corresponding response definition must be present in the endpoint responses.
APIMATICCODEGEN_V168allowed-test-case-body-match-modeErrorThe body match mode specified in the test case (if not set to None) must be valid and applicable to the type(s) of the response(s) indicated by the expected status.
APIMATICCODEGEN_V169valid-test-case-expected-body-valueErrorThe value provided for the expected response body in a test case must be valid and correspond with the type definition(s) of the response(s) indicated by the expected status.
APIMATICCODEGEN_V170test-case-expected-body-value-restrictionsErrorThe value provided for the expected response body in a test case must obey all restrictions placed in the corresponding response type definition(s).

CodeGen Settings

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V251valid-request-timeout-codegen-settingErrorThe request timeout specified in the code generation settings must be a positive number.
APIMATICCODEGEN_V252valid-php-composer-package-name-codegen-settingErrorPHP Composer package name must match the naming rules specified in the composer schema file.
APIMATICCODEGEN_V253valid-php-namespace-name-codegen-settingErrorPHP namespace name must not contain forbidden characters or use invalid format.
APIMATICCODEGEN_V254java-group-id-codegen-setting-match-naming-rulesErrorJava Group ID must match the naming rules specified in maven guides.
APIMATICCODEGEN_V255java-artifact-id-codegen-setting-match-naming-rulesErrorJava Artifact ID must match the naming rules specified in maven guides.
APIMATICCODEGEN_V256controller-postfix-codegen-setting-naming-conventionsErrorController postfix must use letters, numbers, underscore and dashes only.

Miscellaneous

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V501valid-error-template-keyErrorThe key of an error template entry must be a valid error HTTP status code/range (e.g. 4XX, 500) or set to 0 to represent default/undeclared errors.
APIMATICCODEGEN_V502valid-error-template-messageErrorValue of an error template entry must be a valid string message, with support for expression templates. A template must start and end with curly braces {} and contain a valid expression in between. The templates are filled with actual data at runtime. Allowed template expression placeholders include: {$statusCode}, {$response.header.<headerKey>}, {$response.body<#JsonPointer>}. If {$response.header.<headerKey>} placeholder is used, <headerKey> must be replaced with a valid response header name. <#JsonPointer> in the {$response.body<#JsonPointer>} placeholder is an optional segment that can be used to access a particular part of a JSON response body. If used, it must follow valid JSON pointer syntax.

Webhooks

CodeRuleSeverityWhat it checks
APIMATICCODEGEN_V521discriminator-property-pointer-requiredErrorWhen a discriminator section exists in webhook or callback configuration, the propertyPointer field MUST be present and non-empty to enable event type discrimination.
APIMATICCODEGEN_V522discriminator-property-pointer-points-to-valid-propertyErrorThe property that propertyPointer references MUST exist in the parent request body schema to enable proper event type discrimination for webhooks and callbacks.
APIMATICCODEGEN_V523discriminator-property-pointer-references-string-typeErrorThe property that propertyPointer references MUST be of string type to allow proper event matching and discrimination logic for webhooks and callbacks.
APIMATICCODEGEN_V524discriminator-mapping-value-references-existing-definitionErrorEvery ID referenced in discriminator mapping values MUST correspond to an existing webhook or callback definition in the respective section.
APIMATICCODEGEN_V525payload-verification-custom-algorithm-name-requiredWarningWhen a custom algorithm is specified in payload verification configuration, a name field should be provided to identify the custom verifier implementation.
APIMATICCODEGEN_V526payload-verification-algorithm-requiredErrorWhen payloadVerification exists in webhook or callback configuration, the algorithm field MUST be specified with a valid value.
APIMATICCODEGEN_V527payload-verification-signature-header-requiredErrorWhen payloadVerification exists in webhook or callback configuration, the signatureHeader field MUST be specified to indicate which header contains the signature.
APIMATICCODEGEN_V528extension-group-must-exist-when-referencedErrorWhen webhook or callback operations reference an extension group, the corresponding x-webhooks or x-callbacks extension MUST exist in the API specification.
APIMATICCODEGEN_V529payload-verification-valid-digest-encodingErrorThe digestEncoding field in payload verification must use one of the accepted values: 'hex', 'base64', or 'base64url'. If no value is specified, 'hex' is used as the default.
APIMATICCODEGEN_V530payload-verification-valid-message-templateErrorThe messageTemplate field must only use supported placeholders. Webhook templates support {$request.body}, {$method}, {$request.header.<HeaderName>}, {$request.body#/property}. Callback templates support additional placeholders including {$url}, {$request.path}, {$request.query.<ParamName>}. If no value is specified, '{$request.body}' is used as the default.
APIMATICCODEGEN_V531payload-verification-valid-signature-value-templateErrorThe signatureValueTemplate field must contain the {digest} placeholder to insert the computed digest. If no value is specified, '{digest}' is used as the default.
APIMATICCODEGEN_V532webhook-only-post-method-allowedErrorWebhooks must use only the POST HTTP method. Other HTTP methods like PUT aren't supported for webhook operations.
APIMATICCODEGEN_V533valid-placeholder-delimiterErrorThe template string contains placeholders (for example '{$request.body}', '{$method}') that must be separated by exactly one single-character delimiter such as ':', '-', or '_'. Multiple characters, missing delimiters, or multi-character strings between placeholders aren't allowed. This ensures consistent and predictable template formatting.
APIMATICCODEGEN_V534callback-url-expression-validationErrorThe callback URL expression must be valid and reference an existing string-type property. Callback URLs can be specified as runtime expressions (pointers), relative URLs, or absolute URLs, but any referenced properties must exist and be of string type.
APIMATICCODEGEN_V535webhook-no-group-assigned-warningWarningThis webhook doesn't have an x-webhook-group extension specified. While not required, assigning webhooks to groups enables better organization and discriminator functionality.
APIMATICCODEGEN_V536callback-no-group-assigned-warningWarningThis callback doesn't have an x-callback-group extension specified. While not required, assigning callbacks to groups enables better organization and discriminator functionality.
APIMATICCODEGEN_V537webhook-missing-request-bodyWarningWebhooks typically require a request body parameter to receive event data from external services. A missing request body may indicate incomplete webhook configuration or prevent proper event handling.
APIMATICCODEGEN_V538callback-missing-request-bodyWarningCallbacks typically require a request body parameter to send event data to external services. A missing request body may indicate incomplete callback configuration or prevent proper event notification.
APIMATICCODEGEN_V541callback-only-post-method-allowedErrorCallbacks must use only the POST HTTP method. Other HTTP methods like PUT, GET, or DELETE aren't supported for callback operations.
APIMATICCODEGEN_V542webhook-valid-nameErrorWebhook names must follow valid naming conventions. Names should contain only alphanumeric characters, underscores, and hyphens, and must not start with numbers or special characters.
APIMATICCODEGEN_V543callback-valid-nameErrorCallback names must follow valid naming conventions. Names should contain only alphanumeric characters, underscores, and hyphens, and must not start with numbers or special characters.
APIMATICCODEGEN_V544discriminator-property-pointer-invalid-formatErrorThe property pointer must follow the format 'location#/path'. It should contain exactly one '#' character separating the location from the JSON pointer path. The Property pointer should point to the root level string property in the request body
APIMATICCODEGEN_V545discriminator-property-pointer-invalid-locationErrorThe property pointer location must be 'request.body' for discriminator configuration. Other locations aren't supported for event discrimination.
APIMATICCODEGEN_V546discriminator-property-pointer-empty-pathErrorThe JSON pointer path part of the property pointer can't be empty and must reference valid field names. Array indices and empty segments aren't allowed.
APIMATICCODEGEN_V547discriminator-property-pointer-missing-request-bodyErrorThe endpoint doesn't have a request body parameter, but the discriminator property pointer references 'request.body'. A request body parameter is required for discriminator functionality.
APIMATICCODEGEN_V548callback-duplicate-id-warningWarningDuplicate callback IDs detected in the API specification. When multiple callbacks share the same ID, only the first occurrence will be used and subsequent duplicates will be ignored during processing.
APIMATICCODEGEN_V549callback-missing-request-body-with-mappingErrorThis callback is assigned to a callback group that has discriminator mappings, but the callback itself doesn't have a request body parameter. Since discriminator functionality relies on request body content for event type determination, the callback can't be removed without breaking the discriminator mappings.
APIMATICCODEGEN_V550webhook-missing-request-body-with-mappingErrorThis webhook is assigned to a webhook group that has discriminator mappings, but the webhook itself doesn't have a request body parameter. Since discriminator functionality relies on request body content for event type determination, the webhook can't be removed without breaking the discriminator mappings.
APIMATICCODEGEN_V551payload-verification-invalid-algorithmErrorThe algorithm specified in the payload verification configuration isn't supported. Payload verification requires either HMAC-SHA256 or HMAC-SHA512 algorithms to ensure secure message signing and verification. Other algorithms aren't supported by the current implementation.
APIMATICCODEGEN_V552payload-verification-digest-encoding-requires-hmac-algorithmErrorThe digest encoding configuration (hex, base64, or base64url) can only be used with HMAC-based algorithms (HMAC-SHA256 or HMAC-SHA512). The current algorithm doesn't support digest encoding options.

Learn more

On this page