You can configure the validation process as per your requirements by providing a validation configuration in the APIMatic's Metadata file which needs to be uploaded along with the API definition/specification:
The capabilities that this configuration provides is as follows:
Skipping some rules of a ruleset, the entire ruleset or a group of rulesets e.g. skipping all linting rulesets.
Enabling only some rules from a ruleset and skipping the rest.
Enabling rules of a ruleset that are kept disabled by default either because of low priority or any other reason.
Overriding severity of rules depending on needs e.g. converting a warning into error.note
The capabilities differ w.r.t. whether the ruleset is meant for validation or linting. Validation rules/rulesets can only be enabled but not skipped nor can their severity be changed.
Validation Configuration Object
The available properties and their respective types are as follows:
|SkipCodeGenerationChecks||Boolean||When set to |
|Rulesets||Map[String, Ruleset Configuration]||Configuration for each ruleset. The key is the unique id/code that identifies a ruleset and the value provides required configurations for that ruleset. The rulesets not specified here will work with default behavior.|
Example 1 - Skip all linting rules:
Example 2 - Configuring a ruleset:
The following configuration will let you skip the rule
no-ambiguous-path from the
openapi-v3-standards-linting ruleset and also downgrade the severity of all rules in the ruleset from
openapi-v3-standards-linting are rule and ruleset ids respectively.
Ruleset Configuration Object
This configuration object will let you configure a single ruleset. The available properties and their respective types are as follows:
|Severity||Rule Severity||The severity set here will override severity level of all rules in the ruleset. Only applicable for linting rulesets. If a rule in this ruleset has severity overrides provided in the rules configuration of the ruleset, the rule level severity configuration will take precedence.|
|FilePath||String||Relative path to a custom ruleset file.|
|Rules||Rules Configuration||Configuration for specific rules of the ruleset can be provided here. Rules not configured explicitly or implicitly here will work with default behavior.|
Ruleset Rules Configuration Object
This configuration will let you configure rules of a ruleset. The available properties and their respective types are as follows:
|EnableOnly||Array[String]||If a list of rule ids/codes is provided, only those rules from the ruleset will be applied and others will be skipped regardless of any default configuration or configurations provided using the |
|Enable||Array[String]||A list of rule ids/codes to enable. This can be used to enable rules from a ruleset that may be disabled by default for any reason (low priority or any other). The default behavior will be used for rules not specified here.|
|Skip||Array[String]||If a list of rule ids/codes is provided, they will not be applied. Only applicable for linting rulesets. Rules listed here will be ignored regardless of any configurations provided under |
|Severity||Map[String, Rule Severity]||This will let you override severity of a rule e.g. changing an error to warning. Only applicable for linting rulesets. The key should be the id/code of the rule you wish to change severity of.|
Example 1 - Enable only selected rules from a ruleset:
"unique-case-insensitive-header-parameter-names", //using rule id
"OPENAPI3STANDARDS_L065" //using rule code
Example 2 - Skip a rule from a ruleset:
Example 3 - Changing severity of a rule: