> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/demisto-sdk-development-guide/demisto-sdk-guide/demisto-sdk-commands/validate.md).

# validate

Ensures that YAML, JSON, and Markdown files in the content repository comply with Cortex standards so they can be processed by the platform, both locally and in GitLab.

<details>

<summary>Arguments</summary>

| Argument                          | Description                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-g, --use-git`                   | Validates changes using Git, checking the current branch's changes against `origin/master`. If the `--post-commit` flag is supplied, validation runs only on the current branch's changed files that have been committed. If the `--post-commit` flag is not supplied, validation runs on all changed files in the current branch, both committed and not committed. |
| `-a, --validate-all`              | Whether to run all validations on all files.                                                                                                                                                                                                                                                                                                                         |
| `-i, --input`                     | The path of the content pack/file to validate specifically.                                                                                                                                                                                                                                                                                                          |
| `-pc, --post-commit`              | Whether the validation should run only on the current branch's committed changed files. This applies only when the `-g` flag is supplied.                                                                                                                                                                                                                            |
| `-st, --staged`                   | Whether the validation should run only on the current branch's staged files. This applies only when the `-g` flag is supplied.                                                                                                                                                                                                                                       |
| `--prev-ver`                      | The previous branch or SHA1 commit to run checks against.                                                                                                                                                                                                                                                                                                            |
| `--no-multiprocessing`            | Runs `validate` on all files without multiprocessing for debugging purposes.                                                                                                                                                                                                                                                                                         |
| `-j, --json-file`                 | The JSON file path to which to output the command results.                                                                                                                                                                                                                                                                                                           |
| `--category-to-run`               | Runs specific validations by stating the category they're listed under in the configuration file.                                                                                                                                                                                                                                                                    |
| `-f, --fix`                       | Whether to auto-fix failing validations with an available auto-fix.                                                                                                                                                                                                                                                                                                  |
| `--config-path`                   | Path for a config file to run. If not given, the config file runs the default path at: `demisto_sdk/commands/validate/default_config.toml`.                                                                                                                                                                                                                          |
| `--ignore-support-level`          | Whether to skip validations based on their support level.                                                                                                                                                                                                                                                                                                            |
| `--run-old-validate`              | Whether to run the old validate flow. Alternatively, configure the `RUN_OLD_VALIDATE` environment variable.                                                                                                                                                                                                                                                          |
| `--skip-new-validate`             | Whether to skip the new validate flow. Alternatively, configure the `SKIP_NEW_VALIDATE` environment variable.                                                                                                                                                                                                                                                        |
| `-sv, --run-specific-validations` | A comma-separated list of validations to run for the stated error codes.                                                                                                                                                                                                                                                                                             |
| `--ignore`                        | Specifies an error code to not run. To ignore more than one error, repeat this option (`for example --ignore AA123 --ignore BC321`).                                                                                                                                                                                                                                 |

</details>

<details>

<summary>Examples</summary>

* `demisto-sdk validate --prev-ver SHA1-HASH`

  Validates only changed files compared to the specified SHA-1 commit hash.
* `demisto-sdk validate --post-commit`

  Runs a post-commit validation.
* `demisto-sdk validate -i Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.yml`

  Validates only the `Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.yml` file.
* `demisto-sdk validate -a`

  Validates all files under the `Packs` directory.
* `demisto-sdk validate -i Packs/HelloWorld`

  Validates all files under the `HelloWorld` content pack.
* `demisto-sdk validate --run-old-validate --skip-new-validate -a`

  Validates all files in the repository using the old `validate` method.
* `demisto-sdk validate --config-path {config_file_path} -a`

  Validates all files in the repository using the settings configured in the configuration file at the given path.

</details>

<details>

<summary>Validation error codes</summary>

Each error found by the `validate` command has an error code attached to it. The error code is in brackets preceding the error itself.

#### Example

`path/to/file: [IN103] - The type field of the proxy parameter should be 8`.

In addition, each pack has a `.pack-ignore` file. To ignore a certain validation for a given file, the error code needs to be listed in the `ignorable_errors` section in the validation configuration file, with the file name (only the name and extension, without the full path) and the error code to ignore.

#### Example

If the `.pack-ignore` file's `ignorable_errors` section contains `[file:ipinfo_v2.yml] ignore=BA108,BA109`, validation will not fail `ipinfo_v2.yml`  for error codes `BA108` and `BA109`.

</details>

<details>

<summary>Validation config file</summary>

You can define a validation config file to meet your specific requirements. If no file is defined, the default config file is used. The default configuration includes basic validation checks that ensure only valid content is uploaded to Cortex XSOAR.

#### Config file sections

Sections are defined in brackets `[]` in the validation config file. You can define the following sections:

* `ignorable_errors`: A list of the error codes that can be ignored for individual content items in the `.pack-ignore` file.
* `path_based_validations`: The configurations to run when running with the `-a` / `-i` flags.
* `use_git`: The configurations to run when running with the `-g` flag.
* `support_level.<support_type>`: The validations to ignore based on the content item support level. `support_type` is either `xsoar`, `partner`, or `community`. To ignore this feature in some of the calls, use the `--ignore-support-level` flag.
* Custom sections can be configured to run with the `category-to-run` flag. Two example custom categories are given with the default config file:
  * `xsoar_best_practices_use_git`: The recommended set of validations to run when running with `-g`. It may occasionally be modified.
  * `xsoar_best_practices_path_based_validations`: The recommended set of validations to run when running with `-a` / `-i`. It may be occasionally be modified.

#### Section options

Each section has the following options:

* `select` - The validations to run.
* `warning` - Set a validation to only throw a warning and not fail the flow.

#### Example

To run only `BA101` error validation:

```programlisting
[custom_category]
select = ["BA101"]
```

#### Example

To run all the validations with error codes BA100, BA101, and BA102, except for BA102 for community supported files:

```programlisting
[custom_category]
select = ["BA100", "BA101", "BA102"]
[support_level.community]
ignore = ["BA102"]
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/demisto-sdk-development-guide/demisto-sdk-guide/demisto-sdk-commands/validate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
