graphql-rust / graphql-client

Typed, correct GraphQL requests and responses in Rust
Apache License 2.0
1.12k stars 152 forks source link

codegen: enable ids to be deserialized from strings or integers #476

Open willfindlay opened 3 months ago

willfindlay commented 3 months ago

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: https://github.com/graphql-rust/graphql-client/issues/455