Skip to content

Commit 245b457

Browse files
authored
Update the docs with general changes (#1113)
1 parent da0e821 commit 245b457

File tree

24 files changed

+133
-211
lines changed

24 files changed

+133
-211
lines changed

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
In order to [release a new version](https://github.com/ExpediaDotCom/graphql-kotlin/releases) we simply need to draft a new release
1+
In order to [release a new version](https://github.com/ExpediaDotCom/graphql-kotlin/releases) we need to draft a new release
22
and tag the commit. Releases are following [semantic versioning](https://semver.org/) and specify major, minor and patch version.
33

44
Once release is published it will trigger corresponding [Github Action](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/.github/workflows/release.yml)

generator/graphql-kotlin-federation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ See more
1515

1616
## Installation
1717

18-
Using a JVM dependency manager, simply link `graphql-kotlin-federation` to your project.
18+
Using a JVM dependency manager, link `graphql-kotlin-federation` to your project.
1919

2020
With Maven:
2121

generator/graphql-kotlin-schema-generator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For information on `graphql-java`, please visit [GraphQL Java](https://www.graph
1010

1111
## Installation
1212

13-
Using a JVM dependency manager, simply link `graphql-kotlin-schema-generator` to your project.
13+
Using a JVM dependency manager, link `graphql-kotlin-schema-generator` to your project.
1414

1515
With Maven:
1616

servers/graphql-kotlin-server/src/main/kotlin/com/expediagroup/graphql/server/extensions/dataFetchingEnvironmentExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import graphql.schema.DataFetchingEnvironment
2121
import java.util.concurrent.CompletableFuture
2222

2323
/**
24-
* Helper method to simply get a value from a registered DataLoader.
24+
* Helper method to get a value from a registered DataLoader.
2525
* The provided key should be the cache key object used to save the value for that particular data loader.
2626
*/
2727
fun <K, V> DataFetchingEnvironment.getValueFromDataLoader(dataLoaderName: String, key: K): CompletableFuture<V> {

servers/graphql-kotlin-spring-server/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## Installation
99

10-
Using a JVM dependency manager, simply link `graphql-kotlin-spring-server` to your project.
10+
Using a JVM dependency manager, link `graphql-kotlin-spring-server` to your project.
1111

1212
With Maven:
1313

@@ -35,7 +35,7 @@ graphql:
3535
- "com.your.package"
3636
```
3737
38-
In order to expose your queries, mutations and subscriptions in the GraphQL schema you simply need to implement corresponding marker interfaces and they will be automatically picked up by `graphql-kotlin-spring-server` autoconfiguration library.
38+
In order to expose your queries, mutations and subscriptions in the GraphQL schema you need to implement corresponding marker interfaces and they will be automatically picked up by `graphql-kotlin-spring-server` autoconfiguration library.
3939

4040
```kotlin
4141
@Component
-52.3 KB
Loading

website/docs/getting-started.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GraphQL Kotlin is a collection of libraries, built on top of [graphql-java](http
1111

1212
## Installation
1313

14-
Using a JVM dependency manager, simply link any `graphql-kotlin-*` library to your project.
14+
Using a JVM dependency manager, link any `graphql-kotlin-*` library to your project.
1515

1616
<Tabs
1717
defaultValue="gradle"
@@ -45,13 +45,13 @@ implementation("com.expediagroup", "graphql-kotlin-spring-server", latestVersion
4545

4646
You can use `graphql-kotlin-schema-generator` to generate a schema from Kotlin code and expose it with any server library.
4747

48-
See the docs in [Schema Generator Getting Started](./schema-generator/schema-generator-getting-started.md).
48+
See the docs in [Schema Generator Getting Started](./schema-generator/schema-generator-getting-started.mdx).
4949

5050
### Apollo Federation
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](./schema-generator/federation/apollo-federation.md).
54+
See the docs in [Apollo Federation](./schema-generator/federation/apollo-federation.mdx).
5555

5656
## Running a Server
5757

website/docs/schema-generator/customizing-schemas/advanced-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Advanced Features
55
## Adding Custom Additional Types
66

77
There are a couple ways you can add more types to the schema without having them be directly consumed by a type in your schema.
8-
This may be required for [Apollo Federation](../federation/apollo-federation.md), or maybe adding other interface implementations that are not picked up.
8+
This may be required for [Apollo Federation](../federation/apollo-federation.mdx), or maybe adding other interface implementations that are not picked up.
99

1010
### `SchemaGenerator::generateSchema`
1111

website/docs/schema-generator/execution/contextual-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ it is just used to inform the schema generator that this is the class that shoul
2323
class MyGraphQLContext(val customValue: String) : GraphQLContext
2424
```
2525

26-
Then you can just use the class as an argument and it will be automatically injected during execution time.
26+
Then, you can use the class as an argument and it will be automatically injected during execution time.
2727

2828
```kotlin
2929
class ContextualQuery : Query {

website/docs/schema-generator/federation/apollo-federation.md renamed to website/docs/schema-generator/federation/apollo-federation.mdx

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
id: apollo-federation
33
title: Apollo Federation
44
---
5+
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
59
In many cases, exposing single GraphQL API that exposes unified view of all the available data provides tremendous value
610
to their clients. As the underlying graph scales, managing single monolithic GraphQL server might become less and less
711
feasible making it much harder to manage and leading to unnecessary bottlenecks. Migrating towards federated model with
@@ -17,27 +21,35 @@ gateway level.
1721

1822
## Install
1923

20-
Using a JVM dependency manager, simply link `graphql-kotlin-federation` to your project.
24+
Using a JVM dependency manager, link `graphql-kotlin-federation` to your project.
2125

22-
With Maven:
26+
<Tabs
27+
defaultValue="gradle"
28+
values={[
29+
{ label: 'Gradle Kotlin', value: 'gradle' },
30+
{ label: 'Maven', value: 'maven' }
31+
]
32+
}>
2333

24-
```xml
34+
<TabItem value="gradle">
2535

26-
<dependency>
27-
<groupId>com.expediagroup</groupId>
28-
<artifactId>graphql-kotlin-federation</artifactId>
29-
<version>${latestVersion}</version>
30-
</dependency>
36+
```kotlin
37+
implementation("com.expediagroup", "graphql-kotlin-federation", latestVersion)
38+
```
3139

32-
```
40+
</TabItem>
41+
<TabItem value="maven">
3342

34-
With Gradle:
43+
```xml
44+
<dependency>
45+
<groupId>com.expediagroup</groupId>
46+
<artifactId>graphql-kotlin-federation</artifactId>
47+
<version>${latestVersion}</version>
48+
</dependency>
49+
```
3550

36-
```kotlin
37-
38-
implementation("com.expediagroup", "graphql-kotlin-federation", latestVersion)
39-
40-
```
51+
</TabItem>
52+
</Tabs>
4153

4254
## Usage
4355

@@ -46,7 +58,7 @@ compliant schemas.
4658

4759
### `toFederatedSchema`
4860

49-
Just like the basic [toSchema](../schema-generator-getting-started.md), `toFederatedSchema` accepts four parameters: `config`, `queries`, `mutations` and `subscriptions`.
61+
Just like the basic [toSchema](../schema-generator-getting-started.mdx), `toFederatedSchema` accepts four parameters: `config`, `queries`, `mutations` and `subscriptions`.
5062
The difference is that the `config` class is of type [FederatedSchemaGeneratorConfig](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/generator/graphql-kotlin-federation/src/main/kotlin/com/expediagroup/graphql/generator/federation/FederatedSchemaGeneratorConfig.kt).
5163
This class extends the [base configuration class](../customizing-schemas/generator-config.md) and adds some default logic. You can override the logic if needed, but do so with caution as you may no longer generate a spec compliant schema.
5264

website/docs/schema-generator/schema-generator-getting-started.md renamed to website/docs/schema-generator/schema-generator-getting-started.mdx

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
11
---
22
id: schema-generator-getting-started
3-
title: Getting Started with the Schema Generator
3+
title: Getting Started
44
---
5-
## Install
6-
7-
Using a JVM dependency manager, simply link `graphql-kotlin-schema-generator` to your project.
85

9-
With Maven:
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
108

11-
```xml
9+
## Install
1210

13-
<dependency>
14-
<groupId>com.expediagroup</groupId>
15-
<artifactId>graphql-kotlin-schema-generator</artifactId>
16-
<version>${latestVersion}</version>
17-
</dependency>
11+
Using a JVM dependency manager, link `graphql-kotlin-schema-generator` to your project.
1812

19-
```
13+
<Tabs
14+
defaultValue="gradle"
15+
values={[
16+
{ label: 'Gradle Kotlin', value: 'gradle' },
17+
{ label: 'Maven', value: 'maven' }
18+
]
19+
}>
2020

21-
With Gradle:
21+
<TabItem value="gradle">
2222

2323
```kotlin
24-
2524
implementation("com.expediagroup", "graphql-kotlin-schema-generator", latestVersion)
25+
```
2626

27+
</TabItem>
28+
<TabItem value="maven">
29+
30+
```xml
31+
<dependency>
32+
<groupId>com.expediagroup</groupId>
33+
<artifactId>graphql-kotlin-schema-generator</artifactId>
34+
<version>${latestVersion}</version>
35+
</dependency>
2736
```
2837

38+
</TabItem>
39+
</Tabs>
40+
2941
## Usage
3042

3143
`graphql-kotlin-schema-generator` provides a single function, `toSchema`, to generate a schema from Kotlin objects.
3244

3345
```kotlin
34-
3546
data class Widget(val id: Int, val value: String)
3647

3748
class WidgetQuery {
@@ -53,13 +64,11 @@ val schema = toSchema(
5364
queries = listOf(TopLevelObject(widgetQuery)),
5465
mutations = listOf(TopLevelObject(widgetMutation))
5566
)
56-
5767
```
5868

5969
will generate:
6070

6171
```graphql
62-
6372
schema {
6473
query: Query
6574
mutation: Mutation
@@ -77,7 +86,6 @@ type Widget {
7786
id: Int!
7887
value: String!
7988
}
80-
8189
```
8290

8391
Any `public` functions defined on a query, mutation, or subscription Kotlin class will be translated into GraphQL fields on the object
@@ -96,42 +104,39 @@ custom hooks, supported packages, and name overrides. See the [Generator Configu
96104
You can see the definition for `toSchema` [in the
97105
source](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/toSchema.kt)
98106

99-
## Class `TopLevelObject`
107+
## `TopLevelObject`
100108

101109
`toSchema` uses Kotlin reflection to build a GraphQL schema from given classes using `graphql-java`'s schema builder. We
102110
don't just pass a `KClass` though, we have to actually pass an object, because the functions on the object are
103111
transformed into the data fetchers. In most cases, a `TopLevelObject` can be constructed with just an object:
104112

105113
```kotlin
106-
107114
class Query {
108115
fun getNumber() = 1
109116
}
110117

111118
val topLevelObject = TopLevelObject(Query())
112119

113120
toSchema(config = config, queries = listOf(topLevelObject))
114-
115121
```
116122

117123
In the above case, `toSchema` will use `topLevelObject::class` as the reflection target, and `Query` as the data fetcher
118124
target.
119125

126+
127+
### Dynamic `TopLevelObject`
120128
In a lot of cases, such as with Spring AOP, the object (or bean) being used to generate a schema is a dynamic proxy. In
121129
this case, `topLevelObject::class` is not `Query`, but rather a generated class that will confuse the schema generator.
122130
To specify the `KClass` to use for reflection on a proxy, pass the class to `TopLevelObject`:
123131

124132
```kotlin
125-
126133
@Component
127134
class Query {
128-
@Timed
129135
fun getNumber() = 1
130136
}
131137

132138
val query = getObjectFromBean()
133139
val customDef = TopLevelObject(query, Query::class)
134140

135141
toSchema(config, listOf(customDef))
136-
137142
```

website/docs/server/spring-server/spring-beans.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ Many of the beans are conditionally created and the default behavior can be cust
1616

1717
## Non-Federated Schema
1818

19-
_Created only if federation is disabled_
19+
:::note
20+
21+
_Created only if federation is **disabled**_
22+
23+
:::
2024

2125
| Bean | Description |
2226
| :-------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -25,7 +29,11 @@ _Created only if federation is disabled_
2529

2630
## Federated Schema
2731

28-
_Created only if federation is enabled_
32+
:::note
33+
34+
_Created only if federation is **enabled**_
35+
36+
:::
2937

3038
| Bean | Description |
3139
| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -50,8 +58,12 @@ _Created only if federation is enabled_
5058

5159
## Subscriptions
5260

61+
:::note
62+
5363
_Created only if the `Subscription` marker interface is used_
5464

65+
:::
66+
5567
| Bean | Description |
5668
| :-------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5769
| SpringGraphQLSubscriptionHandler | Spring reactor code for executing GraphQL subscriptions requests |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
id: spring-http-request-response
3+
title: HTTP Request and Response
4+
---
5+
6+
To access the HTTP request and response methods, use [Spring WebFilter](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/server/WebFilter.html).
7+
From these filters you can modify the request and response, both before and after the GraphQL execution.

0 commit comments

Comments
 (0)