Make Gii accessible via Restful API


(Stefano Mtangoo) #1

Right now you have to use Forms to submit information in Gii. That is good, but it would be better if we could do code generation via an API. That will remove the need for Tools (IDEs et al) to be able to generate things using their own “forms” and just POST to API, than now when you have to use ./yii for generating codes automatically.

Using ./yii in code generation is difficult (you have to manage the launched process on different thread to avoid blocking the UI which adds overhead). Also managing response message especially in case of error is difficult.

My Proposal is:

  1. Move all Gii functionalities to REST API
  2. The current UI should be only a front end to that API

(Alexander Makarov) #2

Do you plan developing Gii plugin for a certain IDE?


(Stefano Mtangoo) #3

Yes. We have our Own IDE that we use for internal development and automating code generation was a nightmare. Only viable option was ./yii and it was a terrible experience since it wasn’t designed with IDE/Autocode generator in mind.

On Other hand we had a nice experience with TernJs simply because it had an API for communication.

To answer your question is Yes. Other IDEs will also benefit.


(Alexander Makarov) #4

Sounds interesting but it certainly isn’t high priority feature. REST API could be added later. Please create an issue in yiisoft/yii-gii not to forget it. Thanks.


(Stefano Mtangoo) #5

Opened ticket: https://github.com/yiisoft/yii-gii/issues/15


(Uldis Nelsons) #6

Gii generator is very complicate device. If it move to REST, add additional layer do Gii more complicate.


(Stefano Mtangoo) #7

How will the API complicate things since it does not add completely new functionality? It will re-use the same code that is already working and add few REST specific stuffs. Can you be more specific as to the source of complexity?


(Uldis Nelsons) #8

THE WEB forms are one of the most important benefits of Gii, where set up the necessary parameters. I doubt that there will be realised in the inside of the IDE. I’d like the option when Gii works that an independent WEB service. For example, if you are creating Yii APIs for an application, it is prohibitive to launch Gii.