-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a primitive field mapping from symbol to field class #170
Conversation
Allows us to generate “prettier” message code that use symbols for all the primitive types in the definition. ```ruby # old class Foo optional ::Protobuf::Field::StringField, :bar, 1 end # new class Bar optional :string, :foo, 1 end ```
proto_path = ::File.expand_path('../spec/support/', __FILE__) | ||
cmd = %Q{protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{proto_path} -I #{proto_path} #{File.join(proto_path, '**', '*.proto')}} | ||
puts cmd | ||
exec cmd | ||
end | ||
|
||
desc "Compile spec protos in spec/supprt/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the description got left behind from the copy/paste.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, updating...
Other than the task description, I think this looks good. Nice to have prettier output, but I also wonder what additional functionality may be gleaned from the new primitive mapping. 👍 |
love the new syntax, I think long term benefit could be multiple encoders/decoders thrift/message pack /avro could all come of a unified ddl |
Use a primitive field mapping from symbol to field class
Generate “prettier” message code that uses symbols for all the
primitive types in the definition.
You can mostly ignore the Rakefile and *.pb.rb file changes, the relevant changes are in
lib/protobuf/field.rb
andlib/protobuf/generators/field_generator.rb
.