Validation of Response Results
what is data validation
Data validation involves defining the expected format of returned data in advance using JSON Schema
. After the interface is implemented, you can identify issues by comparing the actual response with the predefined format.
To begin, you need to design the expected data structure in the Design
tab.
Once the interface development is complete, the returned results can be validated for correctness.
Setting Up Data Validation
You can define the expected data return format by navigating to Design -> Predefined Response -> JSON Schema
. This allows you to set up the expected data format for the interface, ensuring consistency between the actual and expected results.
Common Issue: "Returned Data Format is Not JSON"
One frequent question from users is: "Why does the data validation prompt me with 'Returned data format is not JSON' when my response is clearly in JSON format?"
This issue usually occurs when the response appears to be in JSON format, but the actual format being returned is different (you can check the Content-Type in the response headers). It's like saving an image as a .txt file—it may seem correct, but the underlying format is not.