im a little confused about input objects with lacinia. It would seem that you'd often want have an object and input-object with the same name and structure. But apparently you are not allowed to have conflicting names. What is the best way to handle something like this? just add something to the start of end of the object name? i.g. create_my_object ?
is there a good reason why you cant have identical names? Maybe I am not understanding input-objects.
As long as you are thinking in terms of REST, it will seem odd that input objects and schema objects are side-by-side.
Because you are used to getting a copy of an object via a GET, modifying it in the client/browser, and then POST-ing it back to the URL to update it.
Even though that style of REST doesn't have reasonable answers for issues like partial updates, or changes that span across entities.
But if you link Input Objects to a specific use case of an update (not "update this order" but instead "change the quantity of the line item", for example), then the need for input objects mapping directly on top of schema objects starts to go away.
It's an asymmetry that requires a greater coordination between client and server, but removes a lot of ambiguities present in the REST model.
So don't think in terms of modifying the street address of your user object; think in terms of providing an AddressUpdate to a user (identified by id).
And that gives you an opportunity to, for example, move a lot of validation and processing that normally would have to be done in the client to the server, behind the mutation.
To be honest, our app is 99% query and 1% mutation, so we haven't had to explore all of that space.
But again, the split between input object and schema object can work towards your favor, by allowing the input object to reflect the UI more closely, and the schema object to reflect your data store more closely, and the mutation in the middle doing the mapping.
@hlship i see. Thanks for the awesome response.I think I understand better now and it makes sense. And btw thanks for amazing work on lacinia and lacinia pedestal. It's been a pleasure to use. Really good stuff.
Thanks! Feedback is really helpful; as the (primary) author, all I see in the code is the broken, ugly stuff.
Hey, we're building our whole new platform on top of Lacinia. Works a treat! Much appreciated š
Also relying heavily on Lacinia, thank you very much. Updating recently cleared up a couple of niggles too, like having to put {}
around the schema and remove &
š
In that case, Iām using it (Pedestal in Datomic Ions) and Iām having a great experience with it as well š