ChilliCream / ChilliCream/graphql-platform

Required errors collection for mutation conventions

Open
#8,452 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ hot chocolate Area: Type System
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Product

Hot Chocolate

Is your feature request related to a problem?

I'm not sure how to best report this, as it falls somewhere between a bug, a question, and a feature request. So, apologies if this is not the correct form.

Our project requires returning a non-nullable array of errors in each mutation response. We also need an IsSuccess flag. So something like this:

type CreateProductResult {
  errors: [BaseError!]!
  isSuccess: Boolean!
  product: Product
}

There is also a custom error type, but I believe this is already configurable.

So, looking at the docs, we can see that "conventions also allow you to create mutations that follow the error stage 6a Pattern Marc-Andre Giroux laid out". Following this link, we can see that the article proposes a non-nullable array of errors: userErrors: [CreateUserError!]! (this is where the "possibly a bug" is coming from).

It does not propose the use of IsSuccess, but I found that 'FieldResult' (formerly 'MutationResult'), which is, as I understand, a type tightly connected to mutation conventions, does have that field.

I considered reimplementing mutation conventions with that important '!' in mind, but found that the existing implementation is built on interceptors, which are not meant to be used by users. For that reason, I am not exactly sure how I could proceed here.

The solution you'd like

So, based on whether this is a bug, a reasonable feature request, or a question, it would be nice if you could:

  • Fix the bug making the errors required
  • Allow configuring the nullability of the errors array. It would be nice if it also had IsSuccess\IsError properties
  • Provide some helpful guidance on how this can be achieved. Since interceptors are 'forbidden', I'm not sure what I can do to override a returning type programmatically for all mutations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the mutation errors documentation linked in the issue and the existing mutation conventions built on interceptors. Clarify whether the goal is required error-array nullability, configurable nullability, IsSuccess/IsError fields, or usage guidance. Done should be a decided scope with documented behavior or an agreed implementation path.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, graphql
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.