Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC Shift schema PHP api out of LeftAndMain #348

Open
tractorcow opened this issue Nov 9, 2017 · 7 comments
Open

RFC Shift schema PHP api out of LeftAndMain #348

tractorcow opened this issue Nov 9, 2017 · 7 comments

Comments

@tractorcow
Copy link
Contributor

Introduction

At the moment the php form schema API is hard-coded into LeftAndMain with the following endpoints:

  • methodSchema()
  • schema()
  • getFormSchema()
  • setFormSchema()
  • getSchemaResponse()

Recommendation

Instead, I suggest to shift this into LeftAndMainFormRequestHandler. The schema method would be moved into this request handler as a default allowed_action.

Rationale

Primarily this would flatten and simplify the role of LeftAndMain.

The other aim is to eliminate unnecessary complexity required in routing schema urls. For instance, we need separate schema / methodSchema to resolve the schema action for any forms, and potentially more methods would need to be added for different form URLS.

Shifting this into a schema action on the request handler would automatically provide a schema route for any pre-existing form route.

For instance, the schema url

/admin/methodSchema/Modals/remoteCreateForm

would become:

/admin/Modals/remoteCreateForm/schema

@flamerohr
Copy link
Contributor

Also include moving FormField schema specific logic, we can achieve this with the use of extensions and schema data could be handled by generators.

@tractorcow described it to me much more succinctly than I can put into words.

@robbieaverill
Copy link
Contributor

Would make #240 obsolete

@flamerohr
Copy link
Contributor

Yes, the whole idea of moving all the schema out is so we could pull it out of framework entirely when it's not needed (e.g. we built a new admin which doesn't use the schema, or a framework only install)

@tractorcow
Copy link
Contributor Author

tractorcow commented Feb 28, 2018

Details I discussed with @flamerohr:

  • formfields dont manipulate schema anymore. There's a generator class (injected by extension) that does that
  • yaml can inject specific subclasses of generator for specific field types
  • shift LeftAndMainFormRequestHandler to this module. Make the name something smarter. Like SchemaFormRequestHandler.
  • admin module requires this new module

@flamerohr
Copy link
Contributor

I think LeftAndMainFormRequestHandler is very handy in itself (field actions), and it doesn't need to be coupled with schema logic.

But SchemaFormRequestHandler could be extending it!

@tractorcow
Copy link
Contributor Author

All LeftAndMainFormRequestHandler does is add another URL segment. that could be moved to core FormRequestHandler though.

@flamerohr
Copy link
Contributor

True, good point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants