[ 
https://issues.apache.org/jira/browse/IGNITE-23501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksandr updated IGNITE-23501:
-------------------------------
    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. 

  was:
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. 


> Implement default REST client
> -----------------------------
>
>                 Key: IGNITE-23501
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23501
>             Project: Ignite
>          Issue Type: Epic
>          Components: rest
>            Reporter: Aleksandr
>            Priority: Major
>
> 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. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to