Skip to content

Commit 49e23de

Browse files
committed
PR feedback
1 parent 4c40ad5 commit 49e23de

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

content/blog/getting-started-with-spring-boot.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ date = 2019-01-23
77
toc = "true"
88
+++
99

10-
This is a tutorial for people who have never development a GraphQL server with Java. Some Spring Boot and Java knowledge is required. While we give a brief introduction into GraphQL, the focus of this tutorial is on developing a GraphQL server in Java.
11-
10+
This is a tutorial for people who want to create a GraphQL server in Java. It requires some Spring Boot and Java knowledge and while we give a brief introduction into GraphQL, the focus of this tutorial is on developing a GraphQL server in Java.
1211

1312
# GraphQL in 3 minutes
1413

@@ -32,7 +31,7 @@ With GraphQL you send the following query to server to get the details for the b
3231
}
3332
{{< / highlight >}}
3433

35-
This is not JSON (even if it looks remotely similar), it is a GraphQL query.
34+
This is not JSON (even though it looks deliberately similar), it is a GraphQL query.
3635
It basically says:
3736

3837
- query a book with a specific id
@@ -55,7 +54,7 @@ The response is normal JSON:
5554
}
5655
{{< / highlight >}}
5756

58-
One very important property of GraphQL is that it is statically typed: the server knows exactly of the shape of every object you can query and any client can actually "inspect" the server and ask for the so called "schema". The schema describes what queries are possible and what fields you can get back. (Note: when we refer to schema here, we always refer to a "GraphQL Schema", which is not related to other schemas like "JSON Schema")
57+
One very important property of GraphQL is that it is statically typed: the server knows exactly the shape of every object you can query and any client can actually "introspect" the server and ask for the so called "schema". The schema describes what queries are possible and what fields you can get back. (Note: when we refer to schema here, we always refer to a "GraphQL Schema", which is not related to other schemas like "JSON Schema" or "Database Schema")
5958

6059
The schema for the above query looks like this:
6160

@@ -92,7 +91,7 @@ GraphQL Java Engine itself is only concerned with executing queries. It doesn't
9291
The main steps of creating a GraphQL Java server are:
9392

9493
1. Defining a GraphQL Schema.
95-
2. Defining on how the actual data for a query is fetched.
94+
2. Deciding on how the actual data for a query is fetched.
9695

9796
# Our example API: getting book details
9897

@@ -166,7 +165,7 @@ It also defines the type `Book` which has the fields: `id`, `name`, `pageCount`
166165

167166
> The Domain Specific Language shown above which is used to describe a schema is called Schema Definition Language or SDL. More details about it can be found [here](https://graphql.org/learn/schema/).
168167
169-
But so far this is just normal text. We need to "bring it to live" by reading the file and parsing it.
168+
Once we have this file we need to "bring it to life" by reading the file and parsing it and adding code to fetch data for it.
170169

171170
We create a new `GraphQLProvider` class in the package `com.graphqljava.tutorial.bookdetails` with an `init` method which will create a `GraphQL` instance:
172171

@@ -191,15 +190,16 @@ public class GraphQLProvider {
191190
}
192191

193192
private GraphQLSchema buildSchema(String sdl) {
194-
//TODO
193+
// TODO: we will create the schema here later
195194
}
196195
}
197196
{{< / highlight >}}
198197
<p/>
199198

200-
We use Guava to read the file at runtime from our classpath, then create a `GraphQLSchema` and `GraphQL` instance. This `GraphQL` instance is exposed as a Spring Bean. The GraphQL Java Spring adapter will use that `GraphQL` instance to make our schema available via HTTP on the default url `/graphql`.
199+
We use Guava `Resources` to read the file from our classpath, then create a `GraphQLSchema` and `GraphQL` instance. This `GraphQL` instance is exposed as a Spring Bean. The GraphQL Java Spring adapter will use that `GraphQL` instance to make our schema available via HTTP on the default url `/graphql`.
200+
201+
What we still need to do is to implement the `buildSchema` method which creates the `GraphQLSchema` instance and wires in code to fetch data:
201202

202-
What we still need to do is to implement the `buildSchema` method which creates the `GraphQLSchema` instance:
203203

204204
{{< highlight java "linenos=table" >}}
205205
@Autowired
@@ -225,7 +225,7 @@ What we still need to do is to implement the `buildSchema` method which creates
225225

226226
`TypeDefinitionRegistry` is the parsed version of our schema file. `SchemaGenerator` combines the `TypeDefinitionRegistry` with `RuntimeWiring` to actually make the `GraphQLSchema`.
227227

228-
`buildRuntimeWiring` uses the `graphQLDataFetchers` bean to actually register two `DataFetcher`:
228+
`buildRuntimeWiring` uses the `graphQLDataFetchers` bean to actually register two `DataFetcher`s:
229229

230230
- One to retrieve a book with a specific ID
231231
- One to get the author for a specific book.
@@ -252,7 +252,7 @@ Important: **Every** field from the schema has a `DataFetcher` associated with.
252252

253253
We are creating a new class `GraphQLDataFetchers` which contains a sample list of books and authors.
254254

255-
The full implementation looks like that and we will look at it in detail:
255+
The full implementation looks like this which we will look at it in detail soon:
256256

257257

258258
{{< highlight java "linenos=table" >}}

0 commit comments

Comments
 (0)