Prev Next

API / GraphQL Interview Questions

Explain GraphQL Schema.

A schema is like a contract between the server and the client. It defines what a GraphQL API can and can't do, and how clients can request or change data. It's an abstraction layer that provides flexibility to consumers while hiding backend implementation details.

A GraphQL Schema Definition Language (SDL) is the most concise way to specify a GraphQL schema. A schema is a collection of object types that contain fields. Each field has a type of its own. A field's type can be scalar (such as an Int or a String), or it can be another object type. For example, the Book object type will have an author field of type Author.

type Book{
  id: Int
  authors: [Author]
  isbn: String!
}

 "Author of book(s)"
  type Author {
    id: ID!
    "Author's first and last name"
    name: String!
    "Author's profile picture url"
    photo: String
  }

More Related questions...

Show more question and Answers...


Comments & Discussions