The relay pagination spec says:
An “Edge Type” must contain a field called cursor. This field must return a type that serializes as a String; this may be a String, a Non-Null wrapper around a String, a custom scalar that serializes as a String, or a Non-Null wrapper around a custom scalar that serializes as a String.
Whatever type this field returns will be referred to as the cursor type in the rest of this spec.
ElasticGraph provides a Cursor type for use here. However, the spec allows other types to be used for the cursor. In an organization that used a custom scalar cursor type that was called something else, you can use type_name_overrides in your Rakefile to solve this:
tasks.type_name_overrides = {
Cursor: "RelayCursor"
}
It's also valid for the cursor type to be String. But this doesn't work:
tasks.type_name_overrides = {
Cursor: "String"
}
There are two problems here:
- This causes ElasticGraph to generate
scalar String in the GraphQL schema...which conflicts with the existing definition of String.
- ElasticGraph has a scalar coercion adapter for Cursor which should not apply to
String. (That is, it's logic is still needed for cursor values passed as a String, but not for other String values).
We'll need to find a solution for both of these. Maybe the cursor logic can be moved out of the scalar coercion adapter and applied to individual cursor values rather than to the Cursor type?
The relay pagination spec says:
ElasticGraph provides a
Cursortype for use here. However, the spec allows other types to be used for the cursor. In an organization that used a custom scalar cursor type that was called something else, you can usetype_name_overridesin yourRakefileto solve this:It's also valid for the cursor type to be
String. But this doesn't work:There are two problems here:
scalar Stringin the GraphQL schema...which conflicts with the existing definition ofString.String. (That is, it's logic is still needed for cursor values passed as aString, but not for otherStringvalues).We'll need to find a solution for both of these. Maybe the cursor logic can be moved out of the scalar coercion adapter and applied to individual cursor values rather than to the
Cursortype?