Skip to content

Commit 46807b8

Browse files
smyrickShane Myrick
andauthored
Move federation docs under generator folder (#1059)
* Remove 4.x.x docs for current Instead of having a next version and 4.x.x version of the docs we can just have the current. If we want to cut the docs again and work on 5.x.x the steps would be: create 4.x.x branch for code; run docusaurus command to create 4.x.x version * Revert delete of 4.x.x * Update latest plugin docs Co-authored-by: Shane Myrick <[email protected]>
1 parent 0d34b14 commit 46807b8

File tree

15 files changed

+249
-277
lines changed

15 files changed

+249
-277
lines changed

generator/graphql-kotlin-federation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
`graphql-kotlin-federation` extends the functionality of `graphql-kotlin-schema-generator` and allows you to easily
66
generate federated GraphQL schemas directly from the code. Federated schemas rely on a number of directives to
7-
instrument the behavior of the underlying graph, see [the documentation](https://expediagroup.github.io/graphql-kotlin/docs/federated/federated-directives).
7+
instrument the behavior of the underlying graph, see [the documentation](https://expediagroup.github.io/graphql-kotlin).
88
Once all the federated objects are annotated, you will also have to configure corresponding [FederatedTypeResolver]s
99
that are used to instantiate federated objects and finally generate the schema using `toFederatedSchema` function
1010
([link](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/generator/graphql-kotlin-federation/src/main/kotlin/com/expediagroup/graphql/generator/federation/toFederatedSchema.kt#L34)).

website/docs/getting-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ See the docs in [Schema Generator Getting Started](./schema-generator/schema-gen
5151

5252
Using `graphql-kotlin-federation`, you can generate an [Apollo Federation](https://www.apollographql.com/docs/apollo-server/federation/federation-spec/) compliant schema.
5353

54-
See the docs in [Apollo Federation](./federated/apollo-federation.md).
54+
See the docs in [Apollo Federation](./schema-generator/federation/apollo-federation.md).
5555

5656
## Running a Server
5757

website/docs/plugins/gradle-plugin-tasks.mdx

Lines changed: 49 additions & 47 deletions
Large diffs are not rendered by default.

website/docs/plugins/gradle-plugin-usage.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ graphqlGenerateTestClient {
352352
This will process all GraphQL queries located under `src/test/resources` and generate corresponding GraphQL Kotlin clients.
353353
Generated classes will be automatically added to the project test compile sources.
354354

355-
&gt; NOTE: `graphqlGenerateTestClient` cannot be configured through the `graphql` extension and has to be explicitly configured.
355+
> NOTE: `graphqlGenerateTestClient` cannot be configured through the `graphql` extension and has to be explicitly configured.
356356
357357
## Minimal Client Configuration Example
358358

@@ -447,7 +447,7 @@ the GraphQL Ktor client code based on the provided query.
447447
{ label: 'Kotlin', value: 'kotlin' },
448448
{ label: 'Groovy', value: 'groovy' }
449449
]
450-
}>
450+
}>
451451

452452
<TabItem value="kotlin">
453453

@@ -813,5 +813,5 @@ dependencies {
813813
</TabItem>
814814
</Tabs>
815815

816-
&gt; NOTE: This task does not automatically configure itself to be part of your build lifecycle. You will need to explicitly
817-
&gt; invoke it OR configure it as a dependency of some other task.
816+
> NOTE: This task does not automatically configure itself to be part of your build lifecycle. You will need to explicitly
817+
> invoke it OR configure it as a dependency of some other task.

website/docs/plugins/maven-plugin-goals.md

Lines changed: 96 additions & 94 deletions
Large diffs are not rendered by default.

website/docs/plugins/maven-plugin-usage.md

Lines changed: 52 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@ id: maven-plugin-usage
33
title: Maven Plugin Usage
44
sidebar_label: Usage
55
---
6+
67
## Downloading Schema SDL
78

89
Download SDL Mojo requires target GraphQL server `endpoint` to be specified. Task can be executed directly from the
910
command line by explicitly specifying `graphql.endpoint` property.
1011

1112
```shell script
12-
1313
$ mvn com.expediagroup:graphql-kotlin-maven-plugin:download-sdl -Dgraphql.endpoint="http://localhost:8080/sdl"
14-
1514
```
1615

1716
Mojo can also be configured in your Maven build file
1817

1918
```xml
20-
2119
<plugin>
2220
<groupId>com.expediagroup</groupId>
2321
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -33,7 +31,6 @@ Mojo can also be configured in your Maven build file
3331
</execution>
3432
</executions>
3533
</plugin>
36-
3734
```
3835

3936
By default, `download-sdl` goal will be executed as part of the `generate-sources` [build lifecycle phase](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html).
@@ -44,15 +41,12 @@ Introspection Mojo requires target GraphQL server `endpoint` to be specified. Ta
4441
command line by explicitly specifying `graphql.endpoint` property
4542

4643
```shell script
47-
4844
$ mvn com.expediagroup:graphql-kotlin-maven-plugin:introspect-schema -Dgraphql.endpoint="http://localhost:8080/graphql"
49-
5045
```
5146

5247
Mojo can also be configured in your Maven build file
5348

5449
```xml
55-
5650
<plugin>
5751
<groupId>com.expediagroup</groupId>
5852
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -68,7 +62,6 @@ Mojo can also be configured in your Maven build file
6862
</execution>
6963
</executions>
7064
</plugin>
71-
7265
```
7366

7467
By default, `introspect-schema` goal will be executed as part of the `generate-sources` [build lifecycle phase](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html).
@@ -80,16 +73,13 @@ generated under specified `packageName`. When using default configuration and st
8073
directories, task can be executed directly from the command line by explicitly providing required properties.
8174

8275
```shell script
83-
8476
$ mvn com.expediagroup:graphql-kotlin-maven-plugin:generate-client -Dgraphql.schemaFile="mySchema.graphql" -Dgraphql.packageName="com.example.generated"
85-
8677
```
8778

8879
Mojo can also be configured in your Maven build file to become part of your build lifecycle. Plugin also provides additional
8980
configuration options that are not available on command line.
9081

9182
```xml
92-
9383
<plugin>
9484
<groupId>com.expediagroup</groupId>
9585
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -106,14 +96,13 @@ configuration options that are not available on command line.
10696
</execution>
10797
</executions>
10898
</plugin>
109-
11099
```
111100

112101
This will process all GraphQL queries located under `src/main/resources` and generate corresponding GraphQL Kotlin clients.
113102
Generated classes will be automatically added to the project compile sources.
114103

115-
&gt; NOTE: You might need to explicitly add generated clients to your project sources for your IDE to recognize them. See
116-
&gt; [build-helper-maven-plugin](https://www.mojohaus.org/build-helper-maven-plugin/) for details.
104+
>NOTE: You might need to explicitly add generated clients to your project sources for your IDE to recognize them. See
105+
>[build-helper-maven-plugin](https://www.mojohaus.org/build-helper-maven-plugin/) for details.
117106
118107
## Generating Ktor or WebClient Based Client
119108

@@ -125,7 +114,6 @@ For example in order to generate Ktor based HTTP client we need to specify `Grap
125114
if you would like to use WebClient implementation instead you need to specify `GraphQLClientType.WEBCLIENT` instead.
126115

127116
```xml
128-
129117
<plugin>
130118
<groupId>com.expediagroup</groupId>
131119
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -143,7 +131,6 @@ if you would like to use WebClient implementation instead you need to specify `G
143131
</execution>
144132
</executions>
145133
</plugin>
146-
147134
```
148135

149136
## Generating Client with Custom Scalars
@@ -154,15 +141,12 @@ custom [scalar converter](https://github.com/ExpediaGroup/graphql-kotlin/blob/ma
154141
For example given following custom scalar in our GraphQL schema
155142

156143
```graphql
157-
158144
scalar UUID
159-
160145
```
161146

162147
We can create a custom converter to automatically convert this custom scalar to `java.util.UUID`
163148

164149
```kotlin
165-
166150
package com.example
167151

168152
import com.expediagroup.graphql.client.converter.ScalarConverter
@@ -172,13 +156,11 @@ class UUIDScalarConverter : ScalarConverter<UUID> {
172156
override fun toScalar(rawValue: String): UUID = UUID.fromString(rawValue)
173157
override fun toJson(value: UUID): String = value.toString()
174158
}
175-
176159
```
177160

178161
Afterwards we need to configure our plugin to use this custom converter
179162

180163
```xml
181-
182164
<plugin>
183165
<groupId>com.expediagroup</groupId>
184166
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -192,22 +174,21 @@ Afterwards we need to configure our plugin to use this custom converter
192174
<allowDeprecatedFields>false</allowDeprecatedFields>
193175
<customScalars>
194176
<customScalar>
195-
<!-- custom scalar UUID type
196-
scalarUUID
197-
fully qualified Java class name of a custom scalar type
198-
typejava.util.UUID
199-
fully qualified Java class name of a custom com.expediagroup.graphql.client.converter.ScalarConverter
200-
used to convert to/from raw JSON and scalar type
201-
convertercom.example.UUIDScalarConverter
202-
203-
204-
packagenamecom.example.generated
205-
schemafilemySchema.graphql
206-
207-
208-
209-
--&gt;
210-
177+
<!-- custom scalar UUID type -->
178+
<scalar>UUID</scalar>
179+
<!-- fully qualified Java class name of a custom scalar type -->
180+
<type>java.util.UUID</type>
181+
<!-- fully qualified Java class name of a custom com.expediagroup.graphql.client.converter.ScalarConverter
182+
used to convert to/from raw JSON and scalar type -->
183+
<converter>com.example.UUIDScalarConverter</converter>
184+
</customScalar>
185+
</customScalars>
186+
<packageName>com.example.generated</packageName>
187+
<schemaFile>mySchema.graphql</schemaFile>
188+
</configuration>
189+
</execution>
190+
</executions>
191+
</plugin>
211192
```
212193

213194
## Generating Test Client
@@ -217,16 +198,13 @@ are generated under specified `packageName`. When using default configuration an
217198
directories, task can be executed directly from the command line by explicitly providing required properties.
218199

219200
```shell script
220-
221201
$ mvn com.expediagroup:graphql-kotlin-maven-plugin:generate-test-client -Dgraphql.schemaFile="mySchema.graphql" -Dgraphql.packageName="com.example.generated"
222-
223202
```
224203

225204
Mojo can also be configured in your Maven build file to become part of your build lifecycle. Plugin also provides additional
226205
configuration options that are not available on command line.
227206

228207
```xml
229-
230208
<plugin>
231209
<groupId>com.expediagroup</groupId>
232210
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -243,22 +221,20 @@ configuration options that are not available on command line.
243221
</execution>
244222
</executions>
245223
</plugin>
246-
247224
```
248225

249226
This will process all GraphQL queries located under `src/test/resources` and generate corresponding GraphQL Kotlin test clients.
250227
Generated classes will be automatically added to the project test compile sources.
251228

252-
&gt; NOTE: You might need to explicitly add generated test clients to your project test sources for your IDE to recognize them.
253-
&gt; See [build-helper-maven-plugin](https://www.mojohaus.org/build-helper-maven-plugin/) for details.
229+
>NOTE: You might need to explicitly add generated test clients to your project test sources for your IDE to recognize them.
230+
>See [build-helper-maven-plugin](https://www.mojohaus.org/build-helper-maven-plugin/) for details.
254231
255232
## Minimal Configuration Example
256233

257234
Following is the minimal configuration that runs introspection query against a target GraphQL server and generates a corresponding schema.
258235
This generated schema is subsequently used to generate GraphQL client code based on the queries provided under `src/main/resources` directory.
259236

260237
```xml
261-
262238
<plugin>
263239
<groupId>com.expediagroup</groupId>
264240
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -276,20 +252,18 @@ This generated schema is subsequently used to generate GraphQL client code based
276252
</execution>
277253
</executions>
278254
</plugin>
279-
280255
```
281256

282-
&gt; NOTE: Both `introspect-schema` and `generate-client` goals are bound to the same `generate-sources` Maven lifecycle phase.
283-
&gt; As opposed to Gradle, Maven does not support explicit ordering of different goals bound to the same build phase. Maven
284-
&gt; Mojos will be executed in the order they are defined in your `pom.xml` build file.
257+
>NOTE: Both `introspect-schema` and `generate-client` goals are bound to the same `generate-sources` Maven lifecycle phase.
258+
>As opposed to Gradle, Maven does not support explicit ordering of different goals bound to the same build phase. Maven
259+
>Mojos will be executed in the order they are defined in your `pom.xml` build file.
285260
286261
## Complete Configuration Example
287262

288263
Following is a configuration example that downloads schema SDL from a target GraphQL server that is then used to generate
289264
the GraphQL client code based on the provided query.
290265

291266
```xml
292-
293267
<plugin>
294268
<groupId>com.expediagroup</groupId>
295269
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -303,35 +277,35 @@ the GraphQL client code based on the provided query.
303277
<configuration>
304278
<endpoint>http://localhost:8080/sdl</endpoint>
305279
<packageName>com.example.generated</packageName>
306-
<!-- optional configuration below
307-
schemafile${"{"}project.build.directory{"}"}/mySchema.graphql
308-
allowdeprecatedfieldstrue
309-
customscalars
310-
311-
312-
UUID
313-
314-
java.util.UUID
315-
316-
com.example.UUIDScalarConverter
317-
318-
319-
headers
320-
My-Custom-Header
321-
322-
timeoutconfiguration
323-
324-
1000
325-
30000
326-
327-
queryfiles
328-
${"{"}project.basedir{"}"}/src/main/resources/queries/MyQuery.graphql
329-
330-
331-
332-
333-
--&gt;
334-
280+
<!-- optional configuration below -->
281+
<schemaFile>${project.build.directory}/mySchema.graphql</schemaFile>
282+
<allowDeprecatedFields>true</allowDeprecatedFields>
283+
<customScalars>
284+
<customScalar>
285+
<!-- custom scalar UUID type -->
286+
<scalar>UUID</scalar>
287+
<!-- fully qualified Java class name of a custom scalar type -->
288+
<type>java.util.UUID</type>
289+
<!-- fully qualified Java class name of a custom com.expediagroup.graphql.client.converter.ScalarConverter
290+
used to convert to/from raw JSON and scalar type -->
291+
<converter>com.example.UUIDScalarConverter</converter>
292+
</customScalar>
293+
</customScalars>
294+
<headers>
295+
<X-Custom-Header>My-Custom-Header</X-Custom-Header>
296+
</headers>
297+
<timeoutConfiguration>
298+
<!-- timeout values in milliseconds -->
299+
<connect>1000</connect>
300+
<read>30000</read>
301+
</timeoutConfiguration>
302+
<queryFiles>
303+
<queryFile>${project.basedir}/src/main/resources/queries/MyQuery.graphql</queryFile>
304+
</queryFiles>
305+
</configuration>
306+
</execution>
307+
</executions>
308+
</plugin>
335309
```
336310

337311
## Generating Multiple Clients
@@ -340,7 +314,6 @@ In order to generate GraphQL clients targeting multiple endpoints, we need to co
340314
different endpoints.
341315

342316
```xml
343-
344317
<plugin>
345318
<groupId>com.expediagroup</groupId>
346319
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -376,7 +349,6 @@ different endpoints.
376349
</execution>
377350
</executions>
378351
</plugin>
379-
380352
```
381353

382354
## Generating SDL Example
@@ -388,7 +360,6 @@ limit the amount of packages to scan, this mojo requires users to provide a list
388360
types.
389361

390362
```xml
391-
392363
<plugin>
393364
<groupId>com.expediagroup</groupId>
394365
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -406,7 +377,6 @@ types.
406377
</execution>
407378
</executions>
408379
</plugin>
409-
410380
```
411381

412382
## Generating SDL with Custom Hooks Provider Example
@@ -423,7 +393,6 @@ Configuration below shows how to configure GraphQL Kotlin plugin with explicitly
423393
GraphQL schema.
424394

425395
```xml
426-
427396
<plugin>
428397
<groupId>com.expediagroup</groupId>
429398
<artifactId>graphql-kotlin-maven-plugin</artifactId>
@@ -448,5 +417,4 @@ GraphQL schema.
448417
</dependency>
449418
</dependencies>
450419
</plugin>
451-
452420
```

0 commit comments

Comments
 (0)