personium / personium-core

Core module of Personium
https://personium.io
Apache License 2.0
88 stars 16 forks source link

Consider supporting GraphQL #79

Open tuukka opened 6 years ago

tuukka commented 6 years ago

Hi! Have you considered implementing a GraphQL-compatible API and would it be a big change?

shimono commented 6 years ago

Hi! Thank you for your suggestion. GraphQL looks surely interesting. We had not considered implementing it before, so we read some web docs and had a little discussion. http://graphql.org/

We understood GraphQL has a philosophy to provide a single URL endpoint for all operations within a certain scope. So if we implement GraphQL APIs in our "Cell" or "Box", then one single endpoint should be implemented per each Cell, Box, or Unit.

GraphQL does not seem to provide optimistic locking, etc., so we can not take an option to immediately replace odata with it. GraphQL implementation on Personium should be something like a single convenient alias endpoint for each Personium object (Cell, Box, or Unit). It will probably provide convenient way for Personium App developers.

tuukka commented 6 years ago

Thank you for your quick assessment!

Regarding optimistic locking, you'd need to include a version/etag field in the data types and explicitly verify that a GraphQL mutation operation does not change the value, see e.g. https://sazzer.github.io/blog/2016/05/07/Designing-a-GraphQL-API/ and https://github.com/sangria-graphql/sangria-subscriptions-example