helm-schema-k8s 0.0.7

Generate an accurate JSON schema for any helm chart
Documentation
use crate::inference::candidate::ApiVersionCandidate;

/// Sort a `Vec<String>` lexicographically and remove duplicates so the
/// same logical event always produces the same payload regardless of
/// the order in which probes ran.
pub(super) fn canonicalise_strings(v: &mut Vec<String>) {
    v.sort();
    v.dedup();
}

/// Sort a `Vec<ApiVersionCandidate>` deterministically and dedupe.
pub(super) fn canonicalise_candidates(v: &mut Vec<ApiVersionCandidate>) {
    v.sort_by(|a, b| {
        a.api_version
            .cmp(&b.api_version)
            .then_with(|| a.source.cmp(&b.source))
            .then_with(|| a.origin.cmp(&b.origin))
    });
    v.dedup();
}