notify flows: GET returns a schema of the events, fields, node kinds and limits
This commit is contained in:
parent
627964f72d
commit
d5802d16a0
5 changed files with 281 additions and 26 deletions
|
|
@ -2118,7 +2118,10 @@ mod tests {
|
|||
let mut routed = events(DeliveryKind::Issues);
|
||||
routed.extend(events(DeliveryKind::PullRequest));
|
||||
routed.sort_unstable();
|
||||
let mut sources = swarm_wire::notify_flows::SOURCE_EVENTS.to_vec();
|
||||
let mut sources = swarm_wire::notify_flows::SOURCE_EVENTS
|
||||
.iter()
|
||||
.map(|(n, _)| *n)
|
||||
.collect::<Vec<_>>();
|
||||
sources.sort_unstable();
|
||||
assert_eq!(routed, sources);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ pub(crate) struct FlowsView {
|
|||
builtins: Vec<Flow>,
|
||||
/// The custom flows.
|
||||
flows: Vec<Flow>,
|
||||
/// What this build accepts: source events, fields, node kinds and limits,
|
||||
/// for an editor to offer. An older controller's answer has none.
|
||||
schema: notify_flows::Schema,
|
||||
}
|
||||
|
||||
/// The body of a `PUT`: the whole document.
|
||||
|
|
@ -67,6 +70,7 @@ impl FlowsView {
|
|||
disabled_builtins: doc.disabled_builtins,
|
||||
builtins: notify_flows::builtins(),
|
||||
flows: doc.flows,
|
||||
schema: notify_flows::schema(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -291,6 +295,10 @@ mod tests {
|
|||
assert_eq!(view.revision, 0);
|
||||
assert!(view.disabled_builtins.is_empty() && view.flows.is_empty());
|
||||
assert_eq!(view.builtins.len(), 3);
|
||||
let json = serde_json::to_value(&view).expect("serializes");
|
||||
assert_eq!(json["schema"]["limits"]["max_nodes"], 64);
|
||||
assert_eq!(json["schema"]["node_kinds"][0]["kind"], "source");
|
||||
assert_eq!(view.schema, notify_flows::schema());
|
||||
|
||||
let Json(saved) = put_flows(
|
||||
State(state.clone()),
|
||||
|
|
|
|||
Loading…
Reference in a new issue