Search code examples
graphqlapolloreason

How to rename variables (bs.as style) when using reason-apollo?


I'm running a reason-apollo query on a schema that uses the variable end, which is reserved in ReasonML. I've set up the type like so:

type endContainer {
  [bs.as "end"]
  end_
};

But not sure what to put in my graphql query:

endContainer @bsRecord {
  end_ // Doesn't work ("unknown field")
  end  // Doesn't work either ("the record field end cannot be found")
}

Is the bs.as modifier perhaps only usable in JS interop but not picked up by apollo?


Solution

  • You have to use an alias for end:

    endContainer @bsRecord {
      end_: end
    }