Skip to content

How to customise mutation validation error messages #548

@sultaniman

Description

@sultaniman

Hi,

I've been trying to customise mutation validation errors but so far didn't succeed in doing so, having the following query I would like to be able to return errors if different shape

mutation CreateProject($projectName: String!, $description: String!) {
  createProject(projectName: $projectName, description: $description) {
    id
    projectName
    description
  }
}

Standard errors look like

{
  "errors": [
    {
      "message": "Variable \"$description\" of required type \"String!\" was not provided.",
      "locations": [
        {
          "line": 1,
          "column": 47
        }
      ]
    }
  ]
}

What I would like to have is

{
  "errors": [
    {
        "$description": "Error message...",
        "locations": [...]
    }
}

So is it possible to adjust error response format?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions