I would like to ask you if some tools already exists as I wanted to go further with tests on json for example. There are assert_json! and validators that allow you to check the consistency of some of the fields. Is there a way to check if a json contains a value? For example with the data not known in advance of a json like this?
let json1 = // first json
let json2 = // second json
json1.contains(json2) -> bool ?
Maybe, I can have other example where it is not an array we check... Just that one contains the data of the other as least... Or the reverse operation... the second is in the first one ?
When looking for documentation of these crate, I discover this one :
assert_json_diff = "2.0.2"
Maybe the assert include could do the same staff...
But it is the first time, I can't use this crate...
Updating crates.io index
error: no matching package found
error: no matching package found
searched package name: `assert_json_diff`
perhaps you meant: assert-json-diff
location searched: crates.io index
I do not have connection probrem... Do you know how we can undestand why we can't use this crate ? The name correct by the way...
https://docs.rs/assert-json-diff/latest/assert_json_diff/
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
| |> how to spell when using crate in your code
|
|> how to spell when declaring crate as dependency in `Cargo.toml`
I am trying the assert_json_include! functionnality...
But the message indicates that it seems to look for an equal, not an include ... ?
I will investigate...
json atoms at path "(root)" are not equal:
expected:
"{\"data\":{\"A\":{\"B\":{\"C\":[{\"id\":\"1\",\"description\":\"desc1\"}]}}}}"
actual:
"{\"data\":{\"A\":{\"B\":{\"C\":[{\"id\":\"1\",\"description\":\"desc1\"},{\"id\":\"2\",\"description\":\"desc2\"}]}}}}"