Is a value present when it must be?
Validation
Checking whether incoming data follows required rules before it is processed.
What is it?
Validation checks whether data is acceptable before the system continues processing it.
Validation checks whether the input is valid.
Think of it like...
Think of a security checkpoint.
Before data enters the main process, it must pass the required checks.
What does it do?
Validation can check:
Is the value a number, text, boolean, or other expected type?
Does it match one of the accepted choices?
Is a number within the permitted limits?
Does it follow a required pattern, such as an email or date?
Does it meet a rule required by the system?
Where is it used?
Validation is used in:
Check data received by an endpoint.
Give users feedback before submission.
Protect processing from invalid input.
Check rows before they enter the system.
Confirm each step has acceptable data.
Keep stored data within required rules.
Example
Order Request
Input
{
"quantity": -10
}Rule / Result
Rule: quantity must be greater than 0 Result: Validation Failed
How it connects
If invalid: Request → Validation → Error Response
Do Not Confuse
Validation
Checks whether data is acceptable.
Business Logic
Decides what the business operation should do.
Validation checks the input.
Business logic decides the action.
Topic Glossary
| ENGLISH TERM | 中文 | SIMPLE ENGLISH | 中文小白理解 |
|---|---|---|---|
| Validation | 校验 | Checking whether data follows required rules. | 在系统继续处理前检查输入数据是否符合要求。 |
| Required Field | 必填字段 | A field that must contain a value. | 必须填写或传入数据的字段。 |
| Data Type | 数据类型 | The kind of value a field accepts. | 字段允许接收的值类型,例如数字或文本。 |
| Constraint | 约束 | A rule that limits allowed data. | 用来限制哪些数据可以被接受的规则。 |
| Invalid Data | 无效数据 | Data that does not meet the rules. | 不符合系统规定的数据。 |
| Validation Error | 校验错误 | An error returned when data fails validation. | 输入数据没有通过校验时返回的错误。 |
What to Remember
Validation checks data before processing.
Invalid input should be rejected clearly.
Validation protects business logic and data quality.