pub struct GateModelReport {
pub version: u32,
pub source: String,
pub count: usize,
pub on_demand: Vec<String>,
pub gates: Vec<GateModelEntry>,
pub classes: Vec<GateClass>,
pub unreadable: Option<String>,
}Expand description
The CI model this repository declares: what may refuse a change, and what selects each.
Two things about this report are worth knowing before reading one. count is measured
from gates rather than written down, so the two can never disagree the way a
hand-maintained total does. And unreadable is how a reader tells “this repository
declares no CI model” from “the call failed”: a repository of the layer is not obliged
to declare gates, so the empty model is an answer, and it says why it is empty.
use majordomus_cli::capability::builtin::gates::GateModelReport;
use serde_json::json;
// the shape every surface serves: `unreadable` is skipped when the model was read
let r: GateModelReport = serde_json::from_value(json!({
"version": 1,
"source": ".ai/repo/ci/gates.yaml",
"count": 0,
"on_demand": [],
"gates": [],
"classes": [],
})).unwrap();
assert_eq!(r.count, r.gates.len(), "the total is measured, never declared");
assert!(r.unreadable.is_none(), "read, and it declares nothing");
// and the other empty answer, which a reader must not confuse with that one
let absent: GateModelReport = serde_json::from_value(json!({
"version": 0,
"source": ".ai/repo/ci/gates.yaml",
"count": 0,
"on_demand": [],
"gates": [],
"classes": [],
"unreadable": "no such file",
})).unwrap();
assert_eq!(absent.unreadable.as_deref(), Some("no such file"));Fields§
§version: u32The schema version the file states.
source: StringWhere it was read from, repository-relative.
count: usizeHow many gates it declares; measured, not written down.
on_demand: Vec<String>The gates whose runner cannot be had on demand, so no routine plan selects them. A gate that never runs protects nothing, and this is where that is said out loud.
gates: Vec<GateModelEntry>Every gate, in declaration order, with the pathspecs its evidence is taken over.
classes: Vec<GateClass>Every path class, in declaration order.
unreadable: Option<String>Why there is no model to report, when there is none. A repository of the layer does not have to declare a CI model, and a reader is entitled to the difference between “this repository declares no gates” and “this call failed”.
Trait Implementations§
Source§impl Clone for GateModelReport
impl Clone for GateModelReport
Source§fn clone(&self) -> GateModelReport
fn clone(&self) -> GateModelReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GateModelReport
impl Debug for GateModelReport
Source§impl<'de> Deserialize<'de> for GateModelReport
impl<'de> Deserialize<'de> for GateModelReport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for GateModelReport
impl JsonSchema for GateModelReport
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more