The road to graphql

Hi devs,

I quickly wanted to share the progress of our road to a graphql api.
Most of the scaffolding work to be able to query the API has been merged (thanks to @Ondrej_Prazak!). The only PR still missing is the one that defines connections (basically relationships between models).

We’ll start opening merge requests to add more queries next week. To make it easy to review the PRs we’ll do a separate PR for each rails model (when it makes sense). I encourage everyone who wants to get familiar with the API to review the PRs. Once the PRs are open and you have a lot of example code to choose from, feel free to extend the API yourself. I’m happy to review the PRs. In my opinion, it’s a tiny little bit simpler than the apipie and rabl approach from APIv2.

The next step would be to add Mutations, these are basically POST/UPDATE/DELETE queries in a REST api. We also have a scaffolding PR open for that.

Please see the tracker issue on Redmine for more details:
https://projects.theforeman.org/issues/22109

I’m also looking forward to seeing the API being used on the client side. Please note, that we agreed to consider the API as experimental for now.

If you have any questions or comments, just let me know.

Timo

7 Likes

A brief update: The most important queries have been merged, so we have a good read-only graphql coverage.
We’ll probably add Compute Resource Network queries and SshKey queries next. And then continue with a mutation (probably at a slower pace).

Let me know if you have any questions and feel free to add some queries yourself. It’s quite fun.

2 Likes

Yet another update. Approximately 30 PRs have already been merged. Thanks to everyone involved. :slight_smile:

We now have more types merged and the first three mutations for the Model model, so you can do complete CRUD operations for Models.

There are still two PRs I’d really like to get into 1.22 as they fix some glitches (with sorting and id resolving) and are required for plugins that have namespaced models. If they get into the release plugin authors can already start writing types without having to rely on an unstable API. I know we defined the API to be experimental, but I still want to make sure everything we have does work.

There are three more (small) PRs that would also be good to have, but that’s not a requirement.

Speaking of plugins, I wrote some example code how plugins can hook into the graph and define own queries.

I’m currently working on adding a host create mutation. As this is probably one of our most complex things it’s good to have that in early to have a good reference.

4 Likes