-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation doesn’t produce violations in a deterministic order #206
Comments
Version information for the above: [[package]]
name = "ion-schema"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4b66b5bf004a664fce2936505d4fdced4e7e50f8e911c7306b9aa2d4c754eab"
dependencies = [
"half",
"ion-rs",
"num-bigint 0.3.3",
"num-traits",
"regex 1.10.3",
"thiserror",
] |
I don't think there's anything wrong with this part. Ion Schema Language is a declarative rather than procedural language, the constraints are defined in an Ion struct (which is an unordered data structure), and Ion Schema makes no guarantees about the order in which constraints are evaluated. The problem is that the order of execution is leaking into the user-facing output, and the solution should be to change the violations output to use a set instead of a Long term, we could provide some functions or macros to assist with writing tests for schemas. Finally, this is concerning to me:
The violation messages are not guaranteed to be stable, so this is a very brittle comparison. It would be much better to check the source of the violation (i.e. which constraint produced this violation; and when relevant e.g. which list element in the input data). |
With #208, as a short-term solution added two macros
|
As reported through another channel by an
ion-schema-rust
user:As far as I can tell this is because
HashMap
is used to store field constraints and its hash function is randomly seeded.The text was updated successfully, but these errors were encountered: