This adds the JSON Schema Test Suite repository as a submodule in the tests/ directory. It also adds another binary target which reads the JSON files containing the tests, extracts the schemas to separate files (placed in tests/test_suite/schemas/<test_name>_<index>.json), and generates a .rs file which generates types from the schema and checks whether the sample data does or does not parse.
The code generator, in src/generate_tests.rs, can be run with cargo run --bin generate-tests. It contains a function called is_blacklisted(), which is used to skip the majority of the tests in the test suite.
I think it would take quite a lot of work to get schemafy to pass the test suite, but hopefully this provides at least a bit of value in terms of test coverage, and helps people trying to add new features.
Note: If you don't run git submodule update --init and then cargo run --bin generate-tests, then cargo test will fail. It would be easy to change things around so that running the test suite is optional.
See #16.
This adds the JSON Schema Test Suite repository as a submodule in the
tests/
directory. It also adds another binary target which reads the JSON files containing the tests, extracts the schemas to separate files (placed intests/test_suite/schemas/<test_name>_<index>.json
), and generates a.rs
file which generates types from the schema and checks whether the sample data does or does not parse.The code generator, in
src/generate_tests.rs
, can be run withcargo run --bin generate-tests
. It contains a function calledis_blacklisted()
, which is used to skip the majority of the tests in the test suite.I think it would take quite a lot of work to get
schemafy
to pass the test suite, but hopefully this provides at least a bit of value in terms of test coverage, and helps people trying to add new features.Note: If you don't run
git submodule update --init
and thencargo run --bin generate-tests
, thencargo test
will fail. It would be easy to change things around so that running the test suite is optional.