# Irmin graphql keys are reversed

**URL:** https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509
**Category:** Learning
**Tags:** irmin, graphql
**Created:** [April 13, 2020, 12:59pm UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509 "2020-04-13T12:59:28Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![erhan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/erhan/32/1919_2.png) [@erhan](https://discuss.ocaml.org/u/erhan)
#### Post date: [April 13, 2020, 12:59pm UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/1 "2020-04-13T12:59:28Z")

</div>

Hi everyone.

I am using **irmin** and **irmin-graphql**. There is one thing I noticed while I am using irmin-graphql client. The thing is graphql query result of sub directories are represented reversibly. For example this is the query in graphql:

```auto
{
  master {
    tree {
      get_tree(key: "/src/ppx_irmin/lib") {
        list {
          key
          __typename
        }
      }
    }
  }
}

```

and this is the output:

```auto
"list": [
  {
    "key": "/lib/ppx_irmin/src/algebraic.ml",
    "__typename": "Contents"
  },
  {
    "key": "/lib/ppx_irmin/src/algebraic.mli",
    "__typename": "Contents"
  },

```

So you can see that `/src/ppx_irmin/lib` becomes `/lib/ppx_irmin/src/`. I would’t mind that much normally but I am trying to create a client from this queries. Therefore these reverse keys doesn’t help for the automation. I have to split and reverse them each and every time.

Is this a bug or the normal way of the query result?

- irmin 2.1.0
- opam 2.0.6
- ocaml 4.09.0

I guess you can reproduce it with steps below:

```auto
opam install irmin irmin-git irmin-graphql
mkdir /tmp/irmin
cd /tmp/irmin
irmin clone -s git https://github.com/mirage/irmin.git
irmin graphql --port 9876 --root /tmp/irmin
# browse http://localhost:9876/graphql

```

---

<div class="post-metadata">

### Author: ![CraigFe](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/craigfe/32/1989_2.png) [@CraigFe](https://discuss.ocaml.org/u/CraigFe)
#### Post date: [April 13, 2020, 1:14pm UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/2 "2020-04-13T13:14:06Z")

</div>

This looks like a bug to me. I’m currently investigating.

---

<div class="post-metadata">

### Author: ![CraigFe](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/craigfe/32/1989_2.png) [@CraigFe](https://discuss.ocaml.org/u/CraigFe)
#### Post date: [April 14, 2020, 7:06am UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/3 "2020-04-14T07:06:17Z")

</div>

This was indeed a bug, soon to be fixed by [https://github.com/mirage/irmin/pull/989](https://github.com/mirage/irmin/pull/989).

Thanks for the report!

---

<div class="post-metadata">

### Author: ![erhan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/erhan/32/1919_2.png) [@erhan](https://discuss.ocaml.org/u/erhan)
#### Post date: [April 14, 2020, 12:38pm UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/4 "2020-04-14T12:38:39Z")

</div>

Thanks for the quick reply and solution 🙂

---

<div class="post-metadata">

### Author: ![erhan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/erhan/32/1919_2.png) [@erhan](https://discuss.ocaml.org/u/erhan)
#### Post date: [June 23, 2020, 2:24pm UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/5 "2020-06-23T14:24:38Z")

</div>

@CraigFe irmin released new version including this bug fix?

---

<div class="post-metadata">

### Author: ![CraigFe](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/craigfe/32/1989_2.png) [@CraigFe](https://discuss.ocaml.org/u/CraigFe)
#### Post date: [June 25, 2020, 12:32pm UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/6 "2020-06-25T12:32:16Z")

</div>

Not yet. We have plans to cut a 2.2.0 release shortly that would include this bug fix 🙂 I’ll post again here once that happens.

---

<div class="post-metadata">

### Author: ![CraigFe](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/craigfe/32/1989_2.png) [@CraigFe](https://discuss.ocaml.org/u/CraigFe)
#### Post date: [June 29, 2020, 9:10am UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/7 "2020-06-29T09:10:32Z")

</div>

Now released as part of [https://github.com/ocaml/opam-repository/pull/16721](https://github.com/ocaml/opam-repository/pull/16721). Happy hacking!

---

<div class="post-metadata">

### Author: ![erhan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/erhan/32/1919_2.png) [@erhan](https://discuss.ocaml.org/u/erhan)
#### Post date: [June 30, 2020, 11:40am UTC](https://discuss.ocaml.org/t/irmin-graphql-keys-are-reversed/5509/8 "2020-06-30T11:40:42Z")

</div>

Thank you for the notification 🙂
