graphql / graphql/graphql.github.io

Feedback for “Schemas and Types”; Why is a "Query" considered a "type"?

Ouverte
#1,825 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
889
Forks
1.5k
Merge moyen
4 j 12 h
PR mergées (30 j)
21

Description

It is more of a fundamental question in terms of naming some artifacts of a GraphQl system.

Why is a "Query" considered a "type"? It is hard for me to conceptualize the following two declarations in the same specification because their essential nature and semantics are different:

type Character {
name: String!
appearsIn: [Episode!]!
}

type Query {
droid(id: ID!): Droid
}

Character describes the type (composition) of a data object whereas Query is an operation. Conceptually, Query, Mutation, and Subscription are "operations" - not "types".

Why are we overloading the term "type" to specify the "composition of a data object" as well as an "operation"?

Saying the following may be more appropriate if we have to use the term "type":

objectType Character {
name: String!
appearsIn: [Episode!]!
}

operationType Query {
droid(id: ID!): Droid
}

Maybe you can explain it in a way that avoids this conceptual confusion between the "composition of a data object" and an "operation" indicated by the same term "type".

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par consulter la documentation « Schemas and Types » ainsi que les sections de la spécification GraphQL consacrées à Query, Mutation, Subscription et object types. Le travail est terminé lorsqu’une explication claire de la raison pour laquelle ces concepts partagent le terme « type » est fournie, ou lorsqu’une modification précise de la documentation qui dissipe la confusion est décidée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Domaine
documentation
Type d'issue
Documentation
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.