> For the complete documentation index, see [llms.txt](https://docs.aurelia.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aurelia.io/aurelia-packages/validation/migration-guide.md).

# Migration Guide & Breaking Changes

Creating and customing Aurelia Validation rules to ensure data is validated.

This section outlines the breaking changes introduced by `@aurelia/validation*` as compared to the predecessor `aurelia-validation`. However, it is recommended that you read the documentation, as many new features have been added.

## A list of differences

### Functionality is now in three different packages

Instead of a single validation package, the functionalities are arranged in [three different packages](/aurelia-packages/validation.md). These are `@aurelia/validation` (provides core functionalities), `@aurelia/validation-html` (provides integration with the view), and `@aurelia/validation-i18n` (provides localization support for validation in view).

### Rules are defined differently using ValidationRules

Usage of `ValidationRules` in terms of defining rules is a bit different. The example below shows the difference. Refer to the [Defining rules](/aurelia-packages/validation/defining-rules.md) section for the details.

```typescript
// aurelia-validation
  ValidationRules
    .ensure('firstName')
      .required()
    .on(this.person);

// @aurelia/validation
import { IValidationRules } from '@aurelia/validation';
//...
constructor(
  validationRules: IValidationRules = resolve(IValidationRules)
) {
  ValidationRules
    .on(this.person)
    .ensure('firstName')
      .required();
}
```

### Named registration of custom rules is no longer supported

Named registration of reusable custom rules is no longer supported in favor of simply using an instance of the rule implementation. The example below shows the difference. Refer to the [Customizing rules](/aurelia-packages/validation/defining-rules.md) section for the details.

```typescript
// aurelia-validation
ValidationRules.customRule(
  'customRule',
  // rule body
  // rule config
);

ValidationRules
  .ensure('property')
    .satisfiesRule('customRule' ...);

// @aurelia/validation
class CustomRule extends BaseValidationRule { // of implements IValidationRule
  // rule config
  public execute() {
    // rule body
  }
}

validationRules
  .on(obj)
  .ensure('property')
    .satisfiesRule(new CustomRule(...));
```

### The validator interface only has one method

The validator interface has been changed to have only one `validate` method equipped with validation instructions. Refer to the [Validator and validate instruction](/aurelia-packages/validation/validate-binding-behavior.md) section for the details.

### Validation controller factory usage changed

The usage of the validation controller factory is changed. Instead of using `controllerFactory.createForCurrentScope();` , you need to inject the `newInstanceForScope(IValidationController)` (example: `resolve(newInstanceForScope(IValidationController))`). Refer to the [Injecting a controller instance](/aurelia-packages/validation/validation-controller.md) section for the details.

### Validation renderer has been removed

No validation renderer in favor of `ValidationResultsSubscriber`. Refer to the [`addSubscriber` and `removeSubscriber`](/aurelia-packages/validation/validation-controller.md#addsubscriber-and-removesubscriber) section for the 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aurelia.io/aurelia-packages/validation/migration-guide.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
