SDL
SDL (Schema definition Language)
Scalar and Object Types
Query and Mutation types
Mutations
Fields in GraphQL
You can think of each field in a GraphQL query as a function or method of the previous type which returns the next type. In fact, this is exactly how GraphQL works. Each field on each type is backed by a function called theresolverwhich is provided by the GraphQL server developer. When a field is executed, the correspondingresolveris called to produce the next value.
If a field produces a scalar value like a string or number, then the execution completes. However if a field produces an object value then the query will contain another selection of fields which apply to that object. This continues until scalar values are reached. GraphQL queries always end at scalar values.
Architectural Use Cases
Imperative data fetching
Declarative Data fetching
GraphQL Client Side
REST vs GraphQL
Query
A type on a schema that defines operations clients can perform to access data that resembles the shape of other Types in the schema
Creating Query
Creating Resolvers
Resolvers
Mutations
Enums
set of discrete values that can be used in place of scalars. An enum field must resolve to one of the values in the enum. Great for limitng a field to only a few different options
Interfaces
Abstract types that can’t be used as field values but used as foundations for explicit types
Unions
like interfaces but without an defined common fields among types. useful when need to access more than one disjoint type from one query