Details
Description
The REST interface is growing and the support of new endpoints getting messy. What we do now to support, say, /hello new endpoint:
- go to rest-api module and add new HelloApi interface with proper documentation and annotations
- go to rest module and implement the HelloApi with a java class, annotated with Controller
- go to rest module tests and write integration test for HelloController:
- but.. here we need REST client that we have to generate from OpenAPI spec, so
- import generated client and write some code around generated one
- write tests and commit working solution!
The next thing we do is the support for CLI command for new REST method, so we:
- go to cli module and write some command-related code
- somewhere inside we import the generated REST client and
- write some code around generated one
- go to cli tests and write some tests.
As we can see, we write additional code both in cli and rest modules and this code is the same code.
I suggest introducing rest-client module that will implement the rest-api with clear and well-organized hand-written code. But use the generated rest client inside just to validate our Open API is correct. We can even distribute rest-client as a separate "default" implementation for the Ignite REST API.