Adding content to 104-schema

content/graphql
syedmouaazfarrukh 2 years ago
parent f5fcf1dccc
commit f16bd09a47
  1. 15
      src/roadmaps/graphql/content/104-schema/100-type-system.md
  2. 9
      src/roadmaps/graphql/content/104-schema/101-fields.md
  3. 19
      src/roadmaps/graphql/content/104-schema/102-scalars.md
  4. 10
      src/roadmaps/graphql/content/104-schema/103-enums.md
  5. 7
      src/roadmaps/graphql/content/104-schema/104-objects.md
  6. 8
      src/roadmaps/graphql/content/104-schema/105-lists.md
  7. 9
      src/roadmaps/graphql/content/104-schema/106-interfaces.md
  8. 9
      src/roadmaps/graphql/content/104-schema/107-unions.md
  9. 7
      src/roadmaps/graphql/content/104-schema/108-arguments.md
  10. 9
      src/roadmaps/graphql/content/104-schema/index.md

@ -1 +1,14 @@
# Type system
# Type System
GraphQL is a strongly typed language. Type System defines various data types that can be used in a GraphQL application. The type system helps to define the schema, which is a contract between client and server. The commonly used GraphQL data types are as follows:
- Scalar
- Object
- Query
- Mutation
- Enum
Learn more from the following links:
- [Get started with Type system](https://graphql.org/learn/schema/#type-system)
- [GraphQL - Type System](https://www.tutorialspoint.com/graphql/graphql_type_system.htm)

@ -1 +1,10 @@
# Fields
In GraphQL, a field is a unit of data that can be queried or manipulated in a request. Each field has a name, a type, and an optional description. Fields are defined within an object type in a GraphQL schema.
Each field in a GraphQL schema can return a scalar value (such as a string or an integer) or another object, allowing for the creation of complex, nested data structures. The fields can also take arguments, which allows to filter or modify the data being returned.
Learn more from the following links:
- [GraphQL Tutorial: How to use fields?](https://www.educative.io/blog/graphql-tutorial)
- [GraphQL: Types and Fields](https://typegraphql.com/docs/types-and-fields.html)

@ -1 +1,20 @@
# Scalars
Scalars are “leaf” values in GraphQL. There are several built-in scalars, and you can define custom scalars, too. (Enums are also leaf values.) The built-in scalars are:
- **String**, like a JSON or Ruby string
- **Int**, like a JSON or Ruby integer
- **Float**, like a JSON or Ruby floating point decimal
- **Boolean**, like a JSON or Ruby boolean (true or false)
- **ID**, which a specialized String for representing unique object identifiers
- **ISO8601DateTime**, an ISO 8601-encoded datetime
- **ISO8601Date**, an ISO 8601-encoded date
- **JSON**, This returns arbitrary JSON (Ruby hashes, arrays, strings, integers, floats, booleans and nils). Take care: by using this type, you completely lose all GraphQL type safety. Consider building object types for your data instead.
- **BigInt**, a numeric value which may exceed the size of a 32-bit integer
Learn more from the following links:
- [Get started with Scalars in GraphQL](https://graphql.org/learn/schema/#scalar-types)
- [Custom GraphQL Scalars](https://www.howtographql.com/typescript-apollo/7-voting-and-scalars/)
- [Overview of GraphQL Scalars 1.0](https://medium.com/the-guild/graphql-scalars-1-0-is-out-more-types-data-integrity-and-strict-validations-on-graphql-972079428fb)
- [Scalars in GraphQL](https://graphql-ruby.org/type_definitions/scalars)

@ -1 +1,11 @@
# Enums
Enums also called as enumeration types are a special kind of scalar that is restricted to a particular set of allowed values. This allows you to:
- Validate that any arguments of this type are one of the allowed values
- Communicate through the type system that a field will always be one of a finite set of values
Learn more from the following links:
- [What are Enums?](https://graphql.org/learn/schema/#enumeration-types)
- [Get started with Enums](https://graphql-ruby.org/type_definitions/enums)

@ -1 +1,8 @@
# Objects
In GraphQL, an object is a type that represents a group of fields. Objects can be used to define the structure of a query or a mutation. Each field of an object can return a scalar value (such as a string or an integer) or another object, allowing for the creation of complex, nested data structures. In a GraphQL schema, objects are defined using the **type** keyword, followed by the object's name and a set of fields in curly braces.
To learn more, visit the following:
- [Object Types and Fields](https://graphql.org/learn/schema/#object-types-and-fields)
- [Object Types](https://graphql.org/graphql-js/object-types/)

@ -1 +1,9 @@
# Lists
In GraphQL, a list is a type that represents an ordered collection of items. Lists are defined using square brackets, with the type of the items inside.
Lists are used to represent an array of items in a GraphQL schema, and can be used as the return type for a field in an object type. Lists can contain any type of items, including scalars and other objects, and can also be nested within other lists.
Learn more from the following links:
- [Get started with Lists](https://graphql.org/learn/schema/#lists-and-non-null)

@ -1 +1,10 @@
# Interfaces
In GraphQL, an interface is a type that defines a set of fields that a type must implement. Interfaces are defined using the interface keyword, and can be used to define common fields for multiple types.
In GraphQL, lists can also be used within interfaces to define the return type for fields.
Learn more from the following links:
- [Get started with Interfaces](https://graphql.org/learn/schema/#interfaces)
- [Interfaces in GraphQL](https://graphql-ruby.org/type_definitions/interfaces)

@ -1 +1,10 @@
# Unions
Unions are useful in cases where a field can return multiple types and you want to handle those types differently in your client. They also allow for more flexibility in how you structure your schema, as you can group types together that share common fields.
Unions don't allow to specify a common set of fields to be queried across multiple types, but it allows to handle multiple types differently in your client.
Learn more from the following links:
- [Get started with Union in GraphQL](https://graphql.org/learn/schema/#union-types)
- [Unions in GraphQL](https://www.apollographql.com/docs/apollo-server/schema/unions-interfaces/)

@ -1 +1,8 @@
# Arguments
In GraphQL, an argument is a value that is passed to a field in a query or mutation. Arguments allow you to filter or modify the data being returned by a field. Arguments are defined within a field in a GraphQL schema, and have a name, a type, and an optional default value.
To learn more, visit the following links:
- [Get started with Arguments in GraphQL](https://graphql.org/learn/schema/#arguments)
- [Tutorial - Arguments in GraphQL](https://www.apollographql.com/tutorials/lift-off-part3/03-graphql-arguments)

@ -1 +1,10 @@
# Schema
In GraphQL, a schema is a blueprint that defines the types, fields, and operations (queries and mutations) that are available to clients. The schema is the contract between the client and the server, specifying what data can be requested and how it can be modified.
A GraphQL schema is defined using the GraphQL Schema Definition Language (SDL), which is a human-readable syntax for defining the structure of a GraphQL API. The SDL includes keywords such as **type**, **query**, **mutation**, **field**, and **argument** to define the different components of a schema.
Learn more from the following links:
- [Get started with Schema](https://graphql.org/learn/schema/)
- [Complete guide to GraphQL Schema](https://www.apollographql.com/docs/apollo-server/schema/schema/)
Loading…
Cancel
Save