Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First use experience report #296

Open
fkowal opened this issue Feb 8, 2020 · 0 comments
Open

First use experience report #296

fkowal opened this issue Feb 8, 2020 · 0 comments

Comments

@fkowal
Copy link

fkowal commented Feb 8, 2020

@dillonkearns I'd like to start with thanking you for the great library.

Today for the first time I tried using elm-graphql.
I admit this a great library and it helped a lot.

I am trying to get my company to start using Elm.
Part of that is educating others and introducing them to Elm.

So I am writing this down to lower the entry barrier.

  1. My expectations

I am starting to build a new App, and prepared a query using graphiQL ie. {offers(order_by:{...}) { id name stock {quantity ...}}.

Then I turned to elm-graphql to generate the code. I expected the result would look something like:

module Api.Request exposing (fetchOffers,Data,Offers)

type alias Data = { offers: List Offers, errors: ... }
type alias Offers = {
   id: String
   , name: String 
   , stock: List Stock
   ...
}

fetchOffers baseUrl (Result Error Data -> Msg) = -- generated implementation using SelectionSets and all the details if i decided to write the query by hand

Since the generator didn't ask for a query I knew this would have to be done by hand.
And something that took a few minutes in graphiQL turned into a few hours teaching myself how to write a the same query using the generated code.

Feedback at this point is that:

  • code generation was super simple
  • writing the queries using "dsl" was challenging, it required quite a bit of Elm knowledge, and I don't see how someone new to the language would manage
  • code generation stopped one step away from the same great experience graphiQL provides
  1. Amount of generated code
    I am using hasura as the graph server.

After the code was generated It took me a while to explore the generated code to understand how it was structured and how to use it.

At this point, I was overwhelmed because the schema is very rich with plenty of options.
Going back to my use-case where I only needed a small subset of what was actually available.

Feedback:
I understand that this is required in the scenario where the user writes the code by hand
using the generated types.
The cognitive load at this step is high. I can't help it feel that this goes against the idea of graphQL.

  1. Order_by
    The model/schema I am using is big 10-20 field.
    As a result Table_order_by type contains 20 OptionalArgument Api.Enum.XX_by.Order_by

The normal use-case is probably order_by: { col1: asc, col2: desc} with 1-2 columns.
I wasn't able to find a default with all columns set to Absent that would allow {default | col1: desc}
And writing this by hand was ... not the best experience.

Overall I feel this library is great.
But I don't feel that I can use it as part of a workshop targeted at people new to Elm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants