7.1.1.5 Timing of Validation

For those write methods that require a save, implementers have considerable flexibility in deciding whether a particular validation is to be performed immediately during the invocation of the write method or later on save. For example, in the case Node.addNode, an implementer might immediately check that the path given is valid while postponing validation of node type constraints until save-time.

The suggestion is that an implementation should perform each validation as soon as possible, given the underlying design of the repository.

The requirement is that an implementation must prohibit the emergence of a persistent state in violation the validation rules defined by this specification. Therefore at the latest, all validation must be done on save.

In the context of a particular change to an item, we often refer to save generically, as in, “the change will be persisted on save”. Such statements refer to any invocation of save, (Session.save or Item.save) that include the changed item within its scope.