{ property: "size", operator: "greater", value: "1 GiB" }
Problems:
- property values depends on the device.
- operator values depends on the property value.
- value type depends on the property value. For example:
property: "name"
requires value to be string.property: "partitionNumber"
requires value to be a number.
- The schema would be more complex because it requires conditionals for operator and value depending on the property value.
{ size: { greater: "1 GiB" } }
- The schema of each device can indicate the accepted keys:
- Drive: name, size
- Partition: name, size, number
- The schema can easily define the operators of each key.
- Name: equal
- Size: equal, greater, less, ...
- PartitionNumber: equal
- The values accepted by each property-condition is directly defined in the schema without conditionals.
{ size: "1 GiB" }
{ size: { equal: "1 GiB" } }
{ size: { greater: "1 GiB" } }
{ size: { greaterOrEqual: "1 GiB" } }
{ size: { less: "1 GiB" } }
{ size: { lessOrEqual: "1 GiB" } }
{ size: { between: ["1 GiB", "10 GiB"] } }
{
drives: [
{
search: {
condition: {
size: { greater: "10 GiB" },
},
max: 1,
ifNotFound: "error"
},
partitions: [
{
search: {
condition: { number: 3 }
ifNotFound: "create"
},
filesystem: { }
}
]
}
]
}