Skip to content

Commit 9bfb06f

Browse files
smyrickbrennantaylor
authored andcommitted
Update README.md (#186)
1 parent a829cdc commit 9bfb06f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Javadocs](https://img.shields.io/maven-central/v/com.expedia/graphql-kotlin.svg?label=javadoc&colorB=brightgreen)](https://www.javadoc.io/doc/com.expedia/graphql-kotlin)
77
[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)
88

9-
Most GraphQL libraries for the JVM require developers to maintain two sources of truth for their GraphQL API, the schema and the corresponding code (data fetchers and types). Given the similarities between Kotlin and GraphQL, such as the ability to define nullable/non-nullable types, a schema should be able to be generated from Kotlin code without any separate schema specification. `graphql-kotlin` builds upon `graphql-java` to allow code-only GraphQL services to be built.
9+
Most GraphQL libraries require developers to maintain two sources of truth for their GraphQL API: the schema and the corresponding code (data fetchers or resolvers, and types). Given the similarities between Kotlin and GraphQL, such as the ability to define nullable/non-nullable types, a schema can be generated from Kotlin code without any separate schema specification. `graphql-kotlin` builds upon `graphql-java` to allow code-only, or resolver-first, GraphQL services to be built.
1010

1111
For information on GraphQL, please visit [the GraphQL website](https://graphql.org/).
1212

@@ -40,7 +40,7 @@ compile(group: 'com.expedia', name: 'graphql-kotlin', version: "$latestVersion")
4040

4141
data class Widget(val id: Int, val value: String)
4242

43-
class WidgetQuery {
43+
class WidgetService {
4444
fun widgetById(id: Int): Widget? {
4545
// grabs widget from a data source, might return null
4646
}
@@ -51,19 +51,19 @@ class WidgetQuery {
5151
}
5252
}
5353

54-
class WidgetMutation {
54+
class WidgetUpdater {
5555
fun saveWidget(value: String): Widget {
56-
// Create and save new widget, returns non-null
56+
// Create and save a new widget, returns non-null
5757
}
5858
}
5959

6060
// Generate the schema
6161

62-
val config = SchemaGeneratorConfig(listOf("org.example"))
63-
val queries = listOf(TopLevelObject(WidgetQuery()))
64-
val mutations = listOf(TopLevelObject(WidgetMutation()))
62+
val config = SchemaGeneratorConfig(supportedPackages = listOf("org.example"))
63+
val queries = listOf(TopLevelObject(WidgetService()))
64+
val mutations = listOf(TopLevelObject(WidgetUpdater()))
6565

66-
toSchema(queries, mutations, config)
66+
toSchema(config, queries, mutations)
6767
```
6868

6969
will generate
@@ -92,7 +92,7 @@ type Widget {
9292

9393
## Documentation
9494

95-
There are more examples and documention in our [Wiki](https://github.com/ExpediaDotCom/graphql-kotlin/wiki) or you can view the [javadocs](https://www.javadoc.io/doc/com.expedia/graphql-kotlin) for all published versions
95+
There are more examples and documention in our [Wiki](https://github.com/ExpediaDotCom/graphql-kotlin/wiki) or you can view the [javadocs](https://www.javadoc.io/doc/com.expedia/graphql-kotlin) for all published versions.
9696

9797
If you have a question about something you can not find in our wiki or javadocs, feel free to [create an issue](https://github.com/ExpediaDotCom/graphql-kotlin/issues) and tag it with the question label.
9898

0 commit comments

Comments
 (0)