Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a graphql-js compatible-ish error serialization for Apollo Router #853

Merged
merged 3 commits into from
Apr 12, 2024

Conversation

goto-bus-stop
Copy link
Member

With some additions to the error structures to pass through the data required.

This PR adds a .unstable_to_json_compat() function to diagnostics that returns best-effort error messages in the graphql-js format. Some things like "Did you mean?" are omitted intentionally. There are minor differences in a handful of other messages, but much fewer than before, and hopefully it'll be obvious to users that the meaning is the same. One example difference is the UnsupportedValueType message, which in graphql-js is a customisable type-specific validation, but in apollo-rs is a fixed check based only on what the spec knows about builtin scalars, so the error is a bit less specific.

The new API is only meant for use in the Apollo Router, temporarily, exempt from semver, and any other users will not be supported.

Copy link
Member

@lrlna lrlna left a comment

Choose a reason for hiding this comment

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

thank you for doing this one!

@goto-bus-stop goto-bus-stop merged commit 0c081fe into main Apr 12, 2024
12 checks passed
@goto-bus-stop goto-bus-stop deleted the renee/js-error-message branch April 12, 2024 09:51
@goto-bus-stop goto-bus-stop mentioned this pull request Apr 12, 2024
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.

2 participants