On Tuesday, October 4, 2016 at 5:54:01 PM UTC+1, Kasey Speakman wrote: > > Seems like this is trying to normalize operations to CRUD. I would be > careful of over-standardizing early. Because later you will likely have to > break those abstractions to implement new features. For example, the way I > would implement a Customer merge would not fit semantically into one of > those operations. >
Yes, what I am doing is using codegen + a data model to create a starting point for a service. You get CRUD plus finders to get things started. I also codegened a client in Elm, again giving me CRUD plus finders on the client side. I then add new operations or remove ones that I don't want by hand. It is over standardizing but it is also incredibly useful and helps me get things up and running very fast. Find by example is particularly useful in the early stages of a project, as it can generate a good range of queries with little effort. Eventually I will add more flexibility to the codegen to let me select which operations out of CRUD plus finders I actually want to generate plus any other useful standard operations I can think of. Also better modelling of custom operations that are hand coded, such that the codegened client does not also need those added by hand but can always be automatically made to fully match the server side API. So for the purposes of this thread, don't get too hung up on the over standardized API. What is interesting from the point of view of Elm is how I have wrapped up the REST operations in a module and tried to minimize the amount of boilerplate needed to use them. === One thing I will have to change is the error handling. I need to know if individual operations fail and how - for example, when doing a create if the entity to create fails server side validation I need to know that and also get some errors from the server and be able to render those in the UI. I think a catch-all error hander is still useful, perhaps I will try and set things up so the error goes to an endpoint specific handler first, and then on to the catch all if the specific handler does not process it. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
