[openstack-dev] [api] REST limitations and GraghQL inception?

Jay Pipes jaypipes at gmail.com
Thu May 3 17:50:48 UTC 2018


On 05/03/2018 12:57 PM, Ed Leafe wrote:
> On May 2, 2018, at 2:40 AM, Gilles Dubreuil <gdubreui at redhat.com> wrote:
>>
>>> • We should get a common consensus before all projects start to implement it.
>>
>> This is going to be raised during the API SIG weekly meeting later this week.
>> API developers (at least one) from every project are strongly welcomed to participate.
>> I suppose it makes sense for the API SIG to be the place to discuss it, at least initially.
> 
> It was indeed discussed, and we think that it would be a worthwhile experiment. But it would be a difficult, if not impossible, proposal to have adopted OpenStack-wide without some data to back it up. So what we thought would be a good starting point would be to have a group of individuals interested in GraphQL form an informal team and proceed to wrap one OpenStack API as a proof-of-concept. Monty Taylor suggested Neutron as an excellent candidate, as its API exposes things at an individual table level, requiring the client to join that information to get the answers they need.
> 
> Once that is done, we could examine the results, and use them as the basis for proceeding with something more comprehensive. Does that sound like a good approach to (all of) you?

Did anyone bring up the differences between control plane APIs and data 
APIs and the applicability of GraphQL to the latter and not the former?

For example, a control plane API to reboot a server instance looks like 
this:

POST /servers/{uuid}/action
{
     "reboot" : {
         "type" : "HARD"
     }
}

how does that map to GraphQL? Via GraphQL's "mutations" [0]? That 
doesn't really work since the server object isn't being mutated. I mean, 
the state of the server will *eventually* be mutated when the reboot 
action starts kicking in (the above is an async operation returning a 
202 Accepted). But the act of hitting POST /servers/{uuid}/action 
doesn't actually mutate the server's state.

This is just one example of where GraphQL doesn't necessarily map well 
to control plane APIs that happen to be built on top of REST/HTTP [1]

Bottom line for me would be what is the perceivable benefit that all of 
our users would receive given the (very costly) overhaul of our APIs 
that would likely be required.

Best,
-jay

[0] http://graphql.org/learn/queries/#mutations
[1] One could argue (and I have in the past) that POST 
/servers/{uuid}/action isn't a RESTful interface at all...



More information about the OpenStack-dev mailing list