zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[Feature Request] Allow generating REST-flavored front-end hooks

Open reznakt opened this issue 4 months ago • 0 comments

Is your feature request related to a problem? Please describe.

At this time, ZenStack can generate an automatic CRUD API and OpenAPI specification in two flavors: RPC and RESTful.

However, the front-end hooks generated by either @zenstackhq/tanstack-query or @zenstackhq/swr assume the API uses the RPC flavor, making it impossible to use a RESTful auto-generated CRUD API and automatic front-end hook generation in the same project.

Describe the solution you'd like

It would be great if the front-end hooks could be generated in a manner that allows them to be used with the RESTful API flavor.

For example, the desired flavor could be controlled with the following option:

plugin hooks {
  provider = "@zenstackhq/tanstack-query"
  flavor = "rest"
}

Describe alternatives you've considered

At the moment, the only alternatives seem to be either not using the automatic front-end hooks or using the RPC API flavor.

reznakt avatar Aug 05 '25 11:08 reznakt