Skip to content

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

Open
@dperiwal

Description

@dperiwal

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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions