Skip to main content

orvanta_api/models/
bpmn_validation_issue.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 3.0.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// BpmnValidationIssue : One problem found by deploy-time BPMN validation (`backend/orvanta-bpmn/src/validate.rs`). Warnings and errors share this shape and are told apart by `severity`.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BpmnValidationIssue {
17    /// The rule that fired, e.g. `MissingScriptBinding`, `IncompleteConditionCoverage`. Stable — branch on this, not on `message`.
18    #[serde(rename = "code")]
19    pub code: String,
20    /// `error` blocks the deploy (the request is a 400). `warning` does not: the deploy succeeded and the warning is advisory.
21    #[serde(rename = "severity")]
22    pub severity: Severity,
23    /// A sentence for a human, naming the offending id(s).
24    #[serde(rename = "message")]
25    pub message: String,
26    /// The elements this problem is *about* — what an editor should mark on the canvas. Empty when the problem names nothing on the canvas (an unnamed unrecognized element, a whole-scope rule on the root process). Never the id of a *referenced* element that is missing: marking that would flag an innocent shape.
27    #[serde(rename = "element_ids")]
28    pub element_ids: Vec<String>,
29}
30
31impl BpmnValidationIssue {
32    /// One problem found by deploy-time BPMN validation (`backend/orvanta-bpmn/src/validate.rs`). Warnings and errors share this shape and are told apart by `severity`.
33    pub fn new(code: String, severity: Severity, message: String, element_ids: Vec<String>) -> BpmnValidationIssue {
34        BpmnValidationIssue {
35            code,
36            severity,
37            message,
38            element_ids,
39        }
40    }
41}
42/// `error` blocks the deploy (the request is a 400). `warning` does not: the deploy succeeded and the warning is advisory.
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
44pub enum Severity {
45    #[serde(rename = "error")]
46    Error,
47    #[serde(rename = "warning")]
48    Warning,
49}
50
51impl Default for Severity {
52    fn default() -> Severity {
53        Self::Error
54    }
55}
56