This repo contains code for generating a JSON file we can feed to Mockoon CLI to get Online Care API spec compliant data back.
To use the current Mockoon JSON file as your mock server config. Do the following.
- Run
npm installif you haven't yet. - Run
npm run write-datato generate the necessary mock data files. - Run
npx mockoon-cli start -d ./src/mockoonFile.json. - Send calls to http://localhost:3005/api/v1. So if you wanted to, for example, hit the
/conditionsendpoint, you would call http://localhost:3005/api/v1/conditions.
The Mockoon JSON file should never be edited manually. If you want to test something quick with a manual edit, make sure to either discard the change once you no longer need it, or add the change via script if you want it to persist.
If the spec is updated and we need to get the mock server in sync with it, complete the following steps.
- Replace the bundled yaml spec file with the updated file.
- Run
api-typesto update our generated types. - Make the necessary fixes for any type errors in our responses and mock data files.
- Feed the new bundled spec file you used in step one to the Mockoon desktop app and see all of the routes populate.
- Click on the three dots in the configuration you just created (in the farthest left panel) and click "Copy configuration to clipboard (JSON)".
- Replace the current Mockoon JSON file with the JSON you just copied to your clipboard.
- Run
npm run write-datato make the necessary changes to the new config file. - Run
npx mockoon-cli start -d ./src/mockoonFile.jsonand make sure the mock server is working by hitting the unchanged routes and the routes that had updates at http://localhost:3005/api/v1.