Skip to content

Commit

Permalink
add non_exhaustive to public enums
Browse files Browse the repository at this point in the history
- this is needed in case the spec adds new variants; otherwise we break
  consumers of these enums that may have matched exhaustively

Signed-off-by: mimir-d <[email protected]>
  • Loading branch information
mimir-d committed Oct 5, 2024
1 parent 82b8dd6 commit 98f58e0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ pub enum TestStepArtifactDescendant {
}

#[derive(Debug, Serialize, Clone, PartialEq)]
#[non_exhaustive]
pub enum ValidatorType {
#[serde(rename = "EQUAL")]
Equal,
Expand Down Expand Up @@ -175,6 +176,7 @@ pub enum DiagnosisType {
/// schema ref: https://github.com/opencomputeproject/ocp-diag-core/testStatus
#[derive(Debug, Serialize, Clone, PartialEq)]
#[serde(rename = "testStatus")]
#[non_exhaustive]
pub enum TestStatus {
#[serde(rename = "COMPLETE")]
Complete,
Expand All @@ -190,6 +192,7 @@ pub enum TestStatus {
/// schema ref: https://github.com/opencomputeproject/ocp-diag-core/testRunEnd/$defs/testResult
#[derive(Debug, Serialize, Clone, PartialEq)]
#[serde(rename = "testResult")]
#[non_exhaustive]
pub enum TestResult {
#[serde(rename = "PASS")]
Pass,
Expand All @@ -198,11 +201,13 @@ pub enum TestResult {
#[serde(rename = "NOT_APPLICABLE")]
NotApplicable,
}

/// Known log severity variants.
/// ref: https://github.com/opencomputeproject/ocp-diag-core/tree/main/json_spec#severity
/// schema url: https://github.com/opencomputeproject/ocp-diag-core/blob/main/json_spec/output/log.json
/// schema ref: https://github.com/opencomputeproject/ocp-diag-core/log/$defs/severity
#[derive(Debug, Serialize, Clone, PartialEq)]
#[non_exhaustive]
pub enum LogSeverity {
#[serde(rename = "DEBUG")]
Debug,
Expand Down

0 comments on commit 98f58e0

Please sign in to comment.