What is GraphQL schema?

Technology CommunityCategory: GraphQLWhat is GraphQL schema?
VietMX Staff asked 5 months ago

Every GraphQL server has two core parts that determine how it works: a schema and resolve functions.

The schema is a model of the data that can be fetched through the GraphQL server. It defines what queries clients are allowed to make, what types of data can be fetched from the server, and what the relationships between these types are.


type Author {
  id: Int
  name: String
  posts: [Post]
type Post {
  id: Int
  title: String
  text: String
  author: Author
type Query {
  getAuthor(id: Int): Author
  getPostsByTitle(titleContains: String): [Post]
schema {
  query: Query