graphql-go icon indicating copy to clipboard operation
graphql-go copied to clipboard

Add an example of using graphql.ID

Open pavelnikolov opened this issue 3 years ago • 2 comments

Add an example of using graphql.ID. More specifically creating one from an integer and extracting an int value out of it. All examples must be placed in the /examples/ folder in the root of this project.

pavelnikolov avatar Jan 06 '22 11:01 pavelnikolov

👋 Hello!

Do you mind if take this issue? Thanks!

ConnieJChi avatar Jul 25 '22 17:07 ConnieJChi

A quick question on the ask for this issue. Looking at the GraphQL spec, it mentions that IDs should always be serialized to a string (http://spec.graphql.org/October2016/#sec-ID). In that case, should we provide examples of how to convert a GraphQL ID to an Integer if the specs recommend converting it to a String? I'd love to get more clarification on this. Thanks!

ConnieJChi avatar Jul 25 '22 18:07 ConnieJChi

@ConnieJChi Feel free to add an executable example in example_test.go file in the relay package. Make sure that you use the MarshalID, UnmarshalKind and UnmarshalSpec in your executable examples.

pavelnikolov avatar Feb 07 '23 13:02 pavelnikolov