Auto-generate gRPC APIs examples for documentation

Following discussion on PR engine #1092, we should auto-generated the responses of the gRPC APIs for documentation.

The tool grpcurl is really simple to use to interact with the API.
We could save the requests payload in JSON files, write the grpcurl commands in a bash file, and save the responses to new JSON files:

Example with the ServiceX/Create API:

grpcurl -plaintext -d "$(cat ServiceX-Create-request.json)" localhost:50052 api.ServiceX/Create > ServiceX-Create-response.json

This system could be very similar or even merged with a suite of integration tests!
We will have anyway to define the request and the expect response in order to run the integration tests.

I drafted a script that use grpcurl and jq to execute all 4 apis of Service: https://github.com/mesg-foundation/engine/pull/1100.

1 Like