You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Simplfy repeated information in the docs
* Remove expedia specific lockfile
* PR comments
* Reorder main gettings started sections
* Update registry to public npm
* Move npmrc to specific npm folders
Co-authored-by: Shane Myrick <[email protected]>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ Further instructions on how to add documentation content are in `website/README.
63
63
All source files must contain the following license header. If you are using an IDE please add this as a copyright template for this project so that it will be added automatically.
64
64
65
65
```
66
-
Copyright 2020 Expedia, Inc
66
+
Copyright ${today.year} Expedia, Inc
67
67
68
68
Licensed under the Apache License, Version 2.0 (the "License");
69
69
you may not use this file except in compliance with the License.
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
8
+
GraphQL Kotlin is a collection of libraries, built on top of [graphql-java](https://www.graphql-java.com/), that aim to simplify running GraphQL in Kotlin
9
9
10
10
## 📦 Modules
11
11
@@ -19,25 +19,27 @@ GraphQL Kotlin is a collection of libraries built on top of [graphql-java](https
19
19
20
20
## ⌨️ Usage
21
21
22
-
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
22
+
Below is a basic example of how you can use [graphql-kotlin-spring-server](/graphql-kotlin-spring-server) to run a GraphQL server. For more details, see our documentation below or in the individual module READMEs
23
23
24
24
```kotlin
25
+
// Simple data class that is parsed by the schema generator
25
26
data classWidget(valid:Int, valvalue:String)
26
27
27
-
classWidgetService {
28
-
funwidgetById(id:Int): Widget? {
29
-
// grabs widget from a data source, might return null
30
-
}
28
+
// Mark the class as a Spring GraphQL Query
29
+
@Component
30
+
classWidgetService : Query {
31
+
funwidgetById(id:Int): Widget?=null
31
32
}
32
33
33
-
// Generate the schema
34
-
val config =SchemaGeneratorConfig(supportedPackages =listOf("org.example"))
35
-
val queries =listOf(TopLevelObject(WidgetService()))
34
+
@SpringBootApplication
35
+
classApplication
36
36
37
-
toSchema(config, queries)
37
+
funmain(args:Array<String>) {
38
+
runApplication<Application>(*args)
39
+
}
38
40
```
39
41
40
-
will generate
42
+
will generate a server at `/graphql` and `/playground` with the following schema
41
43
42
44
```graphql
43
45
typeQuery {
@@ -50,23 +52,6 @@ type Widget {
50
52
}
51
53
```
52
54
53
-
Thenusing [graphql-kotlin-spring-server](/graphql-kotlin-spring-server) youcaneasilymakeyourschema available as a GraphQL server with Spring Boot.
* Wealsohaveapublicchannel, ([#graphql-kotlin](https://app.slack.com/client/T09229ZC6/CQLNT7B29)), open on the Kotlin Slack instance. See the info [here on how to join this slack instance](https://slack.kotlinlang.org/)
89
74
90
75
## ✏️ Contributing
@@ -98,5 +83,9 @@ To get started, please fork the repo and checkout a new branch. You can then bui
98
83
99
84
See more info in [CONTRIBUTING.md](CONTRIBUTING.md)
100
85
86
+
## 🛡️ Security
87
+
88
+
Formoreinfoonhowtocontacttheteamforsecurityissuesorthesupportedversionsthatrecievesecurityupdates, see [SECURITY.md](./github/SECURITY.md).
89
+
101
90
## ⚖️ License
102
91
Thislibraryislicensedunderthe [ApacheLicense, Version 2.0](LICENSE)
Copy file name to clipboardExpand all lines: docs/blogs-and-videos.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,8 @@ Articles and videos specifically about `graphql-kotlin`
16
16
* 📝 [Apollo Federation in a GraphQL Kotlin Server](https://medium.com/expedia-group-tech/apollo-federation-in-a-graphql-kotlin-server-115cea51607a)
17
17
* 📝 [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)
Copy file name to clipboardExpand all lines: docs/examples.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,12 @@ id: examples
3
3
title: Examples
4
4
---
5
5
6
+
A collection of example apps that use graphql-kotlin libraries to test and demonstrate usages can be found in the [examples module](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples).
7
+
8
+
## Client Example
9
+
10
+
A `graphql-kotlin-client` can be generated using the Maven and Gradle plugins in `graphql-kotlin-plugins`. For examples see the [examples/client](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/client) folder.
11
+
6
12
## Spring Server Example
7
13
8
14
One way to run a GraphQL server is with [Spring Boot](https://github.com/spring-projects/spring-boot). A sample Spring
Copy file name to clipboardExpand all lines: docs/getting-started.md
+22-72Lines changed: 22 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,20 +3,22 @@ id: getting-started
3
3
title: Getting Started
4
4
---
5
5
6
-
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
6
+
GraphQL Kotlin is a collection of libraries, built on top of [graphql-java](https://www.graphql-java.com/), that aim to simplify running GraphQL in Kotlin
generates a `GraphQLSchema` with IDL that looks like this:
55
+
## Generating a Schema
68
56
69
-
```graphql
70
-
schema {
71
-
query: Query
72
-
}
57
+
While we have included a server implementation, you can use `graphql-kotlin-schema-generator` to generate a schema from Kotlin code and expose it with any server library.
73
58
74
-
typeQuery {
75
-
getNumber: Int!
76
-
}
77
-
```
59
+
See the docs in [Schema Generator Getting Started](./schema-generator/schema-generator-getting-started.md).
78
60
79
-
The `GraphQLSchema` generatedcanbeusedtoexposeaGraphQLAPIendpoint.
61
+
### Federation
80
62
81
-
### `toSchema`
63
+
Using `graphql-kotlin-federation`, you can generate an [Apollo Federation](https://www.apollographql.com/docs/apollo-server/federation/federation-spec/) complaint schema.
82
64
83
-
Thisfunctionacceptsfourarguments: `config`, `queries`, `mutations` and `subscriptions`. The `queries`, `mutations`
84
-
and `subscriptions` arealistof `TopLevelObject`sandwillbeusedtogeneratecorrespondingGraphQLroottypes. See
85
-
belowonwhyweusethiswrapperclass. The `config` containsalltheextrainformationyouneedtopass, including
`graphql-kotlin-spring-server` is a combination of the schemagenerator, fedeation, and server libraries. If you are looking to run a GraphQL server, this is the place to start.
90
69
91
-
### Class `TopLevelObject`
70
+
See the docs in [Spring Server Overview](./spring-server/spring-overview.md).
92
71
93
-
`toSchema` usesKotlinreflectiontobuildaGraphQLschema from given classes using `graphql-java`'s schema builder. We
94
-
don't just pass a `KClass` though, we have to actually pass an object, because the functions on the object are
95
-
transformed into the data fetchers. In most cases, a `TopLevelObject` can be constructed with just an object:
72
+
## Creating a Client
73
+
`graphql-kotlin-plugins` can be used to generate a `graphql-kotlin-client` from an existing schema that is easy to use and type-safe.
0 commit comments