Your GraphQL Dictionary

Tomek Poniatowicz - Feb 20 '19 - - Dev Community

GraphQL is a modern query language for APIs. During your first encounter with the GraphQL, you might notice some unfamiliar terms. I hope this GraphQL Dictionary will be somehow useful at the beginning of your journey with GraphQL :)

Argument

An argument is a set of key-value attached to a field. The Arguments can have a form of literal values or variables.

Alias

Alias is an alternative name assigned to the result of a field to avoid conflicts during data fetching operations i.e. admin and regular.

{
 admin: users(role: admin) {
   id
   firstname
   lastname
 }
 regular: users(role: regular) {
   id
   firstname
   lastname
 }
}
Enter fullscreen mode Exit fullscreen mode

Directive

An explanation preceded by a @ that encloses the logic for query execution on client/server. GraphQL built-in directives are @skip and @include, and allow to define custom ones.

Field

A basic unit of data you request from your schema returned as a field in JSON response i.e. idand name.

type User {
 id: Int!
 name: String
}
Enter fullscreen mode Exit fullscreen mode

Fragment

A selection set that can be reused in multiple query operations. A GraphQL fragment is a shared piece of query logic.

GraphQL Editor

GraphQL Editor makes understanding GraphQL schema a lot easier. Plan your schema by linking visual blocks and GraphQL Editor will transform them into code.

Introspection

A method to provide precise information about the schema of a GraphQL API. Introspections are prefixed by "__".

Mutation

One of basic GraphQL operations allowing to manipulate data (create, modify, delete).

mutation DeleteTodo($type: String!) {
 deleteTodo(type: $type) {
   id
   type
 }
}
Enter fullscreen mode Exit fullscreen mode

Object Type

It's type in a GraphQL schema that contains fields. User is our Object Type here:

type User {
  name: String!,
}
Enter fullscreen mode Exit fullscreen mode

Operation

The single query, mutation or subscription, which could be interpreted by execution engine in GraphQL.

Operation Name

A name for above-mentioned elements. Name make a lot easier identifying, logging or debugging errors in a GraphQL server.

Query

It's a basic fetch operation to request data in GraphQL.

Query Colocation

One of GraphQL best practices, where you place a GraphQL query in the same location as the app component’s view logic.

Query whitelisting

A security practice involving defining a list of approved queries that are allowed in your app.

Resolver

A function connecting your GraphQL schema elements to backends. Resolvers turn operations into data; they can return strings, ints, null & other primitives.

Schema

A GraphQL schema is the central piece of every GraphQL server implementation. The GraphQL schema is responsible for the whole logic of your project and describes functionalities available to the client app.

Schema Definition Language (SDL)

A GraphQL Schema Definition is a way to define a GraphQL schema. The syntax is a are part of the official GraphQL specification. The main components of each schema are the types and their fields.

The GraphQL schema for a movie review site could be defined like this:

type Review {
 id: String!
 title: String!
 publishedAt: DateTime!
 stars: Int! @default(value: 0)
 feed: Feed @relation(name: "Reviews")
}

type Feed {
 id: String!
 name: String!
 description: String,
 reviews: [Review!]! @relation(name: "Review")
}
Enter fullscreen mode Exit fullscreen mode

Schema Stitching

Merging minor schemas into central GraphQL schema.

Subscription

Is a real-time operation in GraphQL that is defined in a schema.

type Subscription {
 reviewAdded(repoFullName: String!): Review
}
...
subscription onReviewAdded($repoFullName: String!){
 reviewAdded(repoFullName: $repoFullName){
   id
   content
 }
}
Enter fullscreen mode Exit fullscreen mode

Scalar Type

It's GraphQL type that validates the data that GraphQL field resolves. String, Int, Boolean, Float are all built-in scalars that you can do a lot with out of the box. Custom scalar types can be specified in GraphQL service implementation.

Type System

It's a set of rules that define the set of data that can be validated, queried & executed.

Variable

It's a value that can be passed to an operation, like userID in below example:

query GetUser($userId: ID!){
 user(id: $userId){
   name
 }
}
Enter fullscreen mode Exit fullscreen mode

PS:

The original article was posted on GraphQL Editor Blog - https://blog.graphqleditor.com/GraphQL-tutorial-dictionary/

Here is the link to GraphQL Editor app in case you want to try it out -
https://app.graphqleditor.com/showcase/fake-twitter/

If you're looking for best GraphQL tutorials check this post.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player