Skip to content
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

Backwards incompatible change from 3.8.x -> 3.9.x #6526

Closed
mikestanley opened this issue Aug 16, 2019 · 2 comments
Closed

Backwards incompatible change from 3.8.x -> 3.9.x #6526

mikestanley opened this issue Aug 16, 2019 · 2 comments
Assignees
Labels

Comments

@mikestanley
Copy link

What version of protobuf and what language are you using?
Version: 3.8.1 & 3.9.1
Language: Ruby

What operating system (Linux, Windows, ...) and version?
N/A

What runtime / compiler are you using (e.g., python version or gcc version)
N/A

What did you do?

Upgrading from 3.8.1 to 3.9.1 Ruby library breaks compatibility.
Specifically this commit - 565154a

to_hash was dropped (since it really is a duplicate of the more common to_h) . However, there are implications to removing this method.

For example, Rails as_json method looks for to_hash (not to_h).
https://apidock.com/rails/Object/as_json

I consider this a backwards incompatible API change in a minor version upgrade.

@TeBoring
Copy link
Contributor

#6166
Seems the removal was intentional. And they were aware of the breakage.

@haberman
Copy link
Member

Sorry for the breakage, the existing behavior was arguably broken and I think it should be easy to simulate the old behavior with something like:

# Add to_hash to MessageExts, which is included in every message instance.
module Google
  module Protobuf
    module MessageExts
      def to_hash
        self.to_h
      end
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants