Skip to content

Commit b5cba8b

Browse files
smyrickdariuszkuc
authored andcommitted
Add usage in the main README (ExpediaGroup#343)
Add some more details in the main README to align with the Expedia Group OSS templates and provide some more details to first time viewers. Also update the CONTRIBUTING doc with more details
1 parent 74d301e commit b5cba8b

File tree

2 files changed

+79
-10
lines changed

2 files changed

+79
-10
lines changed

CONTRIBUTING.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
# Contributing
1+
# How To Contribute
22

3-
`graphql-kotlin` is open source and welcomes contributions. We do ask that you help us maintain a clean library and create the best code for everyone to use.
3+
We'd love to accept your patches and contributions to this project. There are just a few guidelines you need to follow which are described in detail below.
4+
5+
## Fork this repo
6+
7+
You should create a fork of this project in your account and work from there. You can create a fork by clicking the fork button in GitHub.
8+
9+
## One feature, one branch
10+
11+
Work for each new feature/issue should occur in its own branch. To create a new branch from the command line:
12+
```shell
13+
git checkout -b my-new-feature
14+
```
15+
where "my-new-feature" describes what you're working on.
16+
17+
## Verify your changes locally
418

5-
## Build
619
You can use Maven to build all the modules from the root directory
720

821
```shell script
922
mvn clean install
1023
```
1124

12-
Or you can navigate to each module to build them
25+
Or you can navigate to each module to build them individually
1326

14-
## Testing
27+
## Add tests for any bug fixes or new functionality
1528

1629
### Unit Tests
1730

@@ -23,10 +36,10 @@ To run tests use Maven
2336
mvn verify
2437
```
2538

26-
You can also view the code coverage reports published to Codecov. Links in the README
39+
You can also view the code coverage reports published to Codecov. This validates that our coverage levels are maintained. Links are in the README.
2740

2841
### Linting
29-
We are also [ktlint](https://ktlint.github.io/) and [detekt](https://arturbosch.github.io/detekt/) for code style checking and linting. These can be run wiht the following Maven commands
42+
We are also [ktlint](https://ktlint.github.io/) and [detekt](https://arturbosch.github.io/detekt/) for code style checking and linting. These can be run with the following Maven commands
3043

3144
**Note**:
3245
These will be run as part of the `validate` phase of a full build but if you want to run them manually you will have to navigate to each module directory and run the command
@@ -38,6 +51,16 @@ mvn antrun:run@ktlint
3851
mvn antrun:run@detekt
3952
```
4053

41-
## License
54+
## Add documentation for new or updated functionality
55+
56+
Please add appropiate javadocs in the source code and ask the maintainers to update the wiki with any relevant information.
57+
58+
59+
## Merging your contribution
60+
61+
Create a new pull request and your code will be reviewed by the maintainers. They will confirm at least the following:
62+
63+
- Tests run successfully (unit, coverage, integration, style)
64+
- Contribution policy has been followed
4265

43-
See [LICENSE](LICENSE)
66+
A maintainer will need to sign off on your pull request before it can be merged.

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,45 @@ GraphQL Kotlin consists of number of libraries that aim to simplify GraphQL inte
1212
* [graphql-kotlin-federation](/graphql-kotlin-federation) - Schema generator extension to build federated GraphQL schemas
1313
* [examples](/examples) - Example apps that use graphql-kotlin libraries to test and demonstrate usages
1414

15+
## ⌨️ Usage
16+
17+
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
18+
19+
```kotlin
20+
// Your existing Kotlin code
21+
22+
data class Widget(val id: Int, val value: String)
23+
24+
class WidgetService {
25+
fun widgetById(id: Int): Widget? {
26+
// grabs widget from a data source, might return null
27+
}
28+
}
29+
30+
// Generate the schema
31+
32+
val config = SchemaGeneratorConfig(supportedPackages = listOf("org.example"))
33+
val queries = listOf(TopLevelObject(WidgetService()))
34+
35+
toSchema(config, queries)
36+
```
37+
38+
will generate
39+
40+
```graphql
41+
type Query {
42+
widgetById(id: Int!): Widget
43+
}
44+
45+
type Widget {
46+
id: Int!
47+
value: String!
48+
}
49+
```
50+
1551
## 📋 Documentation
1652

17-
Examples and documentation are available on our [Uncyclo](https://github.com/ExpediaGroup/graphql-kotlin/wiki) or in each module.
53+
Examples and documentation are available on our [Uncyclo](https://github.com/ExpediaGroup/graphql-kotlin/wiki) or in each module README file.
1854

1955
If you have a question about something you can not find in our wiki, 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.
2056

@@ -31,4 +67,14 @@ This project is part of Expedia Group open source but also maintained by a dedic
3167

3268
## ✏️ Contributing
3369

70+
To get started, please fork the repo and checkout a new branch. You can then build the library locally with Maven
71+
72+
```shell script
73+
mvn clean install
74+
```
75+
76+
3477
See more info in [CONTRIBUTING.md](CONTRIBUTING.md)
78+
79+
## ⚖️ License
80+
This library is licensed under the [Apache License, Version 2.0](LICENSE)

0 commit comments

Comments
 (0)