[enhancement] add api endpoints for retrieving form schemas
See original GitHub issueSo what I mean is to be able to make a GET
request to something like /api/books/create.json
and then get a json back which defines which fields are accepted for a create-action and what validation those fields have. And then of course also for /api/books/edit.json
, since sometimes those two actions have different fields and validation associated with them.
Then I could write a service which translates that schema into a schema that for example Angular Formly can understand and boom! Automatic form generation directly from the entities themselves!
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Schemas - Django REST framework
API schemas are a useful tool that allow for a range of use cases, including generating reference documentation, or driving dynamic client libraries...
Read more >Endpoint Index - Marketo Developers
Endpoint Index. Here is a comprehensive list of REST API endpoints. ... Get Company Fields, Companies, GET, /rest/v1/companies/schema/fields.json
Read more >Schemas API Endpoint | Adobe Experience Platform
The /schemas endpoint in the Schema Registry API allows you to programmatically manage XDM schemas within your experience application.
Read more >Best practices for REST API design - Stack Overflow Blog
Learn how to design REST APIs to be easy to understand for anyone, future-proof, secure, and fast since they serve data to clients...
Read more >How to Connect to a REST Service - StepZen
Let's add two headers to the request. The first header is the User-Agent header, and the second is the X-Api-Key header. ... If...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I perfectly understand the problem and there’s been a few attempts at solving it by generating an Angular form based on a json config, which could easily be dumped from the back-end for example. Or simply have those “isomorphic” apps where sharing this peculiar bit of code can be easier. It’s just that there is no clear way to go at the moment as it depends a lot of your front-end stack and how you manage forms there.
My suggestion would be to experiment more in that area and if the solution is satisfying, then we could consider having it in the a core or as part of the ecosystem maintained by the core team. For example an idea would be to have a generator for Angular2 able to read the Symfony validator config and partially generate the code for the validation from it, although there’s bound to have dubious edge cases and this doesn’t solve the issue of maintaining a parity between the front-end/back-end. Then there’s the question of how portable that would be to other JS frameworks, how many of them should be supported…
@theofidry @Evertt Maybe you should be looking in what @dunglas has done in the api-platform/admin repository