1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Orvanta API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 3.0.0
* Contact: contact@orvanta.cloud
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EvaluateResponse {
#[serde(rename = "hit_policy")]
pub hit_policy: String,
/// The COLLECT aggregator that ran (DMN tBuiltinAggregator). Absent for every hit policy other than COLLECT, and for a plain un-aggregated COLLECT. When present, outputs holds a scalar per output column instead of the array a plain COLLECT returns.
#[serde(rename = "aggregation", skip_serializing_if = "Option::is_none")]
pub aggregation: Option<Aggregation>,
/// 1-based rule numbers, in the order the hit policy selected them
#[serde(rename = "matched_rules")]
pub matched_rules: Vec<i32>,
/// Output values keyed by output column name (COLLECT yields an array per key)
#[serde(rename = "outputs")]
pub outputs: std::collections::HashMap<String, serde_json::Value>,
/// Inputs that have no FEEL representation and were therefore absent from the context this decision was evaluated against, each as \"`name`: reason\". Omitted rather than fatal, so that the API and a running businessRuleTask evaluate the same decision identically. Absent when everything mapped.
#[serde(rename = "unmapped_inputs", skip_serializing_if = "Option::is_none")]
pub unmapped_inputs: Option<Vec<String>>,
}
impl EvaluateResponse {
pub fn new(hit_policy: String, matched_rules: Vec<i32>, outputs: std::collections::HashMap<String, serde_json::Value>) -> EvaluateResponse {
EvaluateResponse {
hit_policy,
aggregation: None,
matched_rules,
outputs,
unmapped_inputs: None,
}
}
}
/// The COLLECT aggregator that ran (DMN tBuiltinAggregator). Absent for every hit policy other than COLLECT, and for a plain un-aggregated COLLECT. When present, outputs holds a scalar per output column instead of the array a plain COLLECT returns.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Aggregation {
#[serde(rename = "SUM")]
Sum,
#[serde(rename = "MIN")]
Min,
#[serde(rename = "MAX")]
Max,
#[serde(rename = "COUNT")]
Count,
}
impl Default for Aggregation {
fn default() -> Aggregation {
Self::Sum
}
}