Commit 3dec79b
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#7691 parent dc9e2d5 commit 3dec79b
File tree
27 files changed
+6169
-5840
lines changed- Protos
- Reference
- Sources
- Conformance
- SwiftProtobuf
- SwiftProtobuf.xcodeproj
- Tests
- SwiftProtobufTests
27 files changed
+6169
-5840
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| |||
0 commit comments