question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[enhancement] add api endpoints for retrieving form schemas

See original GitHub issue

So 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:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
theofidrycommented, May 31, 2017

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…

0reactions
Simperfitcommented, Jun 6, 2017

@theofidry @Evertt Maybe you should be looking in what @dunglas has done in the api-platform/admin repository

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found