- Resolve camelCase enum values (#13)
- Remove field_camel and add field_proto CLI arg (#14)
- Refactor getTagName function (#16)
- GitHub Action Workflows - Publish tagged BSR repository (#17)
- Add compiler and plugin version info to header comment (#12)
- Resolve issues with goreleaser action [v0.2.3] (#11)
- GitHub Action Workflows - Pull Request Verification (#7)
- GitHub Action Workflows - Tagged Releases (#9)
- Containerize plugin for remote code generation via buf.build (#5)
- Resolve errant self imported package functions (#1)
- Generate GraphQL types for empty proto messages (#2)
- Allow Generation via buf.build and remote BSR proto dependency for graphql.proto by (#3)
- Generate google/protobuf GraphQL types by (#4)
- Resolve Import Issues (#4)
- Convert module path (#3)
- Refactor GraphqlHandler to expose host and DialOptions (#1)
- Resolve source_relative not respecting subpath proto files (#2)
Original Changelog for ysugimoto/grpc-graphql-gateway
- support parths=source_relative option #51
- Support marshaling map type of Protocol Buffers #38
Bugifxes
- Fix input object when message has dependency of extermal package #35
Bugifxes
- Fix Input message type generation for nested resolver #33
Bugifxes
- Enable to parse enums within message #26 (@hychrisli)
- Add default error handler which add
code
extension via gRPC error #25
- Add new graphql option of
resolver
#24
message GraphqlField {
bool required = 1;
string name = 2;
string default = 3;
bool omit = 4;
string resolver = 5;
}
A new field of resolve
which resolves as a nested query.
Add omit
option in graphql.field option.
Bugfixes
- enum: use protobuf enum type for value #18 (@bmkessler)
Bugfixes
- Implement request transformation from CamelCase to SnakeCase.
Bugfixes
- Fix unexpected panic caused by reflect package in marshaling JSON response with camel-case
Bugfixes
- Fix tiny syntax error
- Fix field camelcase generation
- Fix required sign in repeated array and input object
Implement specific types and provide from this repository:
- google.protobuf.Timestamp
- google.protobuf.Wrappers
- google.protobuf.Empty
Note that we could only support the above types hence if a user imports other types e.g. google.protobuf.Any will raise an error.
And for GraphQL spec, google.protobuf.Empty defined empty field like _: Boolean
because GraphQL raises error when type fields are empty.
In proto3, map type can define as map<string, string>
but PB parse as xxxEntry message. This PR also can use as graphql type with required key and value.
protoc-gen-graphql
accepts -v
option for print build version.
Add infix typename to GraphQL typename in order to avoid conflicting name between Type
and Input
.
After this version, GraphQL typename is modified that [PackageName]_[Type]_[MessageName]
for example:
package user
message User {
int64 user_id = 1;
}
Then typename is User_Type_User
.
In protocol buffers, all message field name should define as lower_snake_case referred by Style Guide. But in GraphQL Schema, typically each field name should define as lowerCamelCase, so we add more option in protoc-gen-graphql
:
protoc -I.
--graphql_out=field_camel=true:.
--go_out=plugins=grpc:.
example.proto
The new option, field_camel=true
converts all message field name to camel case like:
// protobuf
message User {
int64 user_id = 1 [(graphql.field).required = true];
string user_name = 2 [(graphql.field).required = true];
}
// Graphql Schema
type User_Type_User {
userId Int!
userName String!
}
To keep backward compatibility, compile as lower_snake_case as default. If you want to define any graphql field as lowerCamelCase, please supply this option.
We defined MiddleWareError
which can return in Middleware function. If middleware function returns that pointer instead of common error,
The runtime responds error with that field data.
The definition is:
type MiddlewareError struct {
Code string
Message string
}
// generate error
return runtime.NewMiddlewareError("CODE", "MESSAGE")
If middleware returns common error, the runtime error will be:
{"data": null, "errors": [{"message": "error message of err.Error()", "extensions": {"code": "MIDDLEWARE_ERROR"}]}
If middleware returns MiddlewareError
, the runtime error will be:
{"data": null, "errors": [{"message": "Message field value of MiddlewareError", "extensions": {"code": "Code field value of MiddlewareError"}]}
On MiddlewareFunc, you need to return context.Context
as first return value. this is because we need to make custom metadata to gRPC on middleware process.
If you are already using your onw middleware, plase change its interface. see ysugimoto/grpc-graphql-gateway#10