use super::{LowerSchema, Schema, Warning, build};
use crate::{Caveat, Verdict, json, warning};
pub(super) fn walk<'buf>(
doc: &json::Document<'buf>,
schema: &Schema,
) -> Caveat<build::Node<'buf>, Warning> {
let mut warnings = warning::Gatherer::new();
let node = super::walk(doc, schema, &mut warnings);
Caveat::new(node, warnings.into_set())
}
pub(crate) trait FromSchemaVerdict<'buf, Source>: LowerSchema<'buf, Source> {
fn verdict_from_schema(source: &Source) -> Verdict<Self, Self::Warning>;
}
impl<'buf, Source, T> FromSchemaVerdict<'buf, Source> for T
where
T: LowerSchema<'buf, Source>,
{
fn verdict_from_schema(source: &Source) -> Verdict<Self, Self::Warning> {
let mut warnings = warning::Gatherer::new();
let value = Self::lower_schema(source, &mut warnings);
warnings.into_verdict(value)
}
}