Client documentation
Client docs
Requirements
OpenAPI generator used
Instalation instructions: https://openapi-generator.tech/docs/installation#bash-launcher-script
Version used:
openapi-generator-cli 6.6.0
commit : 7f8b853
built : -999999999-01-01T00:00:00+18:00
source : https://github.com/openapitools/openapi-generator
docs : https://openapi-generator.tech/
Generating the client:
(optional) Update the openapi.json spec:
- docker compose up
- curl -s http://localhost:4242/docs/openapi.json | jq > openapi.json
Generate client from opeanpi.json
./generate.sh
After generating the code you can use main.go to test it works (before running the command below start Unleash server with docker compose up)
go run main.go -unleash-api http://localhost:4242 -authorization *:*.unleash-insecure-admin-api-token
Testing
Testing relies on a running environment. You can use docker-compose.yml file to spin up an environment with a clean state and predictable admin API token
A basic test is automatically generated by the tool (find them under client/test), but they don't have a default configuration and doesn't have payloads required for some of the endpoints. This is the reason why the tools marks all of them as Skip. Still they're a good starting point.
We recommend copying specific tests from client/test into test and adapting them accordingly. We've done that already for api_users_test and some of its methods
Running the tests
- (optional but recommended)
docker compose rm --force
docker compose up
go test ./test/...