You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,10 @@ You can find and compare releases at the [GitHub release page](https://github.co
9
9
10
10
## Unreleased
11
11
12
+
### Added
13
+
- Add **examples/05-using-typeConfigDecorator-with-SDL** to provide a solid example about resolving
14
+
fields on using [SDL](https://webonyx.github.io/graphql-php/schema-definition-language/) instead of [Object Types](https://webonyx.github.io/graphql-php/type-definitions/object-types/).
You can learn more about using `$typeConfigDecorator` in [examples/05-using-typeConfigDecorator-with-SDL](../examples/05-using-typeConfigDecorator-with-SDL/)
57
+
56
58
## Performance considerations
57
59
58
60
Method **BuildSchema::build()** produces a [lazy schema](schema-definition.md#lazy-loading-of-types) automatically,
This example is intended to show you the boilerplate that you would need to resolve object types in a query using the SDL instead of defining the schema using the Object Types.
4
+
5
+
**Code Context:** The business logic is from [Apollo graphql course. ](https://www.apollographql.com/tutorials/lift-off-part2/03-apollo-restdatasource) Full source code is also available in the accompanying repo for this course .
6
+
7
+
**Further explanation** : There is [an accompanying issue](https://github.com/webonyx/graphql-php/issues/1699) where I explained some of the boilerplate code .
8
+
9
+
## How to follow along ?
10
+
1. Navigate to `examples/05-using-typeConfigDecorator-with-SDL` using the command line
11
+
2. Run `composer install`
12
+
3. Run `php -S localhost:8080 graphql.php`
13
+
4. Use your favorite API client and make a request to `localhost:8080` . Provide the following as the request body :
14
+
15
+
```graphql
16
+
{
17
+
tracksForHome {
18
+
title
19
+
thumbnail
20
+
author {
21
+
id
22
+
name
23
+
}
24
+
}
25
+
}
26
+
```
27
+
28
+
5. You can also use `curl` :
29
+
```
30
+
curl --data '{"query": "{ tracksForHome { title thumbnail author { id name } } }"}' --header "Content-Type: application/json" http://localhost:8080
0 commit comments