miragejs / graphql

A library for handling GraphQL requests with Mirage JS
MIT License
74 stars 12 forks source link

Handle Custom scalar type like Date #49

Open tapanShowbie opened 2 years ago

tapanShowbie commented 2 years ago

Hi I have a graphql schema, where I have a custom scalar type defined. How do we handle serialization and deserialization of custom scalar type.

jneurock commented 2 years ago

Hi. Can you explain a bit more about what kind of issues you're facing? In some cases, you don't have to do anything other than seed Mirage's database with records having values for fields of your custom scalar type that contain data you want.

If you want to go further, Mirage provides a way to customize serialization. See Mirage Serializer docs. An alternative would be to lean on custom resolvers to do the work but that might not be a great solution if the custom scalar types are commonly used.