Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical gRPC

You're reading from   Practical gRPC Build highly-connected systems with a framework that can run on any platform

Arrow left icon
Product type Paperback
Published in Nov 2019
Publisher
ISBN-13 9781839211744
Length 169 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (6):
Arrow left icon
Robert Ross Robert Ross
Author Profile Icon Robert Ross
Robert Ross
Carles Sistare Carles Sistare
Author Profile Icon Carles Sistare
Carles Sistare
Joshua B. Humphries Joshua B. Humphries
Author Profile Icon Joshua B. Humphries
Joshua B. Humphries
Backstop Media LLC Backstop Media LLC
Author Profile Icon Backstop Media LLC
Backstop Media LLC
David Konsumer David Konsumer
Author Profile Icon David Konsumer
David Konsumer
David Muto David Muto
Author Profile Icon David Muto
David Muto
+2 more Show less
Arrow right icon
View More author details
Toc

Behavior compatibility

If you follow the practice of only adding things, maintaining ABI/API compatibility and wire compatibility is fairly straightforward. However, this alone isn’t sufficient to ensure your existing client’s expected behavior is maintained.

There are a number of things you need to be aware of to ensure that the behavior of your service doesn’t change when you add new fields for example. Let’s take a look at a few common scenarios.

Default values for new fields

Any new fields added to protobuf messages will be given a default value that’s specific to the type. For example, a new int32 field will have a value of 0, a string will have "", and a message field will be nil (or the language equivalent).

For a full list of the default values for each field type, see the protobuf docs at https://developers.google.com/protocol-buffers/docs/proto3#default.

This is the standard behavior for proto3. Working against the protocol can...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime