Skip to content

protoc-gen-pubsub-schema is a protoc plugin that assembles protocol buffer messages into a single-valid message for defining Pub/Sub schemas

License

Notifications You must be signed in to change notification settings

derivita/protoc-gen-pubsub-schema

 
 

Repository files navigation

protoc-gen-pubsub-schema

Go

This is a protoc plugin that assembles protocol buffer messages into a single-valid message for defining Pub/Sub schemas.

It has been forked from github.com/alpancs/protoc-gen-pubsub-schema

Installation

Run the following command to install protoc-gen-pubsub-schema.

go install github.com/derivita/protoc-gen-pubsub-schema@latest

Usage

You need to have protoc installed. Follow https://grpc.io/docs/protoc-installation for instruction.

To use this plugin, just run protoc with an option --pubsub-schema_out. protoc will automatically use protoc-gen-pubsub-schema executable file. protoc and protoc-gen-pubsub-schema must be found in shell's $PATH.

# generate pubsub-proto-schema files using proto2 syntax that accept binary message encoding
protoc PROTO_FILES --pubsub-schema_out=OUT_DIR

# generate pubsub-proto-schema files using proto2 syntax that accept JSON message encoding
protoc PROTO_FILES --pubsub-schema_out=OUT_DIR --pubsub-schema_opt=message-encoding=json

# generate pubsub-proto-schema files using proto3 syntax that accept JSON message encoding
protoc PROTO_FILES --pubsub-schema_out=OUT_DIR --pubsub-schema_opt=message-encoding=json --pubsub-schema_opt=schema-syntax=proto3

Example

The following example shows how to generate example/article_commented.pps from example/article_commented.proto.

# include go compiled binaries in the $PATH if it hasn't been there yet
export PATH=$PATH:$(go env GOPATH)/bin

# generate example/article_commented.pps
protoc example/article_commented.proto --pubsub-schema_out=.

About

protoc-gen-pubsub-schema is a protoc plugin that assembles protocol buffer messages into a single-valid message for defining Pub/Sub schemas

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%