Anyone using graphql-ppx and rescript-apollo-client with 11?

These two repos seem largely dead, and im getting a lot of warnings off the bat so I am worried.
Huge gap here.

A

1 Like

You mean to say rescript-apollo-client, right? As the maintainer, I can say that sadly you are correct for that repo. I’m happy to help merge/review PRs or to help hand over to another maintainer going forward, but I haven’t used Apollo for quite some time. Now would be a great time to hand off if there’s interest from anyone! While it’s pretty large, there’s nothing all that fancy about the bindings—a lot of which could be even simpler with 11.

I’m currently using both, albeit with v10. There’s several larger breaking changes that could be made with rescript-apollo-client to update the bindings, including the newer v11 features, (not to mention the progress made with @apollo/client itself) but I have not had much time to do a lot of work on them.

I’d hope both would be usable with uncurried mode off, but haven’t checked.

graphql-ppx might prove more challenging to make compatible with uncurried without forking since it’s also aimed to be compatible with reasonml / ocaml. An option might be to see if @zth 's GitHub - zth/rescript-embed-lang: A general purpose PPX and library for embedding other languages into ReScript, via code generation. could be used with some kind of code generation, but that’s relatively new stuff and I don’t know of any implementations that zth hasn’t done yet.

1 Like

We at walnut are going to migrate to ReScript 11 as well, and are maintaining graphql-ppx bear with us while we ship an update. But it’s in progress :slight_smile:

10 Likes

Hi Jaap
Have you been able to make any progress here? I am trying again (11, uncurried: false) and hitting " The module or file GraphQL_PPX can’t be found."

I thought i saw something around here suggesting that one of these packages is still expecting bsconfig.json too? Is it valid to keep both?

Thanks!
Alex

3 Likes

We are still migrating to 11 without uncurried first (almost there). We were able to compile it though, so with uncurried it shouldn’t be a problem. Did you add graphql-ppx as a dependency as well (it has a small runtime module) - this is not different between the versions.

Hi jfrolich.

Is team walnut still committed to a rescript release of graphql-ppx that supports uncurried?

We have been unable to use certain community libraries that are now using Core and uncurried.

I have a PR for graphql_ppx that fixes support for rescript-apollo-client + uncurried here Fix Uncurried Fragment module signature by illusionalsagacity · Pull Request #297 · teamwalnut/graphql-ppx · GitHub

there’s some config for graphql_ppx that’s needed too: Explicitly uncurry rescript-apollo-client by zatchheems · Pull Request #159 · jeddeloh/rescript-apollo-client · GitHub

@jfrolich has Team Walnut moved away from GraphQL? I keep checking the graphql_ppx repo for any movement including open PRs.

We’re still stuck on Rescript 10. Or any suggestions to an alternate solution that’s not Relay?

Thanks

I have my PR I mentioned above published to @illusionalsagacity/graphql-ppx@2.0.0-f885fc66.0 if you want a bridge to get to 11. We have been using this build without any issues since publication. If you run into version conflicts you can use the package.json overrides or yarn resolutions to fix that.

I have rescript 12 support in progress here and have it published under the rescript12 tag. I have not finished testing this yet, so while it seems to compile fine I’m not sure I would use it in prod just yet.

2 Likes

Thank you so much for your contribution, this is life saving.
My large codebase wasn’t ready to do the switch to Relay.

1 Like

If I understand it will, the record builders are not exposed anymore?

Before:

  client.query(
    Query.makeVariables(
      ~id,
      ~filterBy=Query.makeInputObjectInputQueryFilter(
        ~shopIds=Query.makeInputObjectInFilter(~_in=[shopId], ()),
        (),
      ),
      ~query=module(Query),
      (),
    ),
  )

Now:

  client.query(
    {
      id,
      filterBy: Some({
        shopIds: Some({_in: [shopId]}),
        archived: None,
        active: None,
      }),
    },
    ~query=module(MyQuery),
  )

I don’t believe I removed those, I don’t think I had used that feature before actually.

It may have regressed from the changes here: ReScript 12 support by illusionalsagacity · Pull Request #1 · illusionalsagacity/graphql-ppx · GitHub which if I recall correctly remove the trailing unit argument if it isn’t required.

It would help a bit if you could open an issue with an example of your graphql operation and the compiler error you’re getting, it looks like there’s test cases that show the makeVariables generation:

2 Likes

Hi, I could reproduce the issue in a separated repo (with other subsequent issues). I couldn’t make an issue in your repo, is it disabled?
So I’ve made it in my reprod repo if you want to have it a look: Generated variables helpers aren't working · Issue #1 · lucas-teks/illusionalsagacity-graphql-ppx-test · GitHub

1 Like