Principle:APIJSON APIJSON Demo API Response Validation
| Knowledge Sources | |
|---|---|
| Domains | Validation, Testing, API_Design |
| Last Updated | 2026-10-14 00:00 GMT |
Overview
Technique for validating and comparing APIJSON HTTP responses against expected standards using structural diff comparison with optional ML tolerance.
Description
API Response Validation checks APIJSON response status codes, extracts standard fields (code, msg, count, total), and performs deep structural comparison between actual responses and expected standards. It supports ML tolerance mode for flexible matching and can update standards incrementally based on observed responses.
This solves:
- Regression testing: Detecting breaking changes in API responses automatically.
- Standard maintenance: Updating expected response standards as APIs evolve.
- ML tolerance: Allowing minor variations in responses without flagging false positives.
Usage
Use this principle when:
- Building automated API regression test suites.
- You need to compare actual vs. expected API responses with structural awareness.
- Maintaining evolving API response standards across API versions.
Theoretical Basis
Validation Pipeline:
HTTP Response
│
▼
[1] Extract: code, msg, count, total from response
│
▼
[2] Check: code == 200 (success)?
│
▼
[3] Compare (optional):
- Deep diff: standard vs. response
- Detect: add, remove, update, change
- ML mode: tolerate type/variance
│
▼
[4] Update Standard (optional):
- Merge new fields from response into standard
- Preserve expected types