refactor: updated a few keywords
This commit is contained in:
parent
9e2a19d56e
commit
9a0ac33831
7 changed files with 14 additions and 14 deletions
|
|
@ -27,7 +27,7 @@ object templates can define several options for each property:
|
||||||
- `transforms`: uses this property as an input of a new object
|
- `transforms`: uses this property as an input of a new object
|
||||||
- `subobjects`: creates a parent-child relationship between this and at least one more object, based on the properties sharing a value and their transformations
|
- `subobjects`: creates a parent-child relationship between this and at least one more object, based on the properties sharing a value and their transformations
|
||||||
- `conditions`: values other properties need to hold for this property to be valid
|
- `conditions`: values other properties need to hold for this property to be valid
|
||||||
- `duplicates`: makes the property act as an array
|
- `array`: makes the property act as an array
|
||||||
|
|
||||||
for more information, see the wiki!
|
for more information, see the wiki!
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ pub const TEMPLATE: &str = r#"
|
||||||
transforms = []
|
transforms = []
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = false
|
array = false
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
pub fn validate(obj: &ObjectInstance) -> Result<(), String> {
|
pub fn validate(obj: &ObjectInstance) -> Result<(), String> {
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,19 @@ conditions = [
|
||||||
["input.variant", "subobject"]
|
["input.variant", "subobject"]
|
||||||
["input.variant", "custom"]
|
["input.variant", "custom"]
|
||||||
]
|
]
|
||||||
duplicates = false
|
array = false
|
||||||
|
|
||||||
[input.from]
|
[input.from]
|
||||||
transforms = ["meta/text:value"]
|
transforms = ["meta/text:value"]
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = true
|
array = true
|
||||||
|
|
||||||
[input.to]
|
[input.to]
|
||||||
transforms = ["meta/text:value"]
|
transforms = ["meta/text:value"]
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = true
|
array = true
|
||||||
|
|
||||||
[input.property]
|
[input.property]
|
||||||
transforms = ["meta/text:value"]
|
transforms = ["meta/text:value"]
|
||||||
|
|
@ -29,7 +29,7 @@ conditions = [
|
||||||
["input.variant", "transform"]
|
["input.variant", "transform"]
|
||||||
["input.variant", "subobject"]
|
["input.variant", "subobject"]
|
||||||
]
|
]
|
||||||
duplicates = false
|
array = false
|
||||||
|
|
||||||
[input.value]
|
[input.value]
|
||||||
transforms = ["meta/text:value"]
|
transforms = ["meta/text:value"]
|
||||||
|
|
@ -37,5 +37,5 @@ subobjects = []
|
||||||
conditions = [
|
conditions = [
|
||||||
["input.variant", "custom"]
|
["input.variant", "custom"]
|
||||||
]
|
]
|
||||||
duplicates = false
|
array = false
|
||||||
"#;
|
"#;
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@ pub const TEMPLATE: &str = r#"
|
||||||
transforms = ["meta/text:value"]
|
transforms = ["meta/text:value"]
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = false
|
array = false
|
||||||
"#;
|
"#;
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ pub const TEMPLATE: &str = r#"
|
||||||
transforms = []
|
transforms = []
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = false
|
array = false
|
||||||
|
|
||||||
[local.length]
|
[local.length]
|
||||||
transforms = ["meta/number:value"]
|
transforms = ["meta/number:value"]
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = false
|
array = false
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
pub const TEMPLATE_LOCAL: &str = r#"
|
pub const TEMPLATE_LOCAL: &str = r#"
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ pub const TEMPLATE: &str = r#"
|
||||||
transforms = []
|
transforms = []
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = false
|
array = false
|
||||||
|
|
||||||
[local.length]
|
[local.length]
|
||||||
transforms = ["meta/number:value"]
|
transforms = ["meta/number:value"]
|
||||||
subobjects = []
|
subobjects = []
|
||||||
conditions = []
|
conditions = []
|
||||||
duplicates = false
|
array = false
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||||
pub struct ObjectInstance {
|
pub struct ObjectInstance {
|
||||||
pub variant: usize,
|
pub version: usize,
|
||||||
pub plotted: bool,
|
pub plotted: bool,
|
||||||
pub created: String,
|
pub created: String,
|
||||||
pub edited: String,
|
pub edited: String,
|
||||||
|
|
@ -42,7 +42,7 @@ pub struct ObjectTemplateProperty {
|
||||||
pub transforms: Vec<String>,
|
pub transforms: Vec<String>,
|
||||||
pub subobjects: Vec<String>,
|
pub subobjects: Vec<String>,
|
||||||
pub conditions: Vec<[String; 2]>,
|
pub conditions: Vec<[String; 2]>,
|
||||||
pub duplicates: bool
|
pub array: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Default)]
|
#[derive(Deserialize, Debug, Default)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue