Open desaikd opened 1 year ago
You can probably just make an impl
of PartialEq
that ignores the description, and possibly other fields in that case. (Although I would definitely include the position of the error within the document being validated (not within the ISL).
I'm a little uneasy about having the equality function test only for description string equality, which can be pretty fragile. Developers are likely to write unit tests against a given error string, which means we can't change that error string down the road without also breaking their tests.
We do description string comparisons like this in
ion-rust
'sIonError
type, but the description messages are intentionally terse and do not include lots of contextual information like position. Even there I don't love it.I suppose ideally we'd have fields besides the description that characterized the nature of the failure. For example, a
schema_name
field in eachUnresolvableSchemaError
, or an enum of reasons that anInvalidSchemaError
occurred. Well-defined, tightly-scoped fields that we're comfortable committing to using in ourPartialEq
impl.This doesn't need to block this PR, but we should think it through before 1.0.
_Originally posted by @zslayton in https://github.com/amazon-ion/ion-schema-rust/pull/139#discussion_r1084512034_