-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: add mkdocs config and split the existing readme into separate docs * fix: make examples work again * fix: make examples work again * fix: make examples work again
- Loading branch information
1 parent
6336924
commit 164ec92
Showing
59 changed files
with
16,876 additions
and
4,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[](https://codecov.io/gh/danielvladco/go-proto-gql) | ||
|
||
This project aims to solve the problem of communication between services that use different API protocols. | ||
Such as GraphAL and gRPC. | ||
|
||
Let's say your backend services use gRPC for fast and reliable communication however your frontend uses GraphQL. | ||
Normally your only two options: | ||
|
||
1. Either expose gRPC endpoints alongside GraphQL endpoints or build and | ||
2. Maintain another service that acts as a gateway between your backend infrastructure and frontend application. | ||
|
||
This project provides tools to help you build your API much quicker for both of these cases. | ||
|
||
1. Use `protoc-gen-gql`, `protoc-gen-gogql` and `proto2graphql` to generate boilerplate code on your backend. | ||
2. Spin up a gateway and convey the messages from one protocol to the other on the fly! | ||
|
||
Check out the docs for getting started and usage examples at: https://danielvladco.github.io/go-proto-gql/ | ||
|
||
## Community: | ||
Will be happy for any contributions. So feel free to create issues, forks and PRs. | ||
|
||
## License: | ||
|
||
`go-proto-gql` is released under the Apache 2.0 license. See the LICENSE file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Plugin protoc-gen-gql | ||
|
||
`protoc-gen-gql` plugin will generate graphql files with extension `.graphqls` | ||
rather than go code which means it can be further used for any other language or framework. | ||
|
||
> :warning: The GraphQL objects will only be generated for the gRPC messages of other types that are used in a service either as a input value or a return value (For details check #1) | ||
## Install | ||
|
||
```sh | ||
go install github.com/danielvladco/go-proto-gql/protoc-gen-gql@latest | ||
``` | ||
|
||
The protoc compiler expects to find plugins named `proto-gen-<PLUGIN_NAME>` on the execution `$PATH`. | ||
|
||
So first add golang bin directory to the path if it's not already added (also add it to `.zshrc` or `~/.bash_profile` depending on the OS you use): | ||
|
||
```sh | ||
export PATH=${PATH}:$(go env GOPATH)/bin | ||
``` | ||
|
||
## Usage | ||
Run the `protoc` command with the arguments for the installed plugin: | ||
|
||
Like this: | ||
|
||
```sh | ||
protoc --gql_out=<ADDITIONAL_ARGUMENTS>:<PATH> -I=./api -I=. ./example/codegen/api/pb/*.proto | ||
``` | ||
|
||
Where `ADDITIONAL_ARGUMENTS` may be provided in the form of `key=value` separated by a comma. | ||
|
||
Possible additional arguments: | ||
- `svc` bool - Use service annotations for nodes corresponding to a GRPC call. | ||
- `merge` bool - Merge all the proto files found in one directory into one graphql file. | ||
- `ext` string - Extension of the graphql file, Default: '.graphql' (default "graphql"). | ||
|
||
## Example | ||
```sh | ||
protoc --gql_out=svc=true:. -I=./api -I=. ./example/codegen/api/pb/*.proto | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Plugin protoc-gen-gogql | ||
|
||
If you still want to generate go source code instead of graphql then use | ||
http://github.com/99designs/gqlgen plugin, and map all the generated go types with all the generated graphql types. | ||
|
||
`protoc-gen-gogql` plugin generates methods for implementing | ||
`github.com/99designs/gqlgen/graphql.Marshaler` and `github.com/99designs/gqlgen/graphql.Unmarshaler` interfaces. Now proto `enum`s, `oneof`s and `map`s will work fine with graphql. | ||
|
||
This plugin also creates convenience methods that will implement generated by the `gqlgen` `MutationResolver` and `QueryResolver` interfaces. | ||
|
||
## Install | ||
|
||
```sh | ||
go install github.com/danielvladco/go-proto-gql/protoc-gen-gogql@latest | ||
``` | ||
|
||
The protoc compiler expects to find plugins named `proto-gen-<PLUGIN_NAME>` on the execution `$PATH`. | ||
|
||
So first add golang bin directory to the path if it's not already added (also add it to `.zshrc` or `~/.bash_profile` depending on the OS you use): | ||
|
||
```sh | ||
export PATH=${PATH}:$(go env GOPATH)/bin | ||
``` | ||
|
||
## Usage | ||
Run the `protoc` command with the arguments for the installed plugin: | ||
|
||
Like this: | ||
|
||
```sh | ||
protoc --gql_out=<ADDITIONAL_ARGUMENTS>:<PATH> -I=./api -I=. ./example/codegen/api/pb/*.proto | ||
``` | ||
|
||
Where `ADDITIONAL_ARGUMENTS` may be provided in the form of `key=value` separated by a comma. | ||
|
||
Possible additional arguments: | ||
- `svc` bool - Use service annotations for nodes corresponding to a GRPC call. | ||
- `merge` bool - Merge all the proto files found in one directory into one file. | ||
|
||
## Example | ||
```sh | ||
protoc --gogql_out=paths=source_relative:. -I=./api -I=. ./example/codegen/api/pb/*.proto | ||
``` |
Oops, something went wrong.