Skip to content

A GraphQL response does not require the data field #17

@ad-si

Description

@ad-si

, expect = Http.expectJson msg (Decode.field "data" decoder)

This is an incorrect assumption. You can get a valid response with just an errors field.

According to https://spec.graphql.org/draft/#sec-Response-Format GraphQL requests should produce something like this:

type alias GQLError = 
  { message : String
  , path : List String
  , locations : …
  , extensions : …
  }
 
  
type alias GQLResponse = 
  { errors: Maybe (List GQLError)
  , data: Maybe Value
  , extensions: Maybe Value
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions