Coder Social home page Coder Social logo

alpancs / protoc-gen-pubsub-schema Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 47 KB

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

License: Apache License 2.0

Go 100.00%
protobuf pubsub schema

protoc-gen-pubsub-schema's People

Contributors

alpancs avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

protoc-gen-pubsub-schema's Issues

Plugin killed by signal 9 Error

I got error plugin killed by signal 9 when execute this plugin. Kindly help with this issue :)

How to reproduce:
protoc wartek/core/event/nlp_job_update/v1/event.proto --pubsub-schema_out=OUT_DIR --pubsub-schema_opt=message-encoding=json

--pubsub-schema_out: protoc-gen-pubsub-schema: Plugin killed by signal 9.

Permit `optional` fields in `proto3`

"Protobuf release 3.12 adds experimental support for optional fields in proto3".

foo.proto:

syntax = "proto3";

message Foo {
    optional string id = 1;
}

But:

protoc \
--proto_path=${PWD} \
--pubsub-schema_out=${PWD} \
--pubsub-schema_opt=message-encoding-json \
--pubsub-schema_opt=schema-syntax=proto3 \
${PWD}/foo.proto

Yields:

foo.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-pubsub-schema hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.

Permit specification of one top-level message type to generate Pub/Sub-compatible protobufs

If a protocol buffer file includes multiple top-level messages, the plugin rejects the file.

Solutions:

  1. Extract top-level message into a separate file and use that
  2. Permit the specification of one top-level message type using e.g. --pubsub-schema_opt=top-level-message=Foo

foo.proto:

syntax = "proto3";

message Foo {
}
message Bar {
}

But:

protoc \
--proto_path=${PWD} \
--pubsub-schema_out=${PWD} \
--pubsub-schema_opt=message-encoding-json \
--pubsub-schema_opt=schema-syntax=proto3 \
${PWD}/foo.proto

Yields:

--pubsub-schema_out: test/foo.proto: only one top-level type may be defined in a file (see https://cloud.google.com/pubsub/docs/schemas#schema_types). use nested types or imports (see https://developers.google.com/protocol-buffers/docs/proto)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.