Skip to content

Commit

Permalink
Small fix to ShEx validator for recursive shapes...
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Nov 1, 2024
1 parent e0c86fa commit 2eea1cb
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 33 deletions.
9 changes: 9 additions & 0 deletions examples/shex/tutorial.shex
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PREFIX sc: <http://purl.org/science/owl/sciencecommons/>
prefix : <http://example.org/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix schema: <http://schema.org/>

:Book IRI and {
:name xsd:string ;
:related @:Book *
}
6 changes: 6 additions & 0 deletions examples/shex/tutorial.sm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:a@:Book,
:b@:Book,
:c@:Book,
:d@:Book,
:e@:Book,
:f@:Book
20 changes: 20 additions & 0 deletions examples/shex/tutorial.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
prefix : <http://example.org/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix schema: <http://schema.org/>

:a :name "Title A" ;
:related :b .

:b :related :a ;
:name "Title B".

:c :name "Title C1", "Title C2" .

:d :name 234 .

:e :namme "Title E" .

:f :name "Title F" ;
:related :a, _:1 .

_:1 :name "Unknown title" .
11 changes: 8 additions & 3 deletions prefixmap/src/prefixmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ impl PrefixMap {
}

/// Qualifies an IRI against a prefix map
///
/// If it can't qualify the IRI, it returns the iri between `<` and `>`
/// ```
/// # use std::collections::HashMap;
/// # use prefixmap::PrefixMap;
Expand Down Expand Up @@ -222,6 +224,9 @@ impl PrefixMap {
}

/// Qualifies an IRI against a prefix map
///
/// If it can't qualify the IRI, returns None
///
/// ```
/// # use std::collections::HashMap;
/// # use prefixmap::PrefixMap;
Expand All @@ -234,13 +239,13 @@ impl PrefixMap {
/// ("schema", "http://schema.org/")])
/// )?;
/// let a = IriS::from_str("http://example.org/a")?;
/// assert_eq!(pm.qualify(&a), ":a");
/// assert_eq!(pm.qualify(&a), Some(":a"));
///
/// let knows = IriS::from_str("http://schema.org/knows")?;
/// assert_eq!(pm.qualify(&knows), "schema:knows");
/// assert_eq!(pm.qualify(&knows), Some("schema:knows"));
///
/// let other = IriS::from_str("http://other.org/foo")?;
/// assert_eq!(pm.qualify(&other), "<http://other.org/foo>");
/// assert_eq!(pm.qualify(&other), None);
/// # Ok::<(), PrefixMapError>(())
/// ```
pub fn qualify_optional(&self, iri: &IriS) -> Option<String> {
Expand Down
21 changes: 6 additions & 15 deletions python/src/pyrudof_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ impl PyRudofConfig {
}

/// Main class to handle `rudof` features.
/// It is currently `unsendable` and doesn't support multiple threads.
/// There should be only one instance of `rudof` per program.
///
// TODO: review the unsendable constraint and check if we can remove it in the future
#[pyclass(unsendable, name = "Rudof")]
#[pyclass(name = "Rudof")]
pub struct PyRudof {
inner: Rudof,
}
Expand Down Expand Up @@ -435,10 +433,14 @@ impl PyRudof {
}
}

/// Declares a `ReaderMode` for parsing RDF data
#[pyclass(eq, eq_int, name = "ReaderMode")]
#[derive(PartialEq)]
pub enum PyReaderMode {
/// It ignores the errors and tries to continue the processing
Lax,

/// It fails with the first error
Strict,
}

Expand All @@ -448,20 +450,9 @@ impl PyReaderMode {
pub fn __init__(py: Python<'_>) -> Self {
py.allow_threads(|| PyReaderMode::Lax)
}

/// Returns `lax` reader mode
#[staticmethod]
pub fn lax() -> Self {
PyReaderMode::Lax
}

/// Returns `strict` reader mode
#[staticmethod]
pub fn strict() -> Self {
PyReaderMode::Strict
}
}

/// RDF Data format
#[allow(clippy::upper_case_acronyms)]
#[pyclass(eq, eq_int, name = "RDFFormat")]
#[derive(PartialEq)]
Expand Down
4 changes: 1 addition & 3 deletions rudof_lib/src/rudof_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ pub enum RudofError {
error: String,
},

#[error(
"ShEx validation error. Obtaining result map error: {shapemap}\nSchema:\n{schema}\nData:\n{rdf_data}\nError: {error} "
)]
#[error("ShEx validation error. Error: {error} ")]
ShExValidatorObtainingResultMapError {
schema: String,
rdf_data: String,
Expand Down
115 changes: 103 additions & 12 deletions shapemap/src/result_shape_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,102 @@ impl ResultShapeMap {
Entry::Occupied(mut c) => {
let map = c.get_mut();
match map.entry(shape_label) {
Entry::Occupied(c) => {
let old_status = c.get();
if *old_status != status {
Err(ShapemapError::InconsistentStatus {
node: cn,
label: sl,
old_status: old_status.clone(),
new_status: status,
})
} else {
Ok(())
}
Entry::Occupied(mut c) => {
let cell_status = c.get_mut();
match (cell_status.clone(), status) {
(
ValidationStatus::Conformant(conformant_info),
ValidationStatus::Conformant(conformant_info2),
) => {
*cell_status = ValidationStatus::Conformant(
conformant_info.merge(conformant_info2),
)
}
(
ValidationStatus::Conformant(conformant_info),

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check failure on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 92 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`
ValidationStatus::NonConformant(non_conformant_info),

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check failure on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check failure on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check failure on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check warning on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check failure on line 93 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`
) => todo!(),
(
ValidationStatus::Conformant(conformant_info),

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check failure on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 96 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`
ValidationStatus::Pending,
) => {}
(
ValidationStatus::Conformant(conformant_info),

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check failure on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 100 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`
ValidationStatus::Inconsistent(
conformant_info2,

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info2`

Check failure on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info2`

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info2`

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info2`

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info2`

Check failure on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info2`

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info2`

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info2`

Check failure on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info2`

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info2`

Check warning on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info2`

Check failure on line 102 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info2`
non_conformant_info2,

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info2`

Check failure on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info2`

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info2`

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info2`

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info2`

Check failure on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info2`

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info2`

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info2`

Check failure on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info2`

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info2`

Check warning on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info2`

Check failure on line 103 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info2`
),
) => todo!(),
(
ValidationStatus::NonConformant(non_conformant_info),

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check failure on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check failure on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check failure on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `non_conformant_info`

Check warning on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `non_conformant_info`

Check failure on line 107 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `non_conformant_info`
ValidationStatus::Conformant(conformant_info),

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check failure on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `conformant_info`

Check warning on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `conformant_info`

Check failure on line 108 in shapemap/src/result_shape_map.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused variable: `conformant_info`
) => todo!(),
(
ValidationStatus::NonConformant(non_conformant_info),
ValidationStatus::NonConformant(non_conformant_info2),
) => {}
(
ValidationStatus::NonConformant(non_conformant_info),
ValidationStatus::Pending,
) => {}
(
ValidationStatus::NonConformant(non_conformant_info),
ValidationStatus::Inconsistent(
conformant_info2,
non_conformant_info2,
),
) => todo!(),
(
ValidationStatus::Pending,
ValidationStatus::Conformant(conformant_info),
) => *cell_status = ValidationStatus::Conformant(conformant_info),
(
ValidationStatus::Pending,
ValidationStatus::NonConformant(non_conformant_info),
) => {
*cell_status = ValidationStatus::NonConformant(non_conformant_info)
}
(ValidationStatus::Pending, ValidationStatus::Pending) => {}
(
ValidationStatus::Pending,
ValidationStatus::Inconsistent(
conformant_info,
non_conformant_info,
),
) => todo!(),
(
ValidationStatus::Inconsistent(
conformant_info,
non_conformant_info,
),
ValidationStatus::Conformant(conformant_info2),
) => todo!(),
(
ValidationStatus::Inconsistent(
conformant_info,
non_conformant_info,
),
ValidationStatus::NonConformant(non_conformant_info2),
) => todo!(),
(
ValidationStatus::Inconsistent(
conformant_info,
non_conformant_info,
),
ValidationStatus::Pending,
) => todo!(),
(
ValidationStatus::Inconsistent(
conformant_info,
non_conformant_info,
),
ValidationStatus::Inconsistent(
conformant_info2,
non_conformant_info2,
),
) => todo!(),
};
Ok(())
}
Entry::Vacant(v) => {
v.insert(status);
Expand Down Expand Up @@ -167,6 +251,13 @@ impl Display for ResultShapeMap {
};
write!(f, "{node_label} -> Pending")?
}
ValidationStatus::Inconsistent(conformant, inconformant) => {
let node_label = match self.pending_color() {
None => ColoredString::from(node_label),
Some(color) => node_label.color(color),
};
write!(f, "{node_label} -> Inconsistent, conformant: {conformant}, non-conformant: {inconformant}")?
}
}
}
Ok(())
Expand Down
21 changes: 21 additions & 0 deletions shapemap/src/validation_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub enum ValidationStatus {
Conformant(ConformantInfo),
NonConformant(NonConformantInfo),
Pending,
Inconsistent(ConformantInfo, NonConformantInfo),
}

impl ValidationStatus {
Expand All @@ -20,6 +21,10 @@ impl ValidationStatus {
matches!(self, ValidationStatus::NonConformant(_))
}

pub fn is_pending(&self) -> bool {
matches!(self, ValidationStatus::Pending)
}

pub fn conformant(reason: String, value: Value) -> ValidationStatus {
ValidationStatus::Conformant(ConformantInfo {
reason,
Expand Down Expand Up @@ -51,6 +56,12 @@ impl Display for ValidationStatus {
ValidationStatus::Pending => {
write!(f, "Pending")
}
ValidationStatus::Inconsistent(conformant, inconformant) => {
write!(
f,
"Inconsistent, conformant: {conformant}, inconformant: {inconformant}"
)
}
}
}
}
Expand All @@ -60,6 +71,16 @@ pub struct ConformantInfo {
app_info: Value,
}

impl ConformantInfo {
pub fn merge(&self, other: ConformantInfo) -> ConformantInfo {
let merged_reason = format!("{}\n{}", self.reason, other.reason);
ConformantInfo {
reason: merged_reason,
app_info: self.app_info.clone(),
}
}
}

impl Display for ConformantInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.reason)
Expand Down

0 comments on commit 2eea1cb

Please sign in to comment.