This is an open discussion about a feature request.
_I'll take the example of GraphQL because I know better how it internally works, compared to open-api and other similar stuff._
Since GraphQL provides a schema, do you believe it would be a good idea to allow for the automated generation of react components and GraphQL queries based on the schema?
For instance, in this example there are src/components and src/queries files, which seem to have been hand-written (correct me if I'm wrong).
I wonder if we couldn't speed up the "hand writting" part by providing a script that would basically generate all those files, with sane defaults for all fields (relationships, images, etc.)
It would be so much of a time saver for big apps, and would also be a very nice addition when updating the GraphQL schema (run the script again to generate all new files and update existing ones).
Of course it adds the question of overriding what may have been previously customised. But it could be handled either by inheriting the "base" classes (those that are generated) or providing a "configuration" object to the "base" class that changes the behaviour of field generation. It's very raw idea and there is most likely nicer ways to deal with that particular point.
_Disclaimer: I'm getting started with react-admin and I want to build a backoffice website linked to my GraphCMS endpoint. I've successfully forked the example above and made it work for my own project, but I find the process of writing all components/queries really slow/boring and wonder how to improve that. I'd also love a way to update all my backoffice forms automatically when adding new fields in my GraphQL schema, that'd seriously be neat._
Our friends at API Platform are generating a React Admin based on Hydra and Open API.
We (the react admin core team) even met the API Platform team to collaborate on that integration.
You'll find every thing you need on the API Platform organization on GitHub!
This is a feature we would like to have in API Platform Admin :slightly_smiling_face:
And this is the related issue on our part: https://github.com/api-platform/admin/issues/160.
Thanks for the references! Looks like it's not possible to generate the whole thing just by connecting it to a GraphQL endpoint yet, but that's a desired improvement, which is a really good thing. :)
I won't have time to dig into it more, unfortunately. Great job on the automation of such boring tasks that Administration console/backoffice are. 馃挴
Just to be clear: react-admin provides a system called Guessers, which build the admin for a resource based on a request to the API. It can run with APIs with or without schema. API Platform used that Guesser system to implement a sophisticated guesser based on OpenAPI and Hydra.
It is possible to do the same for GraphQL (using the work done by API Platform admin as an inspiration). But the react-admin core team won't implement it - it should be done in userland.
Most helpful comment
Our friends at API Platform are generating a React Admin based on Hydra and Open API.
We (the react admin core team) even met the API Platform team to collaborate on that integration.
You'll find every thing you need on the API Platform organization on GitHub!