Skip to content

Commit

Permalink
chore: start v8 development (#1951)
Browse files Browse the repository at this point in the history
### 📝 Description

Bumps the gradle version to 8.0.0-SNAPSHOT and cuts the v7 docs. 

Files of interest are `gradle.properties` (bumps lib version) and
`website/docusaurus.config.js` + `website/versions.json` (which cuts new
v8 version but still point to v7 as current).

All the docs under `website/versioned_docs/*` and
`website/versioned_sidebars/version-7.x.x-sidebars.json` were auto
generated by docusaurus when cutting v7 version. `website/docs` are now
source of the v8 docs.

### 🔗 Related Issues
  • Loading branch information
dariuszkuc authored Apr 12, 2024
1 parent 90398d7 commit e8b2265
Show file tree
Hide file tree
Showing 80 changed files with 10,036 additions and 4 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 = 7.0.0-SNAPSHOT
version = 8.0.0-SNAPSHOT

# build config
org.gradle.caching=true
Expand Down
6 changes: 3 additions & 3 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: 'current',
lastVersion: '7.x.x',
showLastUpdateAuthor: true,
showLastUpdateTime: true,
sidebarPath: require.resolve('./sidebars.js'),
versions: {
current: {
label: '7.x.x',
path: ''
label: 'pre-release',
path: '8.x.x'
}
}
}
Expand Down
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.
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-7.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-7.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 e8b2265

Please sign in to comment.