The API Response Validator Tool is a command-line utility designed to facilitate comparing API responses between two versions of your backend infrastructure. It helps ensure that the changes made in the database infrastructure do not inadvertently affect the API responses. The tool generates and compares mock API responses, providing insights into any discrepancies between the versions of HTTP Archive (HAR).
To install the API Response Validator Tool, follow these steps:
- Clone this repository to your local machine.
- Install the necessary dependencies by running
npm install
. - Ensure that you have Node.js and git installed on your machine.
- This has a dependency of a forked version of har-to-mocks. Clone this repo in the directory har-to-mocks
Before comparing the API responses, you need to generate mock responses . Follow these steps:
- Ensure that you have the necessary configuration files for the source and target versions (e.g.,
source.har
andtarget.har
). - Download and put the HAR file over here between two versions of app. Check youtube video how to export HAR from network tab
Once the mock API responses are generated, you can compare them to identify any differences. Follow these steps:
-
Run the following command to compare the API responses:
npm run diff
This command will compare the mock responses generated for the source and target versions. Any differences in the responses will be highlighted, providing insights into the impact of database infrastructure changes on API responses.
To view the differences in the API responses directly in VS Code's source control:
- Ensure that you have the Git extension installed in VS Code.
- After running the comparison command, open the VS Code source control view.
- You should see the changes in the
source
andtarget
folders, indicating the differences between the API responses of the two versions.
After being satisfied with the result, hit
npm run flush
Contributions to the API Response Validator Tool are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.