This documentation is used to:
- Provide developers with documentation for using the LEV API
- Provide the contract for the LEV API, including example responses
- Provide a mock version of the LEV API
- Provide end to end tests against the API
To run any of the tasks in this repository you will need npm and nodeJS installed.
API documentation is available here
drakov is required (though will also be installed in node_modules directory if needed)
npm install -g drakov
drakov -f lev-api.md -p 8080 --discover -s html-docs
-p defines the port
--discover gives a /drakov endpoint which lists available urls
-f is a global to the specification file
-s gives a /lev-api.html endpoint (gives endpoints for all static files here)
docker-compose is required dredd is required (though will also be installed in node_modules directory if needed)
npm install -g dredd
Install all dependencies:
npm install
dredd lev-api.md http://localhost:8080
Environment variables need to be set for oauth properties, e.g.
KEYCLOAK_U=dredd-tests KEYCLOAK_P="xxxxx" REALM=lev-api-dev CLIENT_ID=dredd-tests CLIENT_SECRET=xxxxxx \
dredd lev-api.md http://localhost:8080 --server false --server-wait 0 --hookfiles=./hooks/oauth2.js
docker build -t lev-api-e2e-tests .
docker run --rm -e KEYCLOAK_U=dredd-tests -e KEYCLOAK_P="xxxxxx" \
-e REALM=lev-api-dev -e CLIENT_ID=dredd-tests -e \
CLIENT_SECRET=xxxxxx lev-api-e2e-tests \
lev-api.md https://lev-api-dev.notprod.homeoffice.gov.uk \
--hookfiles=./hooks/oauth2.js
Open the report.html file that is generated after running the tests
There is a git hook to update the html version of the documentation on commit.
./node_modules/.bin/aglio -i lev-api.md -o html-docs/lev-api.html
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the GPLv2 License - see the LICENSE.md file for details