Skip to content

Commit

Permalink
chore: start v9 development (#2041)
Browse files Browse the repository at this point in the history
### 📝 Description
Bumps the gradle version to 9.0.0-SNAPSHOT and cuts the v8 docs.

Co-authored-by: Samuel Vazquez <samvazquez@expediagroup.com>
  • Loading branch information
samuelAndalon and Samuel Vazquez authored Oct 2, 2024
1 parent dd3ad23 commit 1dbdf28
Show file tree
Hide file tree
Showing 81 changed files with 10,976 additions and 526 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = com.expediagroup
version = 8.0.0-SNAPSHOT
version = 9.0.0-SNAPSHOT

# build config
org.gradle.caching=true
Expand Down
4 changes: 2 additions & 2 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ module.exports = {
{
docs: {
editUrl: "https://github.com/ExpediaGroup/graphql-kotlin/tree/master/website",
lastVersion: '7.x.x',
lastVersion: '8.x.x',
showLastUpdateAuthor: true,
showLastUpdateTime: true,
sidebarPath: require.resolve('./sidebars.js'),
versions: {
current: {
label: 'pre-release',
path: '8.x.x'
path: '9.x.x'
}
}
}
Expand Down
1,534 changes: 1,014 additions & 520 deletions website/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"swizzle": "docusaurus swizzle"
},
"dependencies": {
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@docusaurus/theme-mermaid": "^3.4.0"
"@docusaurus/core": "^3.5.2",
"@docusaurus/preset-classic": "^3.5.2",
"@docusaurus/theme-mermaid": "^3.5.2"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions website/versioned_docs/version-8.x.x/blogs-and-videos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
id: blogs-and-videos
title: Blogs & Videos
---
Here are some links to other blog posts and videos which may provide further examples and reading.

## graphql-kotlin

Articles and videos specifically about `graphql-kotlin`

- 📺  [Supercharge your GraphQL with Ktor and GraalVM (Dariusz Kuc)(KotlinConf 2023)](https://www.youtube.com/watch?v=gqQwTFeHOUU&list=PLlFc5cFwUnmwcJ7ZXyMmS70A9QFyUu1HI) (en)
- 📝  [GraphQL Kotlin 6.0.0 Release](https://medium.com/expedia-group-tech/graphql-kotlin-6-0-0-release-2227fd066dcd)
- 📝  [GraphQL Kotlin 4.0.0 Release](https://medium.com/expedia-group-tech/graphql-kotlin-4-0-0-release-eb87e150a192)
- 📺  [Bootiful GraphQL with Kotlin (Dariusz Kuc, Guillaume Scheibel)(Spring One 2020)](https://www.youtube.com/watch?v=t9He4vHZC24) (en)
- 📺  [Bootiful GraphQL with Kotlin (Dariusz Kuc)(GOTO Chicago 2020)](https://www.youtube.com/watch?v=1siPT1pTXFU) (en)
- 📝  [Introducing GraphQL Kotlin Client](https://medium.com/expedia-group-tech/introducing-graphql-kotlin-client-b32dc3061a6f)
- 📝  [Announcing graphql-kotlin 2.0!](https://medium.com/expedia-group-tech/graphql-kotlin-2-0-4006ea41f774)
- 📺  [Bootiful GraphQL with Kotlin (Dariusz Kuc, Guillaume Scheibel)(KotlinConf 2019)](https://www.youtube.com/watch?v=7YJyPXjLdug&index=25) (en)
- 📝  [Creating a Reactive GraphQL Server with Spring Boot and Kotlin](https://medium.com/expedia-group-tech/creating-a-reactive-graphql-server-with-spring-boot-and-kotlin-54aca7316470)
- 📝  [Apollo Federation in a GraphQL Kotlin Server](https://medium.com/expedia-group-tech/apollo-federation-in-a-graphql-kotlin-server-115cea51607a)
- 📝  [Creating GraphQL Schemas in Kotlin](https://medium.com/expedia-group-tech/creating-graphql-schemas-in-kotlin-aaaac0ab0672)
- 📝  [Release of graphql-kotlin 1.0.0!](https://medium.com/expedia-group-tech/release-of-graphql-kotlin-1-0-0-791ad85d3116)
- 📝  [graphql-kotlin: Generate a GraphQL schema from Kotlin code](https://medium.com/expedia-group-tech/graphql-kotlin-generate-a-graphql-schema-from-kotlin-code-21d1dc2f6e27)

## GraphQL

Articles and videos about how Expedia Group is using GraphQL

- 📝  [Expedia Group Case Study: Bootiful APIs With GraphQL and Kotlin](https://kotlinlang.org/lp/server-side/case-studies/expedia)
- 📝  [Expedia Group Transforms Product Development with Apollo](https://www.apollographql.com/customers/expediagroup/)
- 📺  [Creating a federated schema for a global company (Shane Myrick)](https://youtu.be/MuD3TAP0D9Y) (en)
- 📺  [Migrer ses APIs vers GraphQL: pourquoi? comment! (Guillaume Scheibel)](https://youtu.be/IRIkpvJo95s) (fr)
- 📺  [Migrate your APIs to GraphQL: how? and why! (Guillaume Scheibel)](https://youtu.be/IkPMpzQ-TRI) (en)
- 📺  [Transforming customer experiences and your organization with GraphQL (Jim Gust, Dan Boerner)](https://youtu.be/Jt-ZD4zj4Ow) (en)
126 changes: 126 additions & 0 deletions website/versioned_docs/version-8.x.x/client/client-customization.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
id: client-customization
title: Client Customization
---


import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Ktor HTTP Client Customization

`GraphQLKtorClient` is a thin wrapper on top of [Ktor HTTP Client](https://ktor.io/docs/client.html) and supports fully
asynchronous non-blocking communication. It is highly customizable and can be configured with any supported Ktor HTTP
[engine](https://ktor.io/clients/http-client/engines.html) and [features](https://ktor.io/clients/http-client/features.html).

See [Ktor HTTP Client documentation](https://ktor.io/clients/index.html) for additional details.

### Global Client Customization

A single instance of `GraphQLKtorClient` can be used to handle many GraphQL operations. You can specify a custom instance
of Ktor `HttpClient` and a target `GraphQLClientSerializer`.

The below example configures a new `GraphQLKtorClient` to use the `OkHttp` engine with custom timeouts, adds a default `X-MY-API-KEY`
header to all requests, and enables basic logging of the requests.

```kotlin
val okHttpClient = HttpClient(engineFactory = OkHttp) {
engine {
config {
connectTimeout(10, TimeUnit.SECONDS)
readTimeout(60, TimeUnit.SECONDS)
writeTimeout(60, TimeUnit.SECONDS)
}
}
defaultRequest {
header("X-MY-API-KEY", "someSecretApiKey")
}
install(Logging) {
logger = Logger.DEFAULT
level = LogLevel.INFO
}
}
val client = GraphQLKtorClient(
url = URL("http://localhost:8080/graphql"),
httpClient = okHttpClient
)
```

### Per Request Customization

Individual GraphQL requests can be customized through [HttpRequestBuilder](https://ktor.io/docs/request.html#customizing-requests).
You can use this mechanism to specify custom headers, update target url to include custom query parameters, configure
attributes that can be accessed from the pipeline features as well specify timeouts per request.

```kotlin
val helloWorldQuery = HelloWorldQuery(variables = HelloWorldQuery.Variables(name = "John Doe"))
val result = client.execute(helloWorldQuery) {
header("X-B3-TraceId", "0123456789abcdef")
}
```

## Spring WebClient Customization

`GraphQLWebClient` is a thin wrapper on top of [Spring WebClient](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/reactive/function/client/WebClient.html)
that relies on Reactor Netty for fully asynchronous non-blocking communications. If you want to use Jetty instead you will
need to exclude provided `io.projectreactor.netty:reactor-netty` dependency and instead add `org.eclipse.jetty:jetty-reactive-httpclient`
dependency.

### Global Client Customization

A single instance of `GraphQLWebClient` can be used to handle many GraphQL operations and you can customize it by providing
a custom instance of `WebClient.Builder`. See [Spring documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-webclient-customization)
for additional details.

Example below configures `GraphQLWebClient` with custom timeouts and adds a default `X-MY-API-KEY` header to all requests.

```kotlin
val httpClient: HttpClient = HttpClient.create()
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000)
.responseTimeout(Duration.ofMillis(10_000))
val connector: ClientHttpConnector = ReactorClientHttpConnector(httpClient.wiretap(true))
val webClientBuilder = WebClient.builder()
.clientConnector(connector)
.defaultHeader("X-MY-API-KEY", "someSecretApiKey")

val client = GraphQLWebClient(
url = "http://localhost:8080/graphql",
builder = webClientBuilder
)
```

### Per Request Customization

Individual GraphQL requests can be customized by providing `WebClient.RequestBodyUriSpec` lambda. You can use this mechanism
to specify custom headers or include custom attributes or query parameters.

```kotlin
val helloWorldQuery = HelloWorldQuery(variables = HelloWorldQuery.Variables(name = "John Doe"))
val result = client.execute(helloWorldQuery) {
header("X-B3-TraceId", "0123456789abcdef")
}
```

## Custom GraphQL Client

GraphQL Kotlin libraries provide generic a `GraphQLClient` interface as well as Ktor HTTP Client and Spring WebClient based
reference implementations. Both `GraphQLKtorClient` and `GraphQLWebClient` are open classes which means you can also
extend them to provide some custom `execute` logic.

```kotlin
class CustomGraphQLClient(url: URL) : GraphQLKtorClient(url = url) {

override suspend fun <T: Any> execute(request: GraphQLClientRequest<T>, requestCustomizer: HttpRequestBuilder.() -> Unit): GraphQLClientResponse<T> {
// custom init logic
val result = super.execute(request, requestCustomizer)
// custom finalize logic
return result
}
}
```

## Deprecated Field Usage

Build plugins will automatically fail generation of a client if any of the specified query files are referencing
deprecated fields. This ensures that your clients have to explicitly opt-in into deprecated usage by specifying
`allowDeprecatedFields` configuration option.
Loading

0 comments on commit 1dbdf28

Please sign in to comment.