API spec validation options
The validationToIgnore
section contains an array of validation rules that will be ignored when validating your API spec, either by explicitly calling liblab validate
, or during SDK generation with liblab build
.
You can populate these values using the liblab validate
command, or add them manually. See the liblab CLI documentation for more information on using the liblab validate
command.
Each item has the following options:
Option | Type | Required | Default | Description |
---|---|---|---|---|
code | string | ✅ | N/A | The Spectral OAS ruleset code for the validation rule to ignore |
path | array | ❌ | None | The specific path to ignore the rule for |
code
The code
option uses codes from the Spectral OpenAPI ruleset. For example, if you wanted to ignore operations without descriptions, you would use the operation-description
code:
{
...
"validationsToIgnore": [
{
"code": "operation-description"
}
]
...
}
All validation warnings and errors that match this rule will be ignored, unless the path
option is also set.
path
The path
in the spec to ignore the validation rule for. This is an array of strings, with each string being a section of the path to the object in the spec. For example, if you wanted to ignore the operation-description
rule only for GET requests to the root URL, you would use the following:
{
...
"validationsToIgnore": [
{
"code": "operation-description",
"path": [
"paths",
"/",
"get"
]
}
]
...
}
If this is not set, the validation warning or error is ignored for the entire spec.