dyerw / purescript-fernet

A typesafe GraphQL client for Purescript (WIP)
7 stars 0 forks source link

List of missing features #1

Open srghma opened 4 years ago

srghma commented 4 years ago

I will list here what I found is missing:

  1. Support for fragments

IIUC elm-graphql doesnt stringify FragmentSelectionSet to fragment XXX { ... }, but converts their content to SelectionSet

(though it could be an optimization to reduce size of query if fragment is used in several places. i.e. collect all fragments, give them unique name based on hash of content and paste at the top of the query)

  1. subscriptions

  2. generate types from:

    • request introspection json from url - seems like done
    • introspection.json from path - not done, postgraphile exports it using exportJsonSchemaPath option
    • convert schema file to introspection.json - not done, postgraphile exports it using exportGqlSchemaPath option

(they use graphql npm package for this)

https://github.com/dillonkearns/elm-graphql/blob/29727cf286f043ec87e942edbcd6a49aa3d5e409/generator/src/elm-graphql.ts#L65

https://github.com/dillonkearns/elm-graphql/blob/29727cf286f043ec87e942edbcd6a49aa3d5e409/generator/src/cli/generated-code-handler.ts#L46

  1. storing RProxy is not necessary I think

https://github.com/dyerw/purescript-fernet/blob/7f747d726cee420e34419d317f9f810fd5ffcd2e/src/graphql/SelectionSet.purs#L25

  1. what is recursive queries? I dont understand :-)

https://github.com/dyerw/purescript-fernet/blob/7f747d726cee420e34419d317f9f810fd5ffcd2e/src/graphql/SelectionSet.purs#L38-L61

User contains tweet, tweet contains user?


What else is missing?

srghma commented 4 years ago
  1. the countries were incorrectly generated

https://github.com/dyerw/purescript-fernet/blob/7f747d726cee420e34419d317f9f810fd5ffcd2e/src/examples/countries/Continent.purs#L14

Screenshot_20200424-210041_Chrome


instead, it should have returned something like

https://github.com/dillonkearns/elm-graphql/blob/ec14a896b1809d6f9fa502d063ed8bf4a21f3cfa/examples/src/Swapi/Query.elm#L67-L77

https://github.com/dillonkearns/elm-graphql/blob/ec14a896b1809d6f9fa502d063ed8bf4a21f3cfa/examples/src/Example05InterfacesAndUnions.elm#L32


https://github.com/srghma/purescript-learning-notes/tree/master/elm-generate-countries-trevorblades/Api

srghma commented 4 years ago
  1. arguments also support arrays and objects

https://github.com/dyerw/purescript-fernet/blob/7f747d726cee420e34419d317f9f810fd5ffcd2e/src/graphql/SelectionSet.purs#L11-L14

https://github.com/dillonkearns/elm-graphql/blob/ec14a896b1809d6f9fa502d063ed8bf4a21f3cfa/src/Graphql/Internal/Encode.elm#L25-L29

srghma commented 4 years ago
  1. file upload
srghma commented 4 years ago
  1. Check what happens if field is requested several times
# merges
query { avatar avatar }
# error, but should be possible
query {
  countries { code }
  countries(filter: { code: {eq: "AU"}}) { code }
  }

https://github.com/dillonkearns/elm-graphql/blob/ec14a896b1809d6f9fa502d063ed8bf4a21f3cfa/src/Graphql/Document/Field.elm#L25

(But there is no need to calculate hash for leaf without arguments. And they calculate same hash two times in two different places: build function and for decoder)

(Store decoders in SelectionSet? This would also allow for fields with custom decoders)

  1. Required and optional arguments can be implemented using Unions like in react-basic
button ::
  ∀ optionalGiven optionalMissing
  .  Prim.Row.Union optionalGiven optionalMissing (ButtonPropsOptions + MUI.Core.ButtonBase.ButtonBasePropsOptions + React.Basic.DOM.Props_button)
  => Record (MUI.Core.ButtonBase.ButtonBasePropsRequiredOptions + optionalGiven)
  -> React.Basic.JSX
button = React.Basic.element _Button
srghma commented 4 years ago
  1. Ability to make test requests that return expected string

    HTTP.request and Test.request, HTTP.subscribe and Test.subscribe

srghma commented 4 years ago
  1. test circular and recursive inputs against

http://elm-graphql-normalize.herokuapp.com/

https://github.com/dillonkearns/elm-graphql/blob/master/ete_tests

schema graphql get-schema --endpoint http://elm-graphql-normalize.herokuapp.com/ --output schema.graphql

introspection graphql get-schema --endpoint http://elm-graphql-normalize.herokuapp.com/ --output schema.json

srghma commented 4 years ago

the fork is here https://github.com/purescript-graphql-client/purescript-graphql-client

dyerw commented 4 years ago

Wow! I haven't taken a look at this in a while (life has a way of interrupting fun side-projects) but I'm extremely flattered you took enough interest to fork it and pick up the torch. When I wrote this I was still learning a lot about PS and particularly type-level programming so I'm very keen to dig into what you've done and your take on things.

dyerw commented 4 years ago

I will update the readme to point to the fork.

srghma commented 4 years ago

my take is very much similar to elm-graphql) tnx)