# uip rules validate

> Syntax and options for `uip rules validate`, which checks a Business Rules project for the errors Studio Web blocks publish and debug on.

`uip rules validate` checks a Business Rules project for what Studio Web blocks publish and debug on. It reports two kinds of diagnostics:

- The Studio Web designer's diagnostics for each `.dmn` file at the top level of the project. Their codes start with `DMN_`.
- `RULES_ENTRY_POINTS_STALE` when `entry-points.json` does not match the `.dmn` files. Run [`uip rules refresh`](./uip-rules-refresh.md) to fix it.

Diagnostics with severity `error` fail the command. Diagnostics with severity `warning` are reported only. The command does not write any file.

## Synopsis

```
uip rules validate <project-path>
```

## Arguments

| Name | Required | Purpose |
|---|---|---|
| `<project-path>` | yes | Path to the Business Rules project directory. The directory must contain `project.uiproj`. |

## Example

```bash
uip rules validate ./LoanEligibilitySolution/LoanEligibility
```

## Data shape (--output json)

```json
{
  "Code": "RulesValidate",
  "Data": {
    "Status": "Valid",
    "ProjectPath": "/workspace/LoanEligibilitySolution/LoanEligibility",
    "DmnFiles": ["Business rule.dmn"],
    "Diagnostics": []
  }
}
```

When the project has at least one error, the command returns a failure envelope with `Code: "RulesValidate"`, `ErrorCode: "invalid_argument"`, and `Data.Status: "Invalid"`. `Instructions` lists each diagnostic on its own line.

Each entry in `Diagnostics` has these fields:

| Field | Description |
|---|---|
| `File` | The file the diagnostic applies to: a `.dmn` file, or `entry-points.json`. |
| `Code` | The diagnostic code, for example `RULES_ENTRY_POINTS_STALE`. |
| `Severity` | `error` or `warning`. |
| `Message` | The diagnostic message. |
| `Instructions` | How to fix the issue, when available. |
| `Target` | The element of the document the diagnostic points to. |

## Exit codes

Refer to [Exit codes](./exit-codes.md) for the shared contract. The command exits `1` when any diagnostic has severity `error`, or when the project has no `.dmn` file at its top level (`ErrorCode: "not_found"`).

## Related commands

- [`uip rules refresh`](./uip-rules-refresh.md) fixes `RULES_ENTRY_POINTS_STALE`.
- [`uip rules debug`](./uip-rules-debug.md) evaluates the rule with sample inputs.

## See also

- [`uip rules`](./uip-rules.md) for the tool overview and project layout.
