jamesmacaulay / elm-graphql

A GraphQL library for Elm
http://package.elm-lang.org/packages/jamesmacaulay/elm-graphql/latest
BSD 3-Clause "New" or "Revised" License
313 stars 19 forks source link

Variable duplicates #15

Closed ssbb closed 7 years ago

ssbb commented 7 years ago

Looks like it's not possible to use variable more than one time. Maybe we should dedup variables in query arguments?

Example:

photoSizeVar =
        Var.required "photoSize" .photoSize Var.int

used as

            |> with
                (field "cover"
                    [ ( "width", Arg.variable photoSizeVar )
                    , ( "height", Arg.variable photoSizeVar )
                    ]
                    string
                )

Will produce query like this:

query ($photoSize: Int!, $photoSize: Int!) { ... }
jamesmacaulay commented 7 years ago

Thanks for the report! I'll take care of this for the next patch release.