File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
content/programming-guides Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 11# baseURL = 'https://protobuf.dev'
22languageCode = ' en-us'
33title = ' Protocol Buffers Documentation'
4- theme = [" docsy" ]
54sidebar_search_disable = true
65
6+ # Theme
7+ [module ]
8+ replacements = " github.com/FortAwesome/Font-Awesome -> ., github.com/twbs/bootstrap -> ."
9+ [[module .imports ]]
10+ path = " docsy"
11+
712# Language settings
813contentDir = " content"
914defaultContentLanguage = " en"
Original file line number Diff line number Diff line change @@ -137,6 +137,24 @@ Almost never change the default value of a proto field. This causes version skew
137137between clients and servers. A client reading an unset value will see a
138138different result than a server reading the same unset value when their builds
139139straddle the proto change. Proto3 removed the ability to
140+ set default values.
141+
142+ ## ** Don't** Go from Repeated to Scalar
143+
144+ Although it won't cause crashes, you'll lose data. For JSON, a mismatch in
145+ repeatedness will lose the whole * message* . For numeric proto3 fields and proto2
146+ ` packed ` fields, going from repeated to scalar will lose all data in that
147+ * field* . For non-numeric proto3 fields and un-annotated proto2 fields, going
148+ from repeated to scalar will result in the last deserialized value "winning."
149+
150+ Going from scalar to repeated is OK in proto2 and in proto3 with
151+ ` [packed=false] ` because for binary serialization the scalar value becomes a
152+ one-element list .
153+
154+ ## ** Always** Create a Build Rule for Your Proto Files
155+
156+ If your proto is only used by a script that doesn't require a build rule, create
157+ a ` proto_library ` rule with an associated
140158` build_test ` rule.
141159
142160With a ` build_test ` rule, errors in the file are caught when the test fails.
You can’t perform that action at this time.
0 commit comments