Hacker News new | ask | show | jobs
by neeeeees 2006 days ago
I think I can answer part of this. I worked on building GraphQL APIs dynamically from Rails models as sort of a pet-project at Shopify a few years ago.

It’s not a difficult task, but when discussing viability with the APIs team, the general consensus was that you don’t want your API coupled to your data. Most of the time, you don’t want to expose everything.

Of course, you can start describing what to omit, but now you’re just writing an API design by omission.

Building good APIs is hard, so you want to build the right abstraction - which is not always the easiest one.

1 comments

That sounds awesome and also a huge headache. I've found its much easier to work with an ORM that is specifically designed for GraphQL, like TypeORM[1]. Otherwise you are just kind of trying to force a square peg in round hole (like Graphene[2] for Django). As for not exposing some data, just use "private" schema directives, etc.

[1] https://github.com/typeorm/typeorm [2] https://github.com/graphql-python/graphene