Object Types
It is the basic and most used Type in GraphQL. It represents a group of fields in which each field has a specific name and a value corresponding to it i.e. These Object Types are that we can fetch from our service and also the values-fields that it contains. It includes Scalar Types and other Types.
Syntax:
type Object_name
{
field_name1: data_type
field_name2: data_type
....
....
field_nameN: data_type
}
Example:
type Student {
id: ID!
name: String!
hobbies: [Hobby!]!
}
type Hobby {
id: ID!
title: String!
}
Types in GraphQL
GraphQL is a strongly typed query language used as a manipulative language for various APIs. It is also called a query language for APIs. GraphQL also helps to describe our data. GraphQL services can run in any language In this, Types are the fundamental concepts that define various data types present in GraphQL and It is also used to define the schema using different data types. There are multiple types in GraphQL.
Contact Us