Skip to content
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

ViolationCode should be marked as non-exhaustive #209

Open
popematt opened this issue Feb 22, 2024 · 0 comments
Open

ViolationCode should be marked as non-exhaustive #209

popematt opened this issue Feb 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@popematt
Copy link
Contributor

/// Represents violation code that indicates the type of the violation
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ViolationCode {
AllTypesNotMatched,
AnnotationMismatched,
ElementMismatched, // this is used for mismatched elements in containers
ElementNotDistinct, // this is used for elements that are not distinct in containers
FieldNamesMismatched, // this is used for mismatched field names in a struct
FieldNamesNotDistinct, // this is used for field names that are not distinct in a struct
FieldsNotMatched,
InvalidIeee754Float, // this is used for ieee754_float constraint
InvalidLength, // this is used for any length related constraints (e.g. container_length, byte_length, codepoint_length)
InvalidNull, // if the value is a null for type references that doesn't allow null
InvalidOpenContent, // if a container contains open content when `content: closed` is specified
InvalidValue, // this is used for valid_values constraint
MissingAnnotation, // if the annotation is missing for annotations constraint
MissingValue, // if the ion value is missing for a particular constraint
MoreThanOneTypeMatched,
NoTypesMatched,
RegexMismatched, // this is used for regex constraint
TypeConstraintsUnsatisfied,
TypeMatched,
TypeMismatched,
UnexpectedAnnotation, // if unexpected annotation is found for annotations constraint
}

ViolationCode should be marked as #[non_exhaustive] so that new violation codes can be added if/when new versions of ISL add new constraints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant