Skip to content

Conversation

@willfindlay
Copy link
Contributor

Although not strictly to spec, some upstream graphql implementations such as the start.gg
API encode their ID types as integers rather than strings. Prior to this commit,
deserialization would fail in such cases, since graphql_client simply type aliases the ID
type to a String. This commit introduces a simple deserialization helper that enables us
to handle both integers and strings while maintaining backward compatbility for downstream
users.

Fixes: #455

Although not strictly to spec, some upstream graphql implementations such as the start.gg
API encode their ID types as integers rather than strings. Prior to this commit,
deserialization would fail in such cases, since graphql_client simply type aliases the ID
type to a String. This commit introduces a simple deserialization helper that enables us
to handle both integers and strings while maintaining backward compatbility for downstream
users.

Fixes: graphql-rust#455

Signed-off-by: William Findlay <[email protected]>
@tomhoule
Copy link
Member

Hi @willfindlay , thanks for the PR! I am going to return to a bit more active maintainership of this crate. If I understand the implementation correctly, that would be a breaking API change for existing users, right? Could we make the transformation optional?

@tomhoule
Copy link
Member

Ah wait, it will still be a String in the generated code, so it's not breaking. I think we could merge this.

@tomhoule tomhoule merged commit 88f2875 into graphql-rust:main Jan 31, 2025
@tomhoule tomhoule mentioned this pull request Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deserializing ID as integer not String

2 participants