Skip to content

Commit 7eb5d85

Browse files
authored
Update READMEs and example docs (#609)
Scan through some of our documentation and update gramar and provide some more details where needed
1 parent 9f0c278 commit 7eb5d85

File tree

11 files changed

+3964
-2895
lines changed

11 files changed

+3964
-2895
lines changed

README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
# GraphQL Kotlin
22

3-
[![Build Status](https://github.com/ExpediaGroup/graphql-kotlin/workflows/Continuous%20Integration/badge.svg)](https://expediagroup.github.io/graphql-kotlin)
3+
[![Build Status](https://github.com/ExpediaGroup/graphql-kotlin/workflows/Continuous%20Integration/badge.svg)](https://github.com/ExpediaGroup/graphql-kotlin/actions?query=workflow%3A%22Continuous+Integration%22)
4+
[![Docs](https://github.com/ExpediaGroup/graphql-kotlin/workflows/Publish%20Docs/badge.svg)](https://github.com/ExpediaGroup/graphql-kotlin/actions?query=workflow%3A%22Publish+Docs%22)
45
[![codecov](https://codecov.io/gh/ExpediaGroup/graphql-kotlin/branch/master/graph/badge.svg)](https://codecov.io/gh/ExpediaGroup/graphql-kotlin)
5-
[![Docs](https://github.com/ExpediaGroup/graphql-kotlin/workflows/Publish%20Docs/badge.svg)](https://expediagroup.github.io/graphql-kotlin)
66
[![Slack](https://img.shields.io/badge/Slack-%23graphql--kotlin-ECB22E.svg?logo=data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTQgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTkuNzEyLjEzM2E1LjM4MSA1LjM4MSAwIDAgMC01LjM3NiA1LjM4NyA1LjM4MSA1LjM4MSAwIDAgMCA1LjM3NiA1LjM4Nmg1LjM3NlY1LjUyQTUuMzgxIDUuMzgxIDAgMCAwIDE5LjcxMi4xMzNtMCA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uMzc2LTUuMzg2di01LjM4N0g1LjM3NkE1LjM4MSA1LjM4MSAwIDAgMCAwIDM0LjI1bTE0LjMzNi0uMDAxdjE0LjM2NEE1LjM4MSA1LjM4MSAwIDAgMCAxOS43MTIgNTRhNS4zODEgNS4zODEgMCAwIDAgNS4zNzYtNS4zODdWMzQuMjVhNS4zODEgNS4zODEgMCAwIDAtNS4zNzYtNS4zODcgNS4zODEgNS4zODEgMCAwIDAtNS4zNzYgNS4zODciIGZpbGw9IiNFMDFFNUEiLz48L2c+PC9zdmc+&labelColor=611f69)](https://kotlinlang.slack.com/messages/graphql-kotlin/)
7-
[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)
87

9-
GraphQL Kotlin consists of number of libraries that aim to simplify running a GraphQL server in Kotlin.
8+
GraphQL Kotlin is a collection of libraries built on top of [graphql-java](https://www.graphql-java.com/) that aim to simplify running a GraphQL server in Kotlin
109

1110
## 📦 Modules
1211

1312
* [graphql-kotlin-schema-generator](/graphql-kotlin-schema-generator) - Code only GraphQL schema generation for Kotlin
1413
* [graphql-kotlin-federation](/graphql-kotlin-federation) - Schema generator extension to build federated GraphQL schemas
15-
* [graphql-kotlin-spring-server](/graphql-kotlin-spring-server) - Spring Boot auto-configuration library to create GraphQL web app
14+
* [graphql-kotlin-spring-server](/graphql-kotlin-spring-server) - Spring Boot auto-configuration library to create a GraphQL web app
1615
* [examples](/examples) - Example apps that use graphql-kotlin libraries to test and demonstrate usages
1716

1817
## ⌨️ Usage
1918

20-
Below is a basic example of how `graphql-kotlin-schema-generator` converts your Kotlin code into a GraphQL schema. For more details, see our documentation below or in the individual module READMEs
19+
Below is a basic example of how [graphql-kotlin-schema-generator](/graphql-kotlin-schema-generator) converts your Kotlin code into a GraphQL schema. For more details, see our documentation below or in the individual module READMEs
2120

2221
```kotlin
23-
// Your existing Kotlin code
24-
2522
data class Widget(val id: Int, val value: String)
2623

2724
class WidgetService {
@@ -31,7 +28,6 @@ class WidgetService {
3128
}
3229

3330
// Generate the schema
34-
3531
val config = SchemaGeneratorConfig(supportedPackages = listOf("org.example"))
3632
val queries = listOf(TopLevelObject(WidgetService()))
3733

@@ -51,11 +47,30 @@ type Widget {
5147
}
5248
```
5349

50+
Then using [graphql-kotlin-spring-server](/graphql-kotlin-spring-server) you can easily make your schema available as a GraphQL server with Spring Boot.
51+
52+
```kotlin
53+
// Mark the class as a Spring GraphQL Query
54+
@Component
55+
class WidgetService : Query {
56+
fun widgetById(id: Int): Widget? {}
57+
}
58+
59+
@SpringBootApplication
60+
class Application
61+
62+
fun main(args: Array<String>) {
63+
runApplication<Application>(*args)
64+
}
65+
```
66+
5467
## 📋 Documentation
5568

56-
Examples and documentation are available on our [documentation](https://expediagroup.github.io/graphql-kotlin), or in each module README file.
69+
Examples and documentation are available on our [documentation site](https://expediagroup.github.io/graphql-kotlin) hosted in GitHub Pages.
70+
71+
If you have a question about something you can not find in our documentation, the indivdual module READMEs, or [javadocs](https://www.javadoc.io/doc/com.expediagroup/graphql-kotlin-schema-generator), feel free to [create an issue](https://github.com/ExpediaGroup/graphql-kotlin/issues) and tag it with the question label.
5772

58-
If you have a question about something you can not find in our documentation, the indivdual modules, or javadocs, feel free to [create an issue](https://github.com/ExpediaGroup/graphql-kotlin/issues) and tag it with the question label.
73+
If you would like to contribute to our documentation see the [website](/website) directory for more information.
5974

6075
## 👥 Contact
6176

examples/README.md

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

33
Example apps that use `graphql-kotlin` libraries to test and demonstrate usages.
44

5-
* [spring](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/spring) - This is a sample Spring Boot app that uses `graphql-kotlin-spring-server` to create reactive GraphQL web application. Please refer to the README file for details on how to run the target application.
6-
* [federation](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/federation) - Example Spring Boot apps generating Federated GraphQL schema and Apollo Gateway that exposes single federated schema are provided in examples/federation project. Please refer to their README files for details on how to run the target applications.
5+
* [spring](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/spring) - This is a sample Spring Boot app that uses `graphql-kotlin-spring-server` to create a reactive GraphQL web application. Please refer to the README file for details on how to run the application.
6+
* [federation](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/federation) - Example Spring Boot apps generating federated GraphQL schemas and an Apollo Gateway in NodeJS that exposes the merged federated schema. Please refer to the README files for details on how to run each federated service.

examples/federation/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# Federation Example
22

33
This example is two Spring applications `base-app` and `extend-app` that use `graphql-kotlin-federation` to generate the schema.
4-
These apps run on different ports (`8080`, `8081`) so they can run simultaniously
4+
These apps run on different ports (`8080`, `8081`) so they can run simultaniously.
55

6-
Then the `gateway` is a Node.js app running Apollo Gateway on port `4000` and connects to the two spring apps.
7-
You can make queries against the spring apps directly or combined queries from the gateway.
6+
The `gateway` is a Node.js app running Apollo Gateway on port `4000` and connects to the two Spring apps.
7+
You can make queries against the Spring apps directly or run combined queries from the gateway.
88

99
## Running Locally
1010

1111

1212
### Spring Apps
13-
Build the spring applications by running the following commands in the `/federation` directory
13+
Build the Spring applications by running the following commands in the `/federation` directory
1414

1515
```shell script
1616
./gradlew clean build
1717
```
1818

19+
> NOTE: in order to ensure you use the right version of Gradle we highly recommend to use the provided wrapper scripts
20+
1921
Start the servers:
2022

2123
* Run each `Application.kt` directly from your IDE
@@ -26,10 +28,10 @@ Start the servers:
2628
```
2729

2830

29-
Once the app has started you can explore the example schema by opening Playground endpoint
31+
Once the app has started you can explore the example schema by opening the Playground endpoint
3032
* `base-app` http://localhost:8080/playground
3133
* `extend-app` http://localhost:8081/playground
3234

3335
### Gateway
3436

35-
See the instructions in the [README](./gateway/README.md) for this folder
37+
See the instructions in the gateway [README](./gateway/README.md)

examples/federation/gateway/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
/node_modules
44
/build
55
/logs
6-
76
*.log
7+
yarn.lock

examples/federation/gateway/.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.9.1
1+
12

examples/federation/gateway/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Apollo Federation
22

3-
This is a simple Apollo Federation Gateway. For more info see the Apollo docs
3+
This is a simple Apollo Federation Gateway server. For more info see the Apollo docs
44

55
https://www.apollographql.com/docs/apollo-server/federation/introduction/
66

77
## Setup
88

9-
Install the correct version of Node and have yarn installed locally
9+
Install the correct version of Node locally. You can also use [nvm](https://github.com/nvm-sh/nvm)
1010

1111
```shell script
1212
nvm i
1313
```
1414

1515
```shell script
16-
yarn install
16+
npm install
1717
```
1818

1919
Then start the other applications
@@ -23,5 +23,5 @@ Then start the other applications
2323

2424
Then you can start the gateway
2525
```shell script
26-
yarn start
26+
npm start
2727
```

examples/federation/gateway/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
const { ApolloServer } = require("apollo-server");
18-
const { ApolloGateway, RemoteGraphQLDataSource } = require("@apollo/gateway");
18+
const { ApolloGateway } = require("@apollo/gateway");
1919

2020
const server = new ApolloServer({
2121
gateway: new ApolloGateway({

0 commit comments

Comments
 (0)