ryannhg/graphql/2.0.0

NOTE: the latest version is 2.1.0

Renamed to ryan-haskell/graphql. It is published under that name, and new versions come out there.

Versions published as ryannhg/graphql still install under that name. 4 versions of 4 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/ryan-haskell/graphql.

What we checked: The repo moved to github.com/ryan-haskell/graphql. Rebuilt with git archive from commit c7b87f74a1c6 of https://github.com/ryan-haskell/graphql (zip prefix ryannhg-graphql-32f4d56/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 bf8f7cf9d464c043c51937e29fdee00d18573cc2.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/ryannhg/graphql/zipball/2.0.0/

GraphQL.Error

Your GraphQL API might return a validation response like this one:

{
  "errors": [
    {
      "message": "Cannot query field \"nam\" on type \"Droid\".",
      "locations": [
        {
          "line": 4,
          "column": 5
        }
      ]
    }
  ]
}

This module defines the GraphQL "error" type, to help parse any validation issues within your Elm application.

Error

type alias Error =
{ message : String
, locations : List Location
, path : List PathSegment
, extensions : Dict String Value
}

A validation error returned by your GraphQL API.

type alias Location =
{ line : Int
, column : Int
}

Represents a location in your query/mutation

= Index Int
| Field String

Helps identify which field might be causing problems

Partial errors

It's also possible for your GraphQL response to return partial errors, meaning that both the data fields and the errors field could come back in the same response.

If your application would like to access those partial errors, use either of these two functions:

Note: This will make your Msg result values more complicated:

-- 1️⃣ BEFORE

type Msg
    = ApiResponded (Result GraphQL.Http.Error Data)


-- 2️⃣ AFTER

type Msg
    = ApiResponded
        (Result GraphQL.Http.Error
            { data : Data
            , errors : List Error
            }
        )