CyanAsterisk / FreeCar

Time-sharing car rental system suite based on CloudWeGo series framework
GNU General Public License v3.0
242 stars 41 forks source link

Missing api.proto file when initializing Hertz server #158

Closed YannLee1208 closed 1 year ago

YannLee1208 commented 1 year ago

In server/cmd/api/Makefile, to initialize (auto generate hertz code), we need hz new -idl ./../../idl/api.proto -mod github.com/CyanAsterisk/FreeCar/server/cmd/api. But fail to find api.proto in such path

L2ncE commented 1 year ago

It looks like the init in the Makefile is not updated, let me check

L2ncE commented 1 year ago

In the past, we included all the IDL of the http part with an api.proto, and later we split it and deleted the api.proto, so now we only need to use the command in generate, and I will update README later. If you are interested you can submit a PR to help us fix this issue.

YannLee1208 commented 1 year ago

So to produce the api folder by hz command, which idl profile we need to specify?

YannLee1208 commented 1 year ago

Or maybe just hz new -mod xxx/cmd/api? So when do we use the IDL files in idl/http/*, because as I see folds like cmd/car are generated by kitex for RPC services.

L2ncE commented 1 year ago

You can define an IDL file about the api yourself or create it manually.

Regarding the IDL file under the http folder, you can see its function in the biz folder.

YannLee1208 commented 1 year ago

Thks for explaining. An error found in Makefile in cmp/api/, to use hz command to generate all services in idls, we need to specify "-force". So better add option -force in generate block.

Claude-Zq commented 1 year ago

Makefile is now updated https://github.com/CyanAsterisk/FreeCar/pull/159 @YannLee1208