fix(value): Missing field error when deserializing from Value
The logic for treating missing fields differed between the utf8 deserializer and the `Value` one, and missing fields would be incorrectly reported as an "invalid type" error instead. This makes the two deserializers consistent. I believe the "deserialize from unit" logic was just left over from before `deserialize_option` was a thing, and therefore isn't necessary anymore?
Fixes#50
feat(value): impl Display and FromStr traits
Refs #62
I can add some tests, but implementation seems trivial. Tests fail on `nightly`, but this seems unrelated.
feat(value): implement RFC6901 JSON Pointer
Add a method `pointer(&str)` to `Value`. Deprecate `lookup(&str)`.
Bump version to 0.7.1.
Closes#9
Notes:
* It should be possible to add a `pointer_mut(&str)` method to Value. This would allow to add and modify values. (Maybe even a delete method) I failed to add such a method because of borrow checker.
* Should [RFC6902 JSON Patch](https://tools.ietf.org/html/rfc6902) be implemented or is this something for a separate crate? (Patch is based on Pointer)
This updates json breakage from latest serde master. Of note is the
removal of `test_missing_fmt_renamed_field` which relied on a feature
that is being removed.
Additionally,
- Adds .cargo/config for travis to use master of serde
- reverts dependencies with specific git revisions
.eof() can return Err, so do not try to unwrap() it unconditionally.
Also, check result of .parse_whitespaces(), and report, if there is any
errors.
(thanks, @nixpulvis)
Mappings from visit_* to de/serialize_* should be self explanatory.
[serde(deny_unknown_fields)] was added to a test struct since it was
checking for denial. A couple of error types were added to support new
serde de::value::Error variants. Finally, there are a bunch of throwaway
changes pinning the serde version to a 0.7 commit. These should be
removed once 0.7 lands in favor of a crates.io semver spec.
This resolves#22, resolves#29, and resolves#30.
* The reported error code is now `MissingField`, not `ExpectedSomeValue`.
* A missing `()` field now causes a `MissingField` error.
* A missing `Vec<_>` field now causes a `MissingField` error.
Tests have been updated to check these cases.
* `parse_stream` removed in favor of direct `JSONStream` usage;
* truncated input no longer silently ignored;
* added test for errors;
* style violation fixed.