Skip to main content

strixonomy_obo/
patch.rs

1use serde::{Deserialize, Serialize};
2
3/// OBO patch operation (ADR-0019).
4#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
5#[serde(tag = "op", rename_all = "snake_case")]
6pub enum OboPatchOp {
7    SetName {
8        term_id: String,
9        value: String,
10    },
11    AddSynonym {
12        term_id: String,
13        value: String,
14        scope: String,
15    },
16    RemoveSynonym {
17        term_id: String,
18        value: String,
19        /// When set, only a synonym with this scope is removed.
20        /// When omitted and multiple scopes share the same text, apply fails.
21        #[serde(default, skip_serializing_if = "Option::is_none")]
22        scope: Option<String>,
23    },
24    AddDef {
25        term_id: String,
26        value: String,
27    },
28    RemoveDef {
29        term_id: String,
30    },
31    AddXref {
32        term_id: String,
33        xref: String,
34    },
35    RemoveXref {
36        term_id: String,
37        xref: String,
38    },
39    SetNamespace {
40        term_id: String,
41        namespace: String,
42    },
43    SetDeprecated {
44        term_id: String,
45        value: bool,
46    },
47    AddIsA {
48        term_id: String,
49        parent_id: String,
50    },
51    RemoveIsA {
52        term_id: String,
53        parent_id: String,
54    },
55}