command
module
Version:
v0.0.2
Opens a new window with list of versions in this module.
Published: Sep 5, 2021
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
protoc-gen-gqls
protoc-gen-gqls is a protoc plugin that generates graphql schema (.glaphqls) from Protocol Buffers.
Use
$ protoc --plugin=protoc-gen-gqls --gqls_out=DIR example/proto/*.proto
Output example
.proto
syntax = "proto3";
package example;
import "google/api/annotations.proto";
import "google/type/date.proto";
service ExampleService {
rpc Ping(PingRequest) returns (PingResponse) {
option (google.api.http) = {
get: "*"
};
};
rpc Sample(SampleRequest) returns (SampleResponse) {
option (google.api.http) = {
post: "*"
};
};
rpc Noop(NoopRequest) returns (NoopResponse) {};
}
message PingRequest {}
message PingResponse {}
message SampleRequest {
int32 id = 1;
string name = 2;
bool flag = 3;
Environment env = 4;
google.type.Date date = 5;
}
message SampleResponse {
int32 id = 1;
string name = 2;
repeated ResponseContent contents = 3;
}
message ResponseContent {
string name = 1;
string data = 2;
google.type.Date date = 3;
bool active = 4;
}
enum Environment {
ENVIRONMENT_UNKNOWN = 0;
DEVELOPMENT = 1;
STAGING = 2;
PRODUCTION = 3;
}
message NoopRequest {}
message NoopResponse {}
.graphqls
# Generated by protoc-gen-gqls.
type Query {
Ping(req: PingRequest): PingResponse
}
type Mutation {
Sample(req: SampleRequest): SampleResponse
}
input PingRequest {
_: Boolean # noop field
}
type PingResponse {
_: Boolean # noop field
}
input SampleRequest {
id: Int
name: String
flag: Boolean
env: Environment
date: String
}
type SampleResponse {
id: Int
name: String
contents: [ResponseContent]
}
type ResponseContent {
name: String
data: String
date: String
active: Boolean
}
input NoopRequest {
_: Boolean # noop field
}
type NoopResponse {
_: Boolean # noop field
}
enum Environment {
ENVIRONMENT_UNKNOWN
DEVELOPMENT
STAGING
PRODUCTION
}
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.