juniper icon indicating copy to clipboard operation
juniper copied to clipboard

Add `arbitrary` support

Open LegNeato opened this issue 2 years ago • 3 comments

This adds optional support for https://github.com/rust-fuzz/arbitrary/ behind the arbitrary1 feature flag (off by default).

This will be used in a future pull request to enable fuzzing using cargo-fuzz

LegNeato avatar Mar 01 '22 07:03 LegNeato

I haven't added this to CI yet. I'm also not sure we want these next to the definitions rather than in their own module...next to definitions makes the file noisy, but putting them in their own crate makes them further away from the type they are implementing on.

LegNeato avatar Mar 01 '22 07:03 LegNeato

Note that I had to manually implement rather than use the Arbitrary derive in many places due to lifetimes (see https://github.com/rust-fuzz/arbitrary/issues/104)

LegNeato avatar Mar 01 '22 07:03 LegNeato

This isn't 100% yet because the arbitrary Name implementation on Schema causes an error of IncorrectFormat all the time. That being said, this is a good start and allows everything to compile (minus the TODOs). I'm working on the custom arbitrary implementations that more closely match the expectations of the underlying data model.

LegNeato avatar Mar 01 '22 08:03 LegNeato