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

Clarify "response key" vs "response name" #1144

Open
duckki opened this issue Mar 8, 2025 · 4 comments · May be fixed by #1147
Open

Clarify "response key" vs "response name" #1144

duckki opened this issue Mar 8, 2025 · 4 comments · May be fixed by #1147

Comments

@duckki
Copy link

duckki commented Mar 8, 2025

Both terms are used in the spec and it appears that they are the same thing.

  • Sec. 2.7 defines "response key" as
    • "By default a field’s response key in the response object will use that field’s name. However, you can define a different response key by specifying an alias."
  • Sec. 5.3.2 uses "response name" without a definition.
  • Sec. 6.3.2 uses "response key" with a definition in parentheses as
    • "the alias if defined, otherwise the field name."

Consistency would be appreciated. Or, if they are different, please add a definition for response name.

I see some implementations use "response name" and others use "response key". In the graphql-js codebase, only responseName is used.

@martinbonnin
Copy link
Contributor

+1. My personal preference goes to response name as it's what we use in Apollo Kotlin too.

@benjie benjie linked a pull request Mar 10, 2025 that will close this issue
@benjie
Copy link
Member

benjie commented Mar 10, 2025

Good spot @duckki! Since I already added a definition for "response key" in #1039, I've pulled that out into #1147 and then standardized our terminology around it.

@benjie
Copy link
Member

benjie commented Mar 10, 2025

Actually given GraphQL.js uses responseName we should just go with that. Editing #1147

@andimarek
Copy link
Contributor

I would argue for response key over response name. It is the clearer word for what aliases cause in the overall response: the key in the map of the result is changed. We already have field names and then response names is to close to each other imho.

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 a pull request may close this issue.

4 participants