Test
In the previous steps, we have generated the project and built it. Now the service is up and running. Let’s access it from the curl command.
Single query.
curl -k https://localhost:8443/v1/query
Result:
{"id":123,"randomNumber":456}
Multiple queries with the default number of objects returned.
curl -k https://localhost:8443/v1/queries
Result:
[{"id":123,"randomNumber":456},{"id":567,"randomNumber":789}]
Multiple queries with ten objects returned.
curl -k https://localhost:8443/v1/queries?queries=10
Result:
[{"id":123,"randomNumber":456},{"id":567,"randomNumber":789}]
Multiple updates with the default number of objects updated.
curl -k https://localhost:8443/v1/updates
Result:
[{"id":123,"randomNumber":456},{"id":567,"randomNumber":789}]
Multiple updates with ten objects updated.
curl -k https://localhost:8443/v1/updates?queries=10
Result:
[{"id":123,"randomNumber":456},{"id":567,"randomNumber":789}]
As you can see, we have a newly generated project that can output mock data from each endpoint defined in the OpenAPI 3.0 specification. There is no DB access code behind the scene. In the next step, we are going to create DB script and wire in the code for the MySQL database.