Skip to content

GraphQL for Apiv3 #4182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
agjohnson opened this issue Jun 4, 2018 · 5 comments
Closed

GraphQL for Apiv3 #4182

agjohnson opened this issue Jun 4, 2018 · 5 comments
Labels
Needed: design decision A core team decision is required
Milestone

Comments

@agjohnson
Copy link
Contributor

@humitos and I discussed APIv3 more this morning. He brought up GraphQL as an option for maintaining a flexible API client side. I don't have experience using GraphQL, but it could reduce the amount of code we're maintaining, or move the code to a more maintainable spot.

A few points worth considering:

  • Path of least resistance is to continue with DRF
  • I don't think there are any particular problems we have with DRF. We should weigh these, if any
  • The biggest design flaw with our current API pattern is that our build system treats the objects returned from the API as Django model-like objects. I have wanted our build system to be directly API driven: instead of using methods on a client side, this should be data driven from the API return. Does GraphQL get us closer?
  • GraphQL is an obvious win from the client side. Our APIv2 is mostly not helpful outside our build system
  • Tangent idea: build is celery driven and drop the need for the API altogether there

Any other points?

@agjohnson agjohnson added the Needed: design decision A core team decision is required label Jun 4, 2018
@agjohnson agjohnson added this to the API milestone Jun 4, 2018
@safwanrahman
Copy link
Member

safwanrahman commented Jun 4, 2018

I am not comfortable to use GraphQL if its not highly necessary.
Using Rest API would be helpful as developers are comfortable with the design, as well as good development resource.
I dont know, if there are any auto API documentation is present for GraphQL, but for DRF, there are plenty auto doc generators.

@ericholscher
Copy link
Member

I'm generally -0. Last time I talked w/ folks about it, it didn't seem like there was strong support for the server-side in Python, and it would be locking ourselves into a much smaller ecosystem. I think just building a proper REST API with REST Framework is going to be the best path forward for most of our users, and the simplest thing that we can do.

@humitos humitos mentioned this issue Jun 21, 2018
@humitos
Copy link
Member

humitos commented Jul 3, 2018

Maybe worth to mention that Gitlab is moving to GraphQL: https://docs.gitlab.com/ee/api/README.html#road-to-graphql

@agjohnson
Copy link
Contributor Author

I still agree that DRF is least resistance, but GraphQL does solve our issues with schema design, and doesn't put additional burden on us to create a useable schema -- something we haven't been great at designing thus far.

With some testing, I'm not worried about the server side implementation. There is graphene_django, the server portion of the graphql implementation for django, it looks mature.

I'm the most hesitant about the client side though. I don't think it addresses some of our problems with API client use, and querying looks much less approachable than some of the ORM-y REST clients that we could use.

Next steps could be to do a POC, but I'm probably not sold on graphql solving what problems we do have. I'd say we'd be better off enumerating these issues and coming up with patterns that address them instead. The biggest pattern we need to remove is the builder-only modeling, I think we can get this to strictly client side REST if we make some privileged REST models that have a lot more fields in the response.

@agjohnson
Copy link
Contributor Author

I'll say we can close this. I don't think we have enough support to consider graphql as an option here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: design decision A core team decision is required
Projects
None yet
Development

No branches or pull requests

4 participants