fsprojects / FSharp.Data.GraphQL

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

GraphQL Client and Fable 2 #204

Open bilkusg opened 5 years ago

bilkusg commented 5 years ago

Description

I am using Fable 2 and trying to use the GraphQL client but keep getting errors with the type provider when I try to build the project. I suspect this is not working with Fable 2 yet. I get asked to add System.Private.CoreLib which as far as I can tell is an indication that there's an incompatibility somewhere. If it is possible to use the client with Fable 2, can someone point me to a working example I can use to find out what's wrong with my setup And if not, are there plans to support Fable 2 at some point?

Related information

johnberzy-bazinga commented 5 years ago

@bilkusg Sorry for the delay. We've decided to rewrite the GraphQL provider. The plan is to support Fable in the near future. You can preview the work in https://github.com/fsprojects/FSharp.Data.GraphQL/pull/179.

Any feedback is appreciated!

nojaf commented 5 years ago

Hi, should the latest beta work with Fable? I believe the source files are missing from the nuget package.

Is the TypeProvider an Erasure one?

johnberzy-bazinga commented 5 years ago

Hi @nojaf,

We haven't added support for Fable in the latest type provider redesign. @alfonsogarciacaro wrote the first Fable integration, so he knew what he was doing w.r.t. Fable. Do you know if the mechanism we were using in the old TP is still valid?

Thanks, John

njlr commented 4 years ago

What is the status of the type provider with Fable?

fradav commented 4 years ago

The status is : not working with Fable since 2.0. AFAIK, there is only one provider for current fable and it is JsonProvider from @alfonsogarciacaro The official doc still states that is working with fable client-side, perhaps update?

alfonsogarciacaro commented 4 years ago

Providers work with latest version of Fable but they cannot use the parts of the BCL that are not supported by Fable. You can find some providers compatible with Fable by typing "provider" here: https://fable.io/community/

Zaid-Ajaj commented 4 years ago

Recently I have a published a different solution for Fable called Snowflaqe. It is a dotnet CLI tool that code-generates a Fable (or F#) GraphQL client project based on the schema and input query files. The tool also performs validation and partial type-checking against the input queries.

njlr commented 4 years ago

Recently I have a published a different solution for Fable called Snowflaqe. It is a dotnet CLI tool that code-generates a Fable (or F#) GraphQL client project based on the schema and input query files. The tool also performs validation and partial type-checking against the input queries.

Interesting! Why code generation over a Type Provider?

fradav commented 4 years ago

Thanks @Zaid-Ajaj that's a very convenient solution, but ultimately someone will have to get its hands dirty and properly code the TP for fable 2.* ... I would like to do it, no guarantee.

Zaid-Ajaj commented 4 years ago

Interesting! Why code generation over a Type Provider?

@njlr Type providers are hard to write, hard to debug and have limitations in which types you can output where you can't generate records or unions. This is very important because AFAIK records are required for proper serialization and deserialization of JSON data given the limited Reflection support on classes for Fable.

but ultimately someone will have to get its hands dirty and properly code the TP for fable 2.* ... I would like to do it, no guarantee.

@fradav Please do! To be honest I personally wouldn't know how the runtime code should behave in Fable 2.0 with classes, let alone generate that via a type provider. For now it is good to have at least one working solution for Fable developers. I have been happily using it myself at work and we are quite enjoying it so far :smile: