From 1ca0afbed96487c1666cbb3950405eec16afa91d Mon Sep 17 00:00:00 2001 From: syedmouaazfarrukh Date: Fri, 20 Jan 2023 10:30:01 -0800 Subject: [PATCH] Adding content to 101-resolvers --- .../105-execution/101-resolvers/100-synchronous.md | 10 +++++++++- .../105-execution/101-resolvers/101-asynchronous.md | 10 +++++++++- .../101-resolvers/102-scalar-coercion.md | 10 +++++++++- .../content/105-execution/101-resolvers/103-lists.md | 10 +++++++++- .../content/105-execution/101-resolvers/index.md | 11 ++++++++++- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/roadmaps/graphql/content/105-execution/101-resolvers/100-synchronous.md b/src/roadmaps/graphql/content/105-execution/101-resolvers/100-synchronous.md index 7b78737b8..f55244951 100644 --- a/src/roadmaps/graphql/content/105-execution/101-resolvers/100-synchronous.md +++ b/src/roadmaps/graphql/content/105-execution/101-resolvers/100-synchronous.md @@ -1 +1,9 @@ -# Synchronous \ No newline at end of file +# Synchronous + +In GraphQL, a resolver is a function that is responsible for fetching the data for a field in a query or mutation. Resolvers are defined in the schema and are executed by the GraphQL server when a query or mutation is received. + +A synchronous resolver is a type of resolver that runs and completes its execution before returning any value. It directly returns the result of the computation, without waiting for any external event such as a database query or a third-party API call. + +Learn more from the following links: + +- [Get Started with Synchronous](https://graphql.org/learn/asynchronous/) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/105-execution/101-resolvers/101-asynchronous.md b/src/roadmaps/graphql/content/105-execution/101-resolvers/101-asynchronous.md index 2340f8c71..932c93696 100644 --- a/src/roadmaps/graphql/content/105-execution/101-resolvers/101-asynchronous.md +++ b/src/roadmaps/graphql/content/105-execution/101-resolvers/101-asynchronous.md @@ -1 +1,9 @@ -# Asynchronous \ No newline at end of file +# Asynchronous + +In GraphQL, a resolver is a function that is responsible for fetching the data for a field in a query or mutation. Resolvers are defined in the schema and are executed by the GraphQL server when a query or mutation is received. + +An asynchronous resolver is a type of resolver that runs, but instead of returning the final value, it returns a promise that will be resolved with the final value. This allows the resolver to wait for an external event such as a database query or a third-party API call to complete before returning the result. + +Learn more from the following links: + +- [Get Started with Asynchronous](https://graphql.org/learn/execution/#asynchronous-resolvers) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/105-execution/101-resolvers/102-scalar-coercion.md b/src/roadmaps/graphql/content/105-execution/101-resolvers/102-scalar-coercion.md index 698613bb2..08970d70d 100644 --- a/src/roadmaps/graphql/content/105-execution/101-resolvers/102-scalar-coercion.md +++ b/src/roadmaps/graphql/content/105-execution/101-resolvers/102-scalar-coercion.md @@ -1 +1,9 @@ -# Scalar coercion \ No newline at end of file +# Scalar Coercion + +In GraphQL, scalar coercion is the process of converting a value from one type to another, as it flows through the resolvers. This is needed when the input value for a field does not match the expected type, but can still be successfully converted to the correct type. + +Scalar coercion can be implemented in the resolvers by using the **GraphQLScalarType** constructor to define a custom scalar type and providing a **coerce** function that can convert the input value to the correct type. + +Learn more from the following links: + +- [Get started with Scalar coercion](https://graphql.org/learn/execution/#scalar-coercion) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/105-execution/101-resolvers/103-lists.md b/src/roadmaps/graphql/content/105-execution/101-resolvers/103-lists.md index 96bf734a5..6fc435d7e 100644 --- a/src/roadmaps/graphql/content/105-execution/101-resolvers/103-lists.md +++ b/src/roadmaps/graphql/content/105-execution/101-resolvers/103-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 can be used as the return type for a field in a query or mutation, and can contain any type of items, including scalars and objects. + +The resolver function for a list field can retrieve the data from a database or a third-party API and return it as an array. + +Learn more from the following links: + +- [Get started with Lists and Non-Null](https://graphql.org/learn/schema/#lists-and-non-null) \ No newline at end of file diff --git a/src/roadmaps/graphql/content/105-execution/101-resolvers/index.md b/src/roadmaps/graphql/content/105-execution/101-resolvers/index.md index 9b73464fc..46d486d67 100644 --- a/src/roadmaps/graphql/content/105-execution/101-resolvers/index.md +++ b/src/roadmaps/graphql/content/105-execution/101-resolvers/index.md @@ -1 +1,10 @@ -# Resolvers \ No newline at end of file +# Resolvers + +In GraphQL, a resolver is a function that is responsible for fetching the data for a field in a query or mutation. Resolvers are defined in the schema and are executed by the GraphQL server when a query or mutation is received. + +Each field in a GraphQL schema has a corresponding resolver function that is responsible for returning the data for that field. The resolver function can retrieve the data from a database, a third-party API, or any other source, and return it to the client. + +Learn more from the following links: + +- [Complete guide to Resolver](https://www.apollographql.com/docs/apollo-server/data/resolvers/) +- [Tutorial - Resolvers](https://www.tutorialspoint.com/graphql/graphql_resolver.htm) \ No newline at end of file