From f16bd09a47726f866174b979300e1e1c2b731054 Mon Sep 17 00:00:00 2001 From: syedmouaazfarrukh Date: Fri, 20 Jan 2023 10:13:44 -0800 Subject: [PATCH] Adding content to 104-schema --- .../content/104-schema/100-type-system.md | 15 ++++++++++++- .../graphql/content/104-schema/101-fields.md | 11 +++++++++- .../graphql/content/104-schema/102-scalars.md | 21 ++++++++++++++++++- .../graphql/content/104-schema/103-enums.md | 12 ++++++++++- .../graphql/content/104-schema/104-objects.md | 9 +++++++- .../graphql/content/104-schema/105-lists.md | 10 ++++++++- .../content/104-schema/106-interfaces.md | 11 +++++++++- .../graphql/content/104-schema/107-unions.md | 11 +++++++++- .../content/104-schema/108-arguments.md | 9 +++++++- .../graphql/content/104-schema/index.md | 11 +++++++++- 10 files changed, 110 insertions(+), 10 deletions(-) diff --git a/src/roadmaps/graphql/content/104-schema/100-type-system.md b/src/roadmaps/graphql/content/104-schema/100-type-system.md index 7b44d60d1..4f2eb3dfb 100644 --- a/src/roadmaps/graphql/content/104-schema/100-type-system.md +++ b/src/roadmaps/graphql/content/104-schema/100-type-system.md @@ -1 +1,14 @@ -# Type system \ No newline at end of file +# 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) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/101-fields.md b/src/roadmaps/graphql/content/104-schema/101-fields.md index 70dd38e66..f6555a036 100644 --- a/src/roadmaps/graphql/content/104-schema/101-fields.md +++ b/src/roadmaps/graphql/content/104-schema/101-fields.md @@ -1 +1,10 @@ -# Fields \ No newline at end of file +# 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) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/102-scalars.md b/src/roadmaps/graphql/content/104-schema/102-scalars.md index cef903167..16dbe20b2 100644 --- a/src/roadmaps/graphql/content/104-schema/102-scalars.md +++ b/src/roadmaps/graphql/content/104-schema/102-scalars.md @@ -1 +1,20 @@ -# Scalars \ No newline at end of file +# 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) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/103-enums.md b/src/roadmaps/graphql/content/104-schema/103-enums.md index 1cf9f0037..e619fb8bd 100644 --- a/src/roadmaps/graphql/content/104-schema/103-enums.md +++ b/src/roadmaps/graphql/content/104-schema/103-enums.md @@ -1 +1,11 @@ -# Enums \ No newline at end of file +# 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) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/104-objects.md b/src/roadmaps/graphql/content/104-schema/104-objects.md index db71f7e72..0d03e96d4 100644 --- a/src/roadmaps/graphql/content/104-schema/104-objects.md +++ b/src/roadmaps/graphql/content/104-schema/104-objects.md @@ -1 +1,8 @@ -# Objects \ No newline at end of file +# 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/) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/105-lists.md b/src/roadmaps/graphql/content/104-schema/105-lists.md index 96bf734a5..d317e204d 100644 --- a/src/roadmaps/graphql/content/104-schema/105-lists.md +++ b/src/roadmaps/graphql/content/104-schema/105-lists.md @@ -1 +1,9 @@ -# Lists \ No newline at end of file +# 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) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/106-interfaces.md b/src/roadmaps/graphql/content/104-schema/106-interfaces.md index ae1d147ef..76306ad21 100644 --- a/src/roadmaps/graphql/content/104-schema/106-interfaces.md +++ b/src/roadmaps/graphql/content/104-schema/106-interfaces.md @@ -1 +1,10 @@ -# Interfaces \ No newline at end of file +# 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) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/107-unions.md b/src/roadmaps/graphql/content/104-schema/107-unions.md index 6504457cd..884ff84cf 100644 --- a/src/roadmaps/graphql/content/104-schema/107-unions.md +++ b/src/roadmaps/graphql/content/104-schema/107-unions.md @@ -1 +1,10 @@ -# Unions \ No newline at end of file +# 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/) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/108-arguments.md b/src/roadmaps/graphql/content/104-schema/108-arguments.md index de7633005..871b47aef 100644 --- a/src/roadmaps/graphql/content/104-schema/108-arguments.md +++ b/src/roadmaps/graphql/content/104-schema/108-arguments.md @@ -1 +1,8 @@ -# Arguments \ No newline at end of file +# 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) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/104-schema/index.md b/src/roadmaps/graphql/content/104-schema/index.md index 9946ba95f..4ccef0706 100644 --- a/src/roadmaps/graphql/content/104-schema/index.md +++ b/src/roadmaps/graphql/content/104-schema/index.md @@ -1 +1,10 @@ -# Schema \ No newline at end of file +# 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/) \ No newline at end of file