fsprojects / FSharp.Data.GraphQL

FSharp implementation of Facebook GraphQL query language.
http://fsprojects.github.io/FSharp.Data.GraphQL/
MIT License
395 stars 72 forks source link

Define mapping from custom scalar types to domain types on a client side #281

Open xperiandri opened 4 years ago

xperiandri commented 4 years ago

Description

It would be extremely nice to be able to define a list of mapping between custom scalar types and real domain types. Like when you define coercion functions on server side. Otherwise now it is not convenient to use primitive types and you need to convert your operation response type to a domain type that requires you to either fill existing domain types or create new.

Expected behavior

When you define a provider you can pass a list of mappings with coercion functions the same as you use for custom scalar types on a server-side.

Actual behavior

Primitive types are used

Known workarounds

Write boilerplate code to transform them

Related information

johnberzy-bazinga commented 4 years ago

@xperiandri As mentioned on gitter, there is really no good solution for this until the Type Provider mechanism supports more options for extensibility i.e. language suggestion FS-1023.

njlr commented 3 months ago

Related question over on Snowflaqe https://github.com/Zaid-Ajaj/Snowflaqe/issues/24