ruby-protobuf / protobuf

A pure ruby implementation of Google's Protocol Buffers
https://github.com/ruby-protobuf
MIT License
462 stars 101 forks source link

Converting snake_case_modules into CamelCaseModules #405

Open film42 opened 4 years ago

film42 commented 4 years ago

This is an implementation to fix https://github.com/ruby-protobuf/protobuf/issues/403

Although this is mostly a straight-forward conversion, this is a breaking change. We might be able to stuff this change behind a feature flag, but it might be better to wait for a major version upgrade.

I did find an example that was a little weird and makes me not want to merge this change. If you look at google_unittest.proto:

  optional group OptionalGroup_extension = 16 {
    optional int32 a = 17;
  }
...
  repeated group RepeatedGroup_extension = 46 {
    optional int32 a = 47;
  }

These use a half camel-case half snake-case name for the group extension. This new change now converts this into a full camel-case class:

  class OptionalGroupExtension
    optional :int32, :a, 17
  end
...
  class RepeatedGroupExtension
    optional :int32, :a, 47
  end
...
    optional ::ProtobufUnittest::OptionalGroupExtension, :".protobuf_unittest.optionalgroup_extension", 16, :extension => true
...
    repeated ::ProtobufUnittest::RepeatedGroupExtension, :".protobuf_unittest.repeatedgroup_extension", 46, :extension => true

And that might be a little weird, but if we are going to make a breaking change here, it might be worth it? I suppose we could see if everything up until the snake-case edition is camel-case, and if so, leave it be?

cc @liveh2o @abrandoned