Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usage in the main README #343

Merged
merged 3 commits into from Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 32 additions & 9 deletions CONTRIBUTING.md
@@ -1,17 +1,30 @@
# Contributing
# How To Contribute

`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.
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.

## Fork this repo

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.

## One feature, one branch

Work for each new feature/issue should occur in its own branch. To create a new branch from the command line:
```shell
git checkout -b my-new-feature
```
where "my-new-feature" describes what you're working on.

## Verify your changes locally

## Build
You can use Maven to build all the modules from the root directory

```shell script
mvn clean install
```

Or you can navigate to each module to build them
Or you can navigate to each module to build them individually

## Testing
## Add tests for any bug fixes or new functionality

### Unit Tests

Expand All @@ -23,10 +36,10 @@ To run tests use Maven
mvn verify
```

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

### Linting
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
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

**Note**:
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
Expand All @@ -38,6 +51,16 @@ mvn antrun:run@ktlint
mvn antrun:run@detekt
```

## License
## Add documentation for new or updated functionality

Please add appropiate javadocs in the source code and ask the maintainers to update the wiki with any relevant information.


## Merging your contribution

Create a new pull request and your code will be reviewed by the maintainers. They will confirm at least the following:

- Tests run successfully (unit, coverage, integration, style)
- Contribution policy has been followed

See [LICENSE](LICENSE)
A maintainer will need to sign off on your pull request before it can be merged.
48 changes: 47 additions & 1 deletion README.md
Expand Up @@ -12,9 +12,45 @@ GraphQL Kotlin consists of number of libraries that aim to simplify GraphQL inte
* [graphql-kotlin-federation](/graphql-kotlin-federation) - Schema generator extension to build federated GraphQL schemas
* [examples](/examples) - Example apps that use graphql-kotlin libraries to test and demonstrate usages

## 鈱笍 Usage

The basic usage of `graphql-kotlin-schema-generator` converts your Kotlin code into a GraphQL schema. For more details see our documentation below or in the modules
smyrick marked this conversation as resolved.
Show resolved Hide resolved

```kotlin
// Your existing Kotlin code

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

class WidgetService {
fun widgetById(id: Int): Widget? {
// grabs widget from a data source, might return null
}
}

// Generate the schema

val config = SchemaGeneratorConfig(supportedPackages = listOf("org.example"))
val queries = listOf(TopLevelObject(WidgetService()))

toSchema(config, queries)
```

will generate

```graphql
type Query {
widgetById(id: Int!): Widget
}

type Widget {
id: Int!
value: String!
}
```

## 馃搵 Documentation

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

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.

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

## 鉁忥笍 Contributing

To get started, please fork the repo and checkout a new branch. You can then build the library locally with Maven

```shell script
mvn clean install
```


See more info in [CONTRIBUTING.md](CONTRIBUTING.md)

## 鈿栵笍 License
This library is licensed under the [Apache License, Version 2.0](LICENSE)