Skip to content

move the nullifying error messages to extensions#2077

Merged
Geal merged 6 commits intodevfrom
geal/move-nullability-messages-to-extensions
Nov 15, 2022
Merged

move the nullifying error messages to extensions#2077
Geal merged 6 commits intodevfrom
geal/move-nullability-messages-to-extensions

Conversation

@Geal
Copy link
Contributor

@Geal Geal commented Nov 9, 2022

Fix #2071

Adding them in the list of errors was potentially redundant (subgraph can already add an error message indicating why a field is null) and could be treated as a failure by clients, while nullifying fields is a part of normal operation. We still add the messages in extensions so clients can easily debug why parts of the response were removed

Adding them in the list of errors was potentially redundant (subgraph
can already add an error message indicating why a field is null) and
could be treated as a failure by clients, while nullifying fields is a
part of normal operation. We still add the messages in extensions so
clients can easily debug why parts of the response were removed
@github-actions

This comment has been minimized.

@Geal
Copy link
Contributor Author

Geal commented Nov 9, 2022

now accepting naming suggestions for the new extensions field. I put "formatting", but maybe that could be "nullability"? WDYT?

@Geal Geal requested review from BrynCooke and abernix November 9, 2022 14:31
@bnjjj
Copy link
Contributor

bnjjj commented Nov 9, 2022

I prefer nullability over formatting because it explains what's the name of the rules. And if you search for nullability in the specs you have some better results.

Copy link
Contributor

@garypen garypen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few questions/comments about the general design. The code looks good.

response.errors.extend(parameters.errors.into_iter());
if !parameters.errors.is_empty() {
response.extensions.insert(
"formatting",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "formatting" the correct name? Would "composition" be a better choice or "assembly". Is there an established convention for this kind of naming?
UPDATE: I just saw the other comments about naming. I don't think "nullability" is a good name, but could be convinced.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly value-completion? As this is the part of the spec that handles nullability https://spec.graphql.org/June2018/#sec-Value-Completion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that works for me


let request = supergraph::Request::fake_builder()
.query("query { currentUser { activeOrganization { id creatorUser { name } } } }")
// Request building here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably remove this comment.

@Geal Geal enabled auto-merge (squash) November 15, 2022 09:43
@Geal Geal merged commit 000fef9 into dev Nov 15, 2022
@Geal Geal deleted the geal/move-nullability-messages-to-extensions branch November 15, 2022 11:30
abernix added a commit that referenced this pull request Nov 15, 2022
This follows up on a consistency change that makes the extensions that we
return from Apollo Router consistently camelCase.

Original Issue: #2071
Original PR: #2077
@abernix abernix mentioned this pull request Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move the "Cannot return null for non-nullable field" error to extensions

6 participants