Skip to content

Commit 3dec79b

Browse files
authored
Update JSON unknown field support (apple#771)
* Support erroring on unknown fields during JSON parse. According to the spec: https://developers.google.com/protocol-buffers/docs/proto3#json_options Unknown field name encountered while parsing JSON should cause errors, but language can provide a option to allow those fields to be skipped instead. We had it backwards, and always skipped them with no way to get an error. - Add an option to ignore unknown fields during JSON decode. - Add a JSON Decoding Error to indicated when an unknown field was encountered. - Wire up the option and new error. - Update the existing tests get the behaviour they arelady required around unknown fields in JSON. * Add a specific test around JSON unknown field handing. - Ensure the unknown field stop parsing (so any other errors don't show.) - Ensure ensure the unknown field name is reported. * Fix typo in two test field names. These were actually unknown field name getting skipped and not real test of setting the field to null. * Update the generated_swift_names_* files. * Support the conformance test's new ignore_unknown_json. * Bump the version number to 1.1.0 Since we are adding a minor behavior change around unknown field names in JSON parsing, bump the minor version to help call out this subtle change in behavior. Fixes apple#769
1 parent dc9e2d5 commit 3dec79b

27 files changed

+6169
-5840
lines changed

Protos/generated_swift_names_enum_cases.proto

Lines changed: 361 additions & 360 deletions
Large diffs are not rendered by default.

Protos/generated_swift_names_enums.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ message GeneratedSwiftReservedEnums {
257257
enum hasValue { NONE_hasValue = 0; }
258258
enum hour { NONE_hour = 0; }
259259
enum i { NONE_i = 0; }
260+
enum ignoreUnknownFields { NONE_ignoreUnknownFields = 0; }
260261
enum index { NONE_index = 0; }
261262
enum init { NONE_init = 0; }
262263
enum inout { NONE_inout = 0; }

0 commit comments

Comments
 (0)