Skip to content

Commit 6eb3112

Browse files
committed
docs: writing validation docs.
1 parent 668228c commit 6eb3112

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ The **easy** framework supplies a nice and easy mechanism for validating instanc
113113

114114
The `validate()` function will validate its `subject`, and recursively the subjects properties. The outcome of this validation is always a `Results` object, with a list of shortcomings (in its `results` property) of the subject. The `Results` object also has a property `isValid`, which is set to `true` if the subject is valid, or to `false` when it is not.
115115

116+
The `validate()` validates the following:
117+
118+
- First it will check if the object you are validating is actually defined. If not, validation fails.
119+
- On value objects (objects that inherit from the `Value` class), it will check the `isValid` property. Therefore, `isValid` is a suitable location for implementing your value objects validity.
120+
- On enumerations (objects inheriting from the `Enum` class), it will also check the `isValid` property. However, usually, if enumerations are creating through their `byId()` function, if they are not valid, then `byId()` will have returned `undefined`.
121+
116122
### Constraints
117123
The easiest way to validate objects is to use constraints.
118124

0 commit comments

Comments
 (0)