Return a [`crate::SchemaFragment`], which can be printed with `.to_string()` and converted to JSON with `.to_json()`.
(
self,
)
| 76 | /// Return a [`crate::SchemaFragment`], which can be printed with `.to_string()` |
| 77 | /// and converted to JSON with `.to_json()`. |
| 78 | pub(super) fn parse_schema_fragment( |
| 79 | self, |
| 80 | ) -> Result<(SchemaFragment, Box<dyn Iterator<Item = SchemaWarning>>), miette::Report> { |
| 81 | match self { |
| 82 | Self::Cedar(str) => SchemaFragment::from_cedarschema_str(&str) |
| 83 | .map(|(sch, warnings)| { |
| 84 | ( |
| 85 | sch, |
| 86 | Box::new(warnings) as Box<dyn Iterator<Item = SchemaWarning>>, |
| 87 | ) |
| 88 | }) |
| 89 | .wrap_err("failed to parse schema from string"), |
| 90 | Self::Json(val) => SchemaFragment::from_json_value(val.into()) |
| 91 | .map(|sch| { |
| 92 | ( |
| 93 | sch, |
| 94 | Box::new(std::iter::empty()) as Box<dyn Iterator<Item = SchemaWarning>>, |
| 95 | ) |
| 96 | }) |
| 97 | .wrap_err("failed to parse schema from JSON"), |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | impl LevelValidationCall { |