phramework / jsonapi

jsonapi implementation for phramework
https://phramework.github.io/jsonapi/
Apache License 2.0
4 stars 2 forks source link

Alternative design pattern for handlePOST etc methods #52

Open nohponex opened 7 years ago

nohponex commented 7 years ago

Further discussion needed

Current design pattern makes it very complicated when implementing complex handlePOST or PATCH methods.

Since in real life world additional checks, transformations have to be made before executing, custom logs, notifications should be processed after and flags and messages to be passed between these two.

Current validationCallbacks and viewCallback is no fit for the job, since passing message requires passing variables by reference so the modified value can be passed to viewCallback

Proposals:

nohponex commented 7 years ago

https://github.com/phramework/jsonapi/issues/51

nohponex commented 7 years ago

Since it seems that most of the checks are reusable, a middleware solution seems ideal Of course a name conversion for compatibility should be used since a lot of attributes should be read and written in each layer