#json-schema #schemars #compare #validate #matches

does-it-json

Compare serde serialization with the schemars JSON schema

4 releases

0.0.4 Jul 10, 2022
0.0.3 Jun 27, 2022
0.0.2 Jun 24, 2022
0.0.1 Jun 24, 2022

#3 in #schemars


Used in ipnetwork

Apache-2.0

25KB
606 lines

Does it JSON?

Simple crate to validate that a type's serialization via serde matches the JSON schema from schemars.

This is particularly useful when hand-rolling (rather than deriving) serde::Serialize and/or schemars::JsonSchema--it can be easy to accidentally have divergence between the two.

let item = MyType::create_somehow();
does_it_json::validate(&item).unwrap();

For best results, apply to a variety of instantiations of your type.

Dependencies

~2.2–3MB
~78K SLoC