Skip to content

Commit 4cde146

Browse files
committed
Tidy v16 indentation
1 parent 8c2134a commit 4cde146

16 files changed

+1597
-1804
lines changed

versioned_docs/version-v16/batching.md

Lines changed: 238 additions & 252 deletions
Large diffs are not rendered by default.

versioned_docs/version-v16/concerns.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,31 @@ graphql execution to perform authorisation.
3636
This made up example shows how you can pass yourself information to help execute your queries.
3737

3838
```java
39-
40-
//
41-
// this could be code that authorises the user in some way and sets up enough context
42-
// that can be used later inside data fetchers allowing them
43-
// to do their job
44-
//
45-
UserContext contextForUser = YourGraphqlContextBuilder.getContextForUser(getCurrentUser());
46-
47-
ExecutionInput executionInput = ExecutionInput.newExecutionInput()
48-
.context(contextForUser)
49-
.build();
50-
51-
ExecutionResult executionResult = graphQL.execute(executionInput);
52-
53-
// ...
54-
//
55-
// later you are able to use this context object when a data fetcher is invoked
56-
//
57-
58-
DataFetcher dataFetcher = new DataFetcher() {
59-
@Override
60-
public Object get(DataFetchingEnvironment environment) {
61-
UserContext userCtx = environment.getContext();
62-
Long businessObjId = environment.getArgument("businessObjId");
63-
64-
return invokeBusinessLayerMethod(userCtx, businessObjId);
65-
}
66-
};
67-
39+
//
40+
// this could be code that authorises the user in some way and sets up enough context
41+
// that can be used later inside data fetchers allowing them
42+
// to do their job
43+
//
44+
UserContext contextForUser = YourGraphqlContextBuilder.getContextForUser(getCurrentUser());
45+
46+
ExecutionInput executionInput = ExecutionInput.newExecutionInput()
47+
.context(contextForUser)
48+
.build();
49+
50+
ExecutionResult executionResult = graphQL.execute(executionInput);
51+
52+
// ...
53+
//
54+
// later you are able to use this context object when a data fetcher is invoked
55+
//
56+
57+
DataFetcher dataFetcher = new DataFetcher() {
58+
@Override
59+
public Object get(DataFetchingEnvironment environment) {
60+
UserContext userCtx = environment.getContext();
61+
Long businessObjId = environment.getArgument("businessObjId");
62+
63+
return invokeBusinessLayerMethod(userCtx, businessObjId);
64+
}
65+
};
6866
```

versioned_docs/version-v16/contributions.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,19 @@ In order to make this a pleasant as possible for everybody involved, here are so
2727
Just clone the repo and type
2828

2929
```bash
30-
31-
./gradlew build
30+
./gradlew build
3231
```
3332
<br/>
3433
In `build/libs` you will find the jar file.
3534

3635
Running the tests:
3736

3837
```bash
39-
40-
./gradlew test
38+
./gradlew test
4139
```
4240

4341
Installing in the local Maven repository:
4442

4543
```bash
46-
47-
./gradlew install
44+
./gradlew install
4845
```

versioned_docs/version-v16/data-fetching.md

Lines changed: 71 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ Some fields will use specialised data fetcher code that knows how to go to a dat
1313
most simply take data from the returned in memory objects using the field name and Plain Old Java Object (POJO) patterns
1414
to get the data.
1515

16-
`Note : Data fetchers are some times called "resolvers" in other graphql implementations.`
16+
Note : Data fetchers are some times called "resolvers" in other graphql implementations.
1717

1818
So imagine a type declaration like the one below :
1919

2020

2121
```graphql
22-
type Query {
23-
products(match : String) : [Product] # a list of products
24-
}
25-
26-
type Product {
27-
id : ID
28-
name : String
29-
description : String
30-
cost : Float
31-
tax : Float
32-
launchDate(dateFormat : String = "dd, MMM, yyyy') : String
33-
}
22+
type Query {
23+
products(match : String) : [Product] # a list of products
24+
}
25+
26+
type Product {
27+
id : ID
28+
name : String
29+
description : String
30+
cost : Float
31+
tax : Float
32+
launchDate(dateFormat : String = "dd, MMM, yyyy') : String
33+
}
3434
```
3535
3636
@@ -43,21 +43,21 @@ product results if the client specified it.
4343
It might look like the following :
4444
4545
```java
46-
DataFetcher productsDataFetcher = new DataFetcher<List<ProductDTO>>() {
47-
@Override
48-
public List<ProductDTO> get(DataFetchingEnvironment environment) {
49-
DatabaseSecurityCtx ctx = environment.getContext();
50-
51-
List<ProductDTO> products;
52-
String match = environment.getArgument("match");
53-
if (match != null) {
54-
products = fetchProductsFromDatabaseWithMatching(ctx, match);
55-
} else {
56-
products = fetchAllProductsFromDatabase(ctx);
57-
}
58-
return products;
59-
}
60-
};
46+
DataFetcher productsDataFetcher = new DataFetcher<List<ProductDTO>>() {
47+
@Override
48+
public List<ProductDTO> get(DataFetchingEnvironment environment) {
49+
DatabaseSecurityCtx ctx = environment.getContext();
50+
51+
List<ProductDTO> products;
52+
String match = environment.getArgument("match");
53+
if (match != null) {
54+
products = fetchProductsFromDatabaseWithMatching(ctx, match);
55+
} else {
56+
products = fetchAllProductsFromDatabase(ctx);
57+
}
58+
return products;
59+
}
60+
};
6161
```
6262
6363
@@ -82,29 +82,28 @@ argument. We can have the ProductDTO have logic that applies this date formatti
8282
8383
8484
```java
85-
class ProductDTO {
85+
class ProductDTO {
8686
87-
private ID id;
88-
private String name;
89-
private String description;
90-
private Double cost;
91-
private Double tax;
92-
private LocalDateTime launchDate;
87+
private ID id;
88+
private String name;
89+
private String description;
90+
private Double cost;
91+
private Double tax;
92+
private LocalDateTime launchDate;
9393
94-
// ...
94+
// ...
9595
96-
public String getName() {
97-
return name;
98-
}
96+
public String getName() {
97+
return name;
98+
}
9999
100-
// ...
100+
// ...
101101
102-
public String getLaunchDate(DataFetchingEnvironment environment) {
103-
String dateFormat = environment.getArgument("dateFormat");
104-
return yodaTimeFormatter(launchDate,dateFormat);
105-
}
102+
public String getLaunchDate(DataFetchingEnvironment environment) {
103+
String dateFormat = environment.getArgument("dateFormat");
104+
return yodaTimeFormatter(launchDate,dateFormat);
106105
}
107-
106+
}
108107
```
109108
110109
@@ -122,36 +121,32 @@ represented as ``getDesc()`` in the runtime backing Java object.
122121
If you are using SDL to specify your schema then you can use the ``@fetch`` directive to indicate this remapping.
123122
124123
```graphql
125-
directive @fetch(from : String!) on FIELD_DEFINITION
126-
127-
type Product {
128-
id : ID
129-
name : String
130-
description : String @fetch(from:"desc")
131-
cost : Float
132-
tax : Float
133-
}
134-
124+
directive @fetch(from : String!) on FIELD_DEFINITION
125+
126+
type Product {
127+
id : ID
128+
name : String
129+
description : String @fetch(from:"desc")
130+
cost : Float
131+
tax : Float
132+
}
135133
```
136134
137135
This will tell the ``graphql.schema.PropertyDataFetcher`` to use the property name ``desc`` when fetching data for the graphql field named ``description``.
138136
139137
If you are hand coding your schema then you can just specify it directly by wiring in a field data fetcher.
140138
141139
```java
142-
143-
GraphQLFieldDefinition descriptionField = GraphQLFieldDefinition.newFieldDefinition()
144-
.name("description")
145-
.type(Scalars.GraphQLString)
146-
.build();
147-
148-
GraphQLCodeRegistry codeRegistry = GraphQLCodeRegistry.newCodeRegistry()
149-
.dataFetcher(
150-
coordinates("ObjectType", "description"),
151-
PropertyDataFetcher.fetching("desc"))
152-
.build();
153-
154-
140+
GraphQLFieldDefinition descriptionField = GraphQLFieldDefinition.newFieldDefinition()
141+
.name("description")
142+
.type(Scalars.GraphQLString)
143+
.build();
144+
145+
GraphQLCodeRegistry codeRegistry = GraphQLCodeRegistry.newCodeRegistry()
146+
.dataFetcher(
147+
coordinates("ObjectType", "description"),
148+
PropertyDataFetcher.fetching("desc"))
149+
.build();
155150
```
156151
157152
@@ -209,16 +204,16 @@ Imagine a query such as the following
209204
210205
211206
```graphql
212-
query {
213-
products {
214-
# the fields below represent the selection set
215-
name
216-
description
217-
sellingLocations {
218-
state
219-
}
207+
query {
208+
products {
209+
# the fields below represent the selection set
210+
name
211+
description
212+
sellingLocations {
213+
state
220214
}
221215
}
216+
}
222217
```
223218
224219

0 commit comments

Comments
 (0)