Define & Validate APIsValidation RulesetsAPIMatic Rulesets

APIMatic Preliminary Validation

APIMatic performs some preliminary validation checks on the user-provided API specification document to ensure that it meets the basic requirements for generating a valid output from any of the APIMatic products including API Transformer, SDK/Portal generation, etc.

PropertyValue
Ruleset IDapimatic-preliminary-validation
Code prefixAPIMATICPRE_V
TypeValidation
Default severityError
Rule systemSemantic
Rules102

API

CodeRuleSeverityWhat it checks
APIMATICPRE_V001non-null-apiErrorThe API to validate must not be null or empty.
APIMATICPRE_V002unique-role-idsErrorRole IDs specified in the API role definitions must be unique.
APIMATICPRE_V003non-conflicting-auth-and-additional-headerErrorAdditional or global headers apply to all endpoints of the API regardless of whether any authentication schemes apply to those endpoints or not. Therefore, a header already defined as an authentication parameter should not be added as part of additional headers as well, or vice versa.

Server Configuration

CodeRuleSeverityWhat it checks
APIMATICPRE_V031predefined-default-environmentErrorThe default environment specified in the server configuration of the API must have a corresponding definition in the server configuration environments.
APIMATICPRE_V032unique-environmentErrorThe environments defined in the server configuration of the API must have unique names.
APIMATICPRE_V033predefined-default-serverErrorThe default server specified in the server configuration of the API must have a corresponding definition in all of the server configuration environment servers.
APIMATICPRE_V034unique-serverErrorThe servers defined for an environment in the server configuration of the API must have unique names.
APIMATICPRE_V035same-environment-server-setErrorThe server sets of environments in the server configuration of the API must be the same i.e. the total number of servers and their names in each environment must be the same.
APIMATICPRE_V036required-server-urlErrorA server definition must specify a non-empty, non-null and absolute URL path.

Server Configuration Parameters

CodeRuleSeverityWhat it checks
APIMATICPRE_V046predefined-server-template-parameterErrorA template parameter referenced by a server must have a corresponding definition in the server configuration parameters.
APIMATICPRE_V047unique-server-parameterErrorThe server parameters defined in the server configuration of the API must have unique names.
APIMATICPRE_V048valid-server-parameter-typeErrorValid types for a server parameter include "String", "Number" and a String/Number enumeration. No other types must be used.
APIMATICPRE_V049required-server-parameter-default-valueErrorServer parameter definition in the server configuration of the API must specify a non-empty non-null default value.
APIMATICPRE_V050valid-server-parameter-default-valueErrorThe default value specified in the server parameter definition must be valid according to the type definition of this parameter.
APIMATICPRE_V051server-parameter-cannot-be-arrayErrorServer URL parameters cannot be declared as arrays. Only primitive types like string, number or string/number enumeration types are allowed.
APIMATICPRE_V052server-parameter-cannot-be-map-objectErrorServer URL parameters cannot be declared as maps or objects. Only primitive types like string, number or string/number enumeration types are allowed.
APIMATICPRE_V053server-parameter-cannot-be-constantErrorServer URL parameter cannot be declared as read-only or constant.

Authentication

CodeRuleSeverityWhat it checks
APIMATICPRE_V061required-authentication-parametersErrorFor some authentication types like "Custom Field", "Custom Query" and "Custom Header", one or more corresponding authentication parameters must be defined.
APIMATICPRE_V062authentication-parameters-not-requiredErrorFor some authentication types like those tied to OAuth 1.0, authentication parameters must not be specified.
APIMATICPRE_V063required-jwt-authentication-parametersErrorFor JWT authentication, the following three parameters must be defined: JWTHeaderName, JWTAcquireURL, JWTDestroyURL
APIMATICPRE_V064required-scope-nameErrorA non-empty, non-null scope name must be provided in each authentication scope definition. This name is meant to be a more user-friendly and code-friendly name as compared to the corresponding scope value.
APIMATICPRE_V065required-scope-valueErrorA non-empty and non-null scope value must be provided in all authentication scope definitions.
APIMATICPRE_V066unique-scope-nameErrorScope names must be unique among all authentication scope definitions.
APIMATICPRE_V067predefined-oauth-2-serverErrorThe authorization server or access token server referenced inside the OAuth 2.0 authentication definition must be pre-defined in the server configuration of the API.
APIMATICPRE_V068required-oauth-2-endpoint-urlErrorThe URL specified for an OAuth 2.0 endpoint must be a valid non-null, non-empty path relative to the OAuth server.
APIMATICPRE_V069valid-oauth-2-parameter-formatErrorThe format specified for an OAuth 2.0 parameter, indicating how the parameter should be sent, must be one of the allowed formats for that authentication parameter e.g. form and query are the only allowed formats for the grant_type parameter.
APIMATICPRE_V070valid-authentication-scheme-nameErrorAuthentication scheme key name must be non-null, non-empty and use only letters, numbers, dashes, underscores or dots.
APIMATICPRE_V071authentication-scheme-referenced-by-auth-optionErrorA valid authentication option must reference at least one or more predefined authentication schemes depending on the option type. A single authentication option type can only reference one authentication scheme while a group authentication option can consist of two or more authentication schemes. An option that does not reference any authentication scheme will be considered an invalid authentication option.
APIMATICPRE_V072non-null-non-empty-applied-authentication-scheme-nameErrorWhen an authentication scheme is applied, the authentication scheme name must be non-null and non-empty.
APIMATICPRE_V073pre-defined-authentication-schemeErrorWhen an authentication scheme is applied, the authentication scheme name must be non-null, non-empty and correspond with the name of a globally defined authentication scheme.
APIMATICPRE_V074unique-authentication-option-nameErrorThe name assigned to an authentication option in a list must be unique.
APIMATICPRE_V075default-scope-exists-in-scopes-listErrorx-default-scopes should only include scopes that are explicitly defined in the OAuth scopes list. This ensures consistency and prevents unauthorized or undefined access levels.

Endpoints

CodeRuleSeverityWhat it checks
APIMATICPRE_V101predefined-endpoint-serverErrorEndpoint must use a pre-defined server from the API specification's server configuration.
APIMATICPRE_V102valid-endpoint-relative-routeErrorEndpoint route must be a relative path to the base server URL and begin with a leading forward slash "/". It must also consist of valid path segments.
APIMATICPRE_V103endpoint-group-name-conventionsErrorName assigned to an endpoint group must be non-null and non-empty.
APIMATICPRE_V104predefined-endpoint-scopesErrorAn endpoint must only use pre-defined scopes from the authentication scope definitions.
APIMATICPRE_V105unique-endpoint-scopesErrorThe required scopes of an endpoint must be unique.

Endpoint Parameters

CodeRuleSeverityWhat it checks
APIMATICPRE_V201predefined-endpoint-path-template-parameterErrorAll path/template parameters present in the endpoint relative route must have a corresponding definition in the endpoint.
APIMATICPRE_V202valid-template-parameter-formatErrorPath/Template parameter present in the endpoint relative route must have "Template" set as its format in its corresponding endpoint definition.
APIMATICPRE_V203no-body-form-parameters-in-non-body-http-methodsErrorHTTP methods like GET do not support a request body therefore, such endpoints should not contain parameter definitions of format "Body" or "Form".
APIMATICPRE_V204no-optional-field-parameters-in-non-body-http-methodsErrorHTTP methods like GET do not support a request body therefore, such endpoints cannot allow optional field parameters through the "HasOptionalFieldParams" flag.
APIMATICPRE_V205no-xml-request-body-in-non-body-http-methodsErrorHTTP methods like GET do not support a request body therefore, such endpoints cannot allow XML body requests.
APIMATICPRE_V206required-body-parameter-definition-for-xml-request-endpointErrorAn explicit endpoint body parameter definition must be present if XML requests are enabled for the endpoint.
APIMATICPRE_V207form-and-body-parameters-cannot-coexistErrorIf an endpoint contains a body parameter, form parameters or optional field parameters are not allowed.
APIMATICPRE_V208multiple-body-parametersErrorUnless the "WrapBodyInObject" flag is enabled, an endpoint must contain only one body parameter definition.
APIMATICPRE_V209valid-parameter-primitive-typeErrorSome types like "Binary", "Void" and "HttpResponse" are not applicable to parameters and, therefore, should not be used in parameter definitions.
APIMATICPRE_V210valid-dynamic-type-parameter-formatErrorFor parameters, type "Dynamic" can only be used for body/form parameters.
APIMATICPRE_V211valid-file-type-parameter-formatsErrorFile type can only be used for a parameter with format set as "Body" or "Form".
APIMATICPRE_V212constant-parameter-cannot-be-optionalErrorConstant parameters cannot be declared optional.

Endpoint Responses

CodeRuleSeverityWhat it checks
APIMATICPRE_V301valid-http-status-code-rangeErrorA response status must be a valid HTTP status code or range.
APIMATICPRE_V302valid-error-codesErrorOnly valid status codes from range 4XX (client errors) and 5XX (server errors) must be used for endpoint error definitions.
APIMATICPRE_V303predefined-exception-model-for-errorErrorIf an error response has a non-empty model name listed in its definition, a corresponding error model of "Exception" type must exist in the globally defined custom types.
APIMATICPRE_V304unique-error-codesErrorThe errors defined for an endpoint (globally or within the endpoint) must have unique HTTP status codes.
APIMATICPRE_V305valid-response-content-media-typeErrorResponse content media type must be non-null and non-empty.
APIMATICPRE_V306predefined-default-success-responseErrorAn endpoint must consist of a default success response definition.
APIMATICPRE_V307valid-predefined-default-success-response-typeErrorThe default success response type of an endpoint must be non-empty, non-null and a valid primitive/complex type supported by APIMatic.
APIMATICPRE_V308valid-streaming-endpoint-response-typeErrorPrimitive types cannot be used as a default response type of streaming endpoints. Only model types are allowed.
APIMATICPRE_V309valid-response-primitive-typeErrorSome types like "File" are not applicable to responses and, therefore, should not be used in response definitions.

Types

CodeRuleSeverityWhat it checks
APIMATICPRE_V401required-entity-typeErrorA valid type (primitive or a custom type) must be specified in the entity definition.
APIMATICPRE_V402only-predefined-type-as-type-referenceErrorA type used in a component must either be a valid primitive type supported by APIMatic or a model/complex type for which a corresponding custom type must be defined globally.
APIMATICPRE_V403native-primitive-typeErrorA component in SDL can only use primitive types which are supported by APIMatic.
APIMATICPRE_V404required-default-value-for-constant-entityErrorEntities set as constants must have a non-null and non-empty default value set.
APIMATICPRE_V405supported-default-valueErrorFor some types (primary or complex), default values are currently not supported and are required to be removed.
APIMATICPRE_V406exception-model-only-for-errorErrorException types can only be referenced by error definitions. All other entities can only reference a Structure or Enumeration type model.
APIMATICPRE_V407dynamic-entity-cannot-be-arrayErrorIf an entity has the type "Dynamic", it cannot be declared as an array.
APIMATICPRE_V408type-combinator-cases-meta-count-must-matchWarningThe metadata provided for the various cases of the type combinators (anyOf, oneOf or not) must match the total number of cases present.
APIMATICPRE_V409valid-global-type-combinators-reference-nameErrorIf a global type combinators reference name is specified, the name must be non-null, non-empty and an entry with that name must be present in the global type combinators definitions.

Global Types/Models

CodeRuleSeverityWhat it checks
APIMATICPRE_V501unique-model-nameErrorNames of globally defined custom types/models must be unique.
APIMATICPRE_V502same-model-and-base-model-implementation-typeErrorThe implementation type of the model and that of its base type must be the same. This means that exception models cannot have structure type models as base types nor can structure type models have exception type models as base types.
APIMATICPRE_V503required-discriminator-fieldErrorIf a discriminator is set for a model, it must have a corresponding discriminator field/property defined in its fields.
APIMATICPRE_V504valid-discriminator-fieldErrorIf a discriminator is set for the model, a corresponding discriminator field should be part of the model fields. This discriminator field should be optional and of "String" type only. The name of the discriminator field must match with the name of the discriminator set in the model.
APIMATICPRE_V505single-declaration-of-discriminatorErrorThe discriminator must be declared once and in the base type only.
APIMATICPRE_V506model-circular-inheritanceErrorModels must not contain circular inheritance in their hierarchy.
APIMATICPRE_V507unique-discriminator-valueErrorA base type model and its children types must all have unique discriminator values.
APIMATICPRE_V508required-discriminator-valueErrorA model containing a discriminator in its type hierarchy must have a discriminator value set in its definition.
APIMATICPRE_V509required-discriminator-with-discriminator-valueErrorIf a discriminator value is provided in a model, a discriminator property name must also be set somewhere in the model or its type hierarchy along with the property's definition.
APIMATICPRE_V510no-enum-base-typeErrorEnumeration types must not have a base type set.
APIMATICPRE_V511valid-custom-type-field-primitive-typeErrorSome types like "File", "Void" and "Dynamic" are not applicable to model fields and, therefore, should not be used in field definitions.
APIMATICPRE_V512atleast-one-enum-fieldErrorEnumeration types must contain at least one value field.
APIMATICPRE_V513unique-enum-fieldsErrorAll enumeration model fields must have unique default values.
APIMATICPRE_V514valid-enum-field-typesErrorAll fields of an enumeration model must have the same type: "String" or "Number". Other types are currently not supported.
APIMATICPRE_V515enum-field-cannot-be-arrayErrorAn enumeration model field cannot be set as an array.
APIMATICPRE_V516required-enum-default-valueErrorAll fields of an enumeration model must have a non-empty and non-null default value set. The default values represent the set of possible values of the enumeration and, therefore, cannot be empty or null.
APIMATICPRE_V517valid-numeric-enum-default-valueErrorThe default value of a numeric enumeration model must be a valid number/integer.
APIMATICPRE_V518field-read-only-and-write-only-mutual-exclusivenessErrorA custom type field/property may be marked as read-only or write-only but not both.
APIMATICPRE_V581non-empty-global-type-combinators-keyErrorThe unique key/name specified for the global type combinators entry must be non-null and non-empty.
APIMATICPRE_V582global-type-combinators-id-existsWarningThe id of a global type combinators entry uniquely identifies this entry from others in the same list as well as from the names of the global models in the Custom Types list. It is mostly useful for export to other formats that support global type combinators.
APIMATICPRE_V583unique-global-type-combinators-idWarningThe id of a global type combinators entry must uniquely identify this entry from others in the same list as well as from the names of the global models in the Custom Types list.
APIMATICPRE_V584non-empty-discriminator-mapping-keyErrorPossible discriminator values provided as keys of the discriminator mapping information must be non-null and non-empty.
APIMATICPRE_V585discriminator-mapping-value-a-valid-model-nameErrorDiscriminator mapping value must specify the name of the concrete type/model to which the discriminator value needs to be mapped to. This information is useful for deserialization purposes. Therefore, the value must be non-null, non-empty and match exactly with the name of a pre-defined custom type or model.
APIMATICPRE_V586required-discriminator-with-discriminator-mappingWarningDiscriminator mapping values indicate possible values that a discriminator property can have in a data. Therefore, the discriminator property name must be present when defining the mapping information.
APIMATICPRE_V587discriminator-mapping-values-for-all-involved-modelsWarningDiscriminator mapping values indicate possible values that a discriminator property can have in a data and which concrete models they map to. This helps in the deserialization process. It is, therefore, expected that a mapping value is provided for each of the models involved in the type combinator definition and a missing value for any model would indicate incomplete information.
APIMATICPRE_V588all-model-types-in-type-combinator-with-discriminatorErrorA discriminator property in a global type combinator definition helps simplify deserialization of model types. This means that the types involved must be complex objects. If only primitive types are expected, a discriminator property is not applicable.
APIMATICPRE_V589no-circular-reference-in-global-type-combinators-definitionErrorIf a global type combinators definition references another definition (alias or not), the reference must be resolvable and not form any kind of loop.

XML Attributes

CodeRuleSeverityWhat it checks
APIMATICPRE_V601valid-xml-name-conventionsErrorName assigned to an XML entity must follow W3C Extensible Markup Language recommendations.
APIMATICPRE_V602required-node-name-for-xml-entityErrorAn entity marked as an XML entity must declare a non-empty and non-null XML node name.
APIMATICPRE_V603only-scalar-types-for-xml-attributeErrorA field declared as an attribute must only use scalar data types.
APIMATICPRE_V604xml-attribute-cannot-be-array-or-mapErrorA field declared as an XML attribute cannot be declared as an array or map.
APIMATICPRE_V605no-namespace-for-xml-attributeErrorA namespace cannot be declared for a field set as an XML attribute.
APIMATICPRE_V606no-xml-wrapping-for-non-array-entityErrorXML wrapping cannot be used for non-array entities.
APIMATICPRE_V607entity-cannot-be-xml-attributeErrorThe current entity type cannot qualify as an XML attribute and therefore can only be marked as an XML element.

Miscellaneous

CodeRuleSeverityWhat it checks
APIMATICPRE_V701required-entity-nameErrorA non-null, non-empty, user-friendly name or identifier must be provided for the entity.

On this page